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

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 09:10:03 PDT 2023


https://github.com/kyulee-com created https://github.com/llvm/llvm-project/pull/67450

`ignoreAutoLinkOptions` checks run both in `parsereLCLinkerOptions` and `resolveLCLinkerOptions`. Conver the latter check to an assert.

>From 767be98d6de70b0f300279bb88679e94fe32f79a Mon Sep 17 00:00:00 2001
From: Kyungwoo Lee <kyulee at fb.com>
Date: Tue, 26 Sep 2023 09:07:42 -0700
Subject: [PATCH] [lld-macho][NFC] Remove redundant checks

`ignoreAutoLinkOptions` checks run both in `parsereLCLinkerOptions` and `resolveLCLinkerOptions`. Conver the latter check to an assert.
---
 lld/MachO/Driver.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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