Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lld-macho][NFC] Remove redundant checks #67450

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Conversation

kyulee-com
Copy link
Contributor

@kyulee-com kyulee-com commented Sep 26, 2023

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

`ignoreAutoLinkOptions` checks run both in `parsereLCLinkerOptions` and `resolveLCLinkerOptions`. Conver the latter check to an assert.
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 26, 2023

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-macho

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/67450.diff

1 Files Affected:

  • (modified) lld/MachO/Driver.cpp (+2-4)
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);

@int3
Copy link
Contributor

int3 commented Sep 26, 2023

lgtm

@kyulee-com kyulee-com merged commit e04bf91 into llvm:main Sep 26, 2023
5 checks passed
legrosbuffle pushed a commit to legrosbuffle/llvm-project that referenced this pull request Sep 29, 2023
`ignoreAutoLinkOptions` checks run both in `parseLCLinkerOptions` and
`resolveLCLinkerOptions`. Convert the latter check to an assert.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants