[lld] [llvm] [LLD][MachO] make InterfaceFile::symbols iteration order deterministic (PR #97615)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 11:22:30 PDT 2024


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 07fa7fc00f3ad5a349ae53d576f48bfd54121a7f b653d8f1e570033a26bac764106f68e77bd39f6c -- lld/MachO/InputFiles.cpp llvm/include/llvm/TextAPI/SymbolSet.h llvm/lib/TextAPI/SymbolSet.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm/TextAPI/SymbolSet.h b/llvm/include/llvm/TextAPI/SymbolSet.h
index 4362fe4a6b..41c2fcfdae 100644
--- a/llvm/include/llvm/TextAPI/SymbolSet.h
+++ b/llvm/include/llvm/TextAPI/SymbolSet.h
@@ -30,17 +30,17 @@ struct SymbolsMapKey {
   SymbolsMapKey(MachO::EncodeKind Kind, StringRef Name)
       : Kind(Kind), Name(Name) {}
 
-    bool operator==(const SymbolsMapKey &Other) const {
-      return Kind == Other.Kind && Name == Other.Name;
-    }
+  bool operator==(const SymbolsMapKey &Other) const {
+    return Kind == Other.Kind && Name == Other.Name;
+  }
 
-    bool operator!=(const SymbolsMapKey &Other) const {
-      return operator==(Other);
-    }
+  bool operator!=(const SymbolsMapKey &Other) const {
+    return operator==(Other);
+  }
 
-    bool operator<(const SymbolsMapKey &Other) const {
-      return Kind < Other.Kind || Name < Other.Name;
-    }
+  bool operator<(const SymbolsMapKey &Other) const {
+    return Kind < Other.Kind || Name < Other.Name;
+  }
 };
 template <> struct DenseMapInfo<SymbolsMapKey> {
   static inline SymbolsMapKey getEmptyKey() {
diff --git a/llvm/lib/TextAPI/SymbolSet.cpp b/llvm/lib/TextAPI/SymbolSet.cpp
index 21b9272564..0fedd9a31a 100644
--- a/llvm/lib/TextAPI/SymbolSet.cpp
+++ b/llvm/lib/TextAPI/SymbolSet.cpp
@@ -39,18 +39,21 @@ const Symbol *SymbolSet::findSymbol(EncodeKind Kind, StringRef Name,
          "expected single ObjCIFSymbolKind enum value");
   // Non-complete ObjC Interfaces are represented as global symbols.
   if (ObjCIF == ObjCIFSymbolKind::Class) {
-    auto Iter = Symbols.find({EncodeKind::GlobalSymbol, (ObjC2ClassNamePrefix + Name).str()});
+    auto Iter = Symbols.find(
+        {EncodeKind::GlobalSymbol, (ObjC2ClassNamePrefix + Name).str()});
     if (Iter != Symbols.end())
       return Iter->second;
   }
-    
+
   if (ObjCIF == ObjCIFSymbolKind::MetaClass) {
-    auto Iter = Symbols.find({EncodeKind::GlobalSymbol, (ObjC2MetaClassNamePrefix + Name).str()});
+    auto Iter = Symbols.find(
+        {EncodeKind::GlobalSymbol, (ObjC2MetaClassNamePrefix + Name).str()});
     if (Iter != Symbols.end())
       return Iter->second;
   }
 
-  Iter = Symbols.find({EncodeKind::GlobalSymbol, (ObjC2EHTypePrefix + Name).str()});
+  Iter = Symbols.find(
+      {EncodeKind::GlobalSymbol, (ObjC2EHTypePrefix + Name).str()});
   if (Iter != Symbols.end())
     return Iter->second;
 

``````````

</details>


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


More information about the llvm-commits mailing list