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

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


Author: Jonas Devlieghere
Date: 2024-06-14T14:25:03-07:00
New Revision: 19ad7a046b5cf435ba95c100170fc0e36231d620

URL: https://github.com/llvm/llvm-project/commit/19ad7a046b5cf435ba95c100170fc0e36231d620
DIFF: https://github.com/llvm/llvm-project/commit/19ad7a046b5cf435ba95c100170fc0e36231d620.diff

LOG: [lldb] Fix the semantics of SupportFile equivalence (#95606)

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.

Added: 
    

Modified: 
    lldb/include/lldb/Utility/SupportFile.h

Removed: 
    


################################################################################
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); }


        


More information about the lldb-commits mailing list