[lld] e04bf91 - [lld-macho][NFC] Remove redundant checks (#67450)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 14:59:22 PDT 2023


Author: kyulee-com
Date: 2023-09-26T14:59:18-07:00
New Revision: e04bf911113566cec2e399f0909aed4e5dc309a0

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

LOG: [lld-macho][NFC] Remove redundant checks (#67450)

`ignoreAutoLinkOptions` checks run both in `parseLCLinkerOptions` and
`resolveLCLinkerOptions`. Convert the latter check to an assert.

Added: 
    

Modified: 
    lld/MachO/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 00ff3439a043be9..5885a1fae4f3431 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -514,15 +514,13 @@ void macho::resolveLCLinkerOptions() {
     for (unsigned i = 0; i < LCLinkerOptions.size(); ++i) {
       StringRef arg = LCLinkerOptions[i];
       if (arg.consume_front("-l")) {
-        if (config->ignoreAutoLinkOptions.contains(arg))
-          continue;
+        assert(!config->ignoreAutoLinkOptions.contains(arg));
         addLibrary(arg, /*isNeeded=*/false, /*isWeak=*/false,
                    /*isReexport=*/false, /*isHidden=*/false,
                    /*isExplicit=*/false, LoadType::LCLinkerOption);
       } else if (arg == "-framework") {
         StringRef name = LCLinkerOptions[++i];
-        if (config->ignoreAutoLinkOptions.contains(name))
-          continue;
+        assert(!config->ignoreAutoLinkOptions.contains(name));
         addFramework(name, /*isNeeded=*/false, /*isWeak=*/false,
                      /*isReexport=*/false, /*isExplicit=*/false,
                      LoadType::LCLinkerOption);


        


More information about the llvm-commits mailing list