[PATCH] D89835: ModuleManager: Simplify lookupModuleFile by only setting the out parameter once, NFC

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 16:22:25 PDT 2020


dexonsmith created this revision.
dexonsmith added a reviewer: JDevlieghere.
Herald added a subscriber: ributzka.
dexonsmith requested review of this revision.

https://reviews.llvm.org/D89835

Files:
  clang/lib/Serialization/ModuleManager.cpp


Index: clang/lib/Serialization/ModuleManager.cpp
===================================================================
--- clang/lib/Serialization/ModuleManager.cpp
+++ clang/lib/Serialization/ModuleManager.cpp
@@ -462,19 +462,17 @@
                                      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()) ||


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89835.299508.patch
Type: text/x-patch
Size: 932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201020/c180b579/attachment.bin>


More information about the cfe-commits mailing list