[Lldb-commits] [lldb] [lldb] Speed up SymbolContextList::AppendIfUnique (PR #181952)

via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 17 17:48:57 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 h,cpp -- lldb/include/lldb/Symbol/SymbolContext.h lldb/source/Symbol/SymbolContext.cpp --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/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 637765b77..62b4091c6 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -1210,14 +1210,14 @@ unsigned
 SymbolContextList::SymbolContextInfo::getHashValue(const SymbolContext &sc) {
   // Hash all fields EXCEPT symbol, since CompareConsideringPossiblyNullSymbol
   // ignores them.
-  auto line_entry_hash = sc.line_entry.IsValid()
-                             ? llvm::hash_combine(
-                                   sc.line_entry.range.GetBaseAddress().GetFileAddress(),
-                                   sc.line_entry.range.GetByteSize(),
-                                   sc.line_entry.is_terminal_entry,
-                                   sc.line_entry.line,
-                                   sc.line_entry.column)
-                             : llvm::hash_value(0);
+  auto line_entry_hash =
+      sc.line_entry.IsValid()
+          ? llvm::hash_combine(
+                sc.line_entry.range.GetBaseAddress().GetFileAddress(),
+                sc.line_entry.range.GetByteSize(),
+                sc.line_entry.is_terminal_entry, sc.line_entry.line,
+                sc.line_entry.column)
+          : llvm::hash_value(0);
   return static_cast<unsigned>(llvm::hash_combine(
       sc.function, sc.module_sp.get(), sc.comp_unit, sc.target_sp.get(),
       line_entry_hash, sc.variable, sc.block));
@@ -1225,8 +1225,9 @@ SymbolContextList::SymbolContextInfo::getHashValue(const SymbolContext &sc) {
 
 bool SymbolContextList::SymbolContextInfo::isEqual(const SymbolContext &lhs,
                                                    const SymbolContext &rhs) {
-  // Check for empty/tombstone keys first, since these are invalid pointers we don't 
-  // want to accidentally dereference them in CompareConsideringPossiblyNullSymbol.
+  // Check for empty/tombstone keys first, since these are invalid pointers we
+  // don't want to accidentally dereference them in
+  // CompareConsideringPossiblyNullSymbol.
   if (lhs.function == llvm::DenseMapInfo<Function *>::getEmptyKey() ||
       rhs.function == llvm::DenseMapInfo<Function *>::getEmptyKey() ||
       lhs.function == llvm::DenseMapInfo<Function *>::getTombstoneKey() ||
@@ -1279,7 +1280,7 @@ bool SymbolContextList::AppendIfUnique(const SymbolContext &sc,
     }
   } else {
     // We've just crossed the threshold. Populate the set from existing items.
-    // Since the set won't be empty after this every new append operation will 
+    // Since the set won't be empty after this every new append operation will
     // keep the set in sync with the vector.
     for (const auto &existing : m_symbol_contexts)
       m_lookup_set.insert(existing);

``````````

</details>


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


More information about the lldb-commits mailing list