[lld] 3a6a60f - [lld/mac] Make a variable more local; no behavior change

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 20 19:00:19 PDT 2021


Author: Nico Weber
Date: 2021-06-20T21:59:15-04:00
New Revision: 3a6a60f6c9c4a682de829635d7b9bb3bb64c2a7d

URL: https://github.com/llvm/llvm-project/commit/3a6a60f6c9c4a682de829635d7b9bb3bb64c2a7d
DIFF: https://github.com/llvm/llvm-project/commit/3a6a60f6c9c4a682de829635d7b9bb3bb64c2a7d.diff

LOG: [lld/mac] Make a variable more local; no behavior change

The variable used to need the wider scope, but doesn't after the
reland. See LC_LINKER_OPTIONS-related discussion on
https://reviews.llvm.org/D104353 for background.

Added: 
    

Modified: 
    lld/MachO/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index a162682a5d6c..f91fca099904 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -255,8 +255,7 @@ static InputFile *addFile(StringRef path, bool forceLoadArchive,
     // We don't take a reference to cachedFile here because the
     // loadArchiveMember() call below may recursively call addFile() and
     // invalidate this reference.
-    ArchiveFile *cachedFile = loadedArchives[path];
-    if (cachedFile)
+    if (ArchiveFile *cachedFile = loadedArchives[path])
       return cachedFile;
 
     std::unique_ptr<object::Archive> file = CHECK(


        


More information about the llvm-commits mailing list