From: Richard Smith Date: Fri, 2 Sep 2016 00:18:05 +0000 (+0000) Subject: Clean up handling of reading module files from stdin. Don't bother trying to X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab6be7a663fe9e45bfb9ea84769ca0a7d5c11028;p=clang Clean up handling of reading module files from stdin. Don't bother trying to look for a corresponding file, since we're not going to read it anyway. No observable behavior change (though we now avoid pointlessly trying to stat or open a file named "-"). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280436 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp index 66cec412d5..0a176f6fa8 100644 --- a/lib/Serialization/ModuleManager.cpp +++ b/lib/Serialization/ModuleManager.cpp @@ -408,13 +408,16 @@ bool ModuleManager::lookupModuleFile(StringRef FileName, off_t ExpectedSize, time_t ExpectedModTime, const FileEntry *&File) { + if (FileName == "-") { + File = nullptr; + return false; + } + // Open the file immediately to ensure there is no race between stat'ing and // opening the file. File = FileMgr.getFile(FileName, /*openFile=*/true, /*cacheFailure=*/false); - - if (!File && FileName != "-") { + if (!File) return false; - } if ((ExpectedSize && ExpectedSize != File->getSize()) || (ExpectedModTime && ExpectedModTime != File->getModificationTime()))