diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-09-02 00:18:05 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-09-02 00:18:05 +0000 |
commit | 3bd6d7fb788c751539c6de2d1f9bccffdc51e372 (patch) | |
tree | a4ba8be4818efcbe1c465b52e78d9f9bc209ba7b /clang/lib/Serialization/ModuleManager.cpp | |
parent | 3b99db55662c09fba37b1d7f0701711cc23e23a0 (diff) | |
download | llvm-3bd6d7fb788c751539c6de2d1f9bccffdc51e372.zip llvm-3bd6d7fb788c751539c6de2d1f9bccffdc51e372.tar.gz llvm-3bd6d7fb788c751539c6de2d1f9bccffdc51e372.tar.bz2 |
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 "-").
llvm-svn: 280436
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-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 66cec41..0a176f6 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())) |