diff options
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 66cec412d5c..0a176f6fa80 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/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())) |