[lld] [lld][ELF/MachO] Use `.contains` rather than `.count` for set membership. NFC (PR #177404)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 22 09:16:31 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,inc -- lld/ELF/Arch/ARM.cpp lld/ELF/Arch/PPC64.cpp lld/ELF/Driver.cpp lld/ELF/LTO.cpp lld/ELF/LinkerScript.cpp lld/ELF/ScriptParser.cpp lld/ELF/SyntheticSections.cpp lld/ELF/Writer.cpp lld/MachO/InputFiles.cpp lld/MachO/ObjC.cpp lld/MachO/SymbolTable.cpp lld/include/lld/Common/BPSectionOrdererBase.inc --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 8982094c3..76f04a27b 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1093,7 +1093,8 @@ void LinkerScript::diagnoseMissingSGSectionAddress() const {
     return;
 
   OutputSection *sec = findByName(sectionCommands, ".gnu.sgstubs");
-  if (sec && !sec->addrExpr && !ctx.arg.sectionStartMap.contains(".gnu.sgstubs"))
+  if (sec && !sec->addrExpr &&
+      !ctx.arg.sectionStartMap.contains(".gnu.sgstubs"))
     ErrAlways(ctx) << "no address assigned to the veneers output section "
                    << sec->name;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/177404


More information about the llvm-commits mailing list