[Lldb-commits] [lldb] [lldb] Fix the semantics of SupportFile equivalence (PR #95606)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 14 14:14:37 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

Currently, two SupportFiles with the same FileSpec are considered different if one of them has a Checksum and the other doesn't. However, this is overly strict. It's totally valid to mix LineTables that do and do not contain Checksums. This patch makes it so that the Checksum is only compared if both SupportFiles have a valid Checksum.

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


1 Files Affected:

- (modified) lldb/include/lldb/Utility/SupportFile.h (+5-1) 


``````````diff
diff --git a/lldb/include/lldb/Utility/SupportFile.h b/lldb/include/lldb/Utility/SupportFile.h
index 7505d7f345c5d..d65156cea768f 100644
--- a/lldb/include/lldb/Utility/SupportFile.h
+++ b/lldb/include/lldb/Utility/SupportFile.h
@@ -30,8 +30,12 @@ class SupportFile {
 
   virtual ~SupportFile() = default;
 
+  /// Return true if both SupportFiles have the same FileSpec and, if both have
+  /// a valid Checksum, the Checksum is the same.
   bool operator==(const SupportFile &other) const {
-    return m_file_spec == other.m_file_spec && m_checksum == other.m_checksum;
+    if (m_checksum && other.m_checksum)
+      return m_file_spec == other.m_file_spec && m_checksum == other.m_checksum;
+    return m_file_spec == other.m_file_spec;
   }
 
   bool operator!=(const SupportFile &other) const { return !(*this == other); }

``````````

</details>


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


More information about the lldb-commits mailing list