r280436 - Clean up handling of reading module files from stdin. Don't bother trying to

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 1 17:18:05 PDT 2016


Author: rsmith
Date: Thu Sep  1 19:18:05 2016
New Revision: 280436

URL: http://llvm.org/viewvc/llvm-project?rev=280436&view=rev
Log:
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 "-").

Modified:
    cfe/trunk/lib/Serialization/ModuleManager.cpp

Modified: cfe/trunk/lib/Serialization/ModuleManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ModuleManager.cpp?rev=280436&r1=280435&r2=280436&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ModuleManager.cpp (original)
+++ cfe/trunk/lib/Serialization/ModuleManager.cpp Thu Sep  1 19:18:05 2016
@@ -408,13 +408,16 @@ bool ModuleManager::lookupModuleFile(Str
                                      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()))




More information about the cfe-commits mailing list