ModuleManager: Simplify lookupModuleFile by only setting the out parameter once, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 20 Oct 2020 22:53:51 +0000 (18:53 -0400)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 28 Oct 2020 23:04:22 +0000 (19:04 -0400)
Differential Revision: https://reviews.llvm.org/D89835

clang/lib/Serialization/ModuleManager.cpp

index 542e75e..2c65c0b 100644 (file)
@@ -462,19 +462,17 @@ bool ModuleManager::lookupModuleFile(StringRef FileName,
                                      off_t ExpectedSize,
                                      time_t ExpectedModTime,
                                      const FileEntry *&File) {
-  if (FileName == "-") {
-    File = nullptr;
+  File = nullptr;
+  if (FileName == "-")
     return false;
-  }
 
   // Open the file immediately to ensure there is no race between stat'ing and
   // opening the file.
   auto FileOrErr = FileMgr.getFile(FileName, /*OpenFile=*/true,
                                    /*CacheFailure=*/false);
-  if (!FileOrErr) {
-    File = nullptr;
+  if (!FileOrErr)
     return false;
-  }
+
   File = *FileOrErr;
 
   if ((ExpectedSize && ExpectedSize != File->getSize()) ||