[Lldb-commits] [lldb] [lldb] Fix the semantics of SupportFile equivalence (PR #95606)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 14 14:14:07 PDT 2024
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/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.
>From 1f04fd4a21ffd003183139dc8318deffa57f7f22 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 14 Jun 2024 13:38:56 -0700
Subject: [PATCH] [lldb] Fix the semantics of SupportFile equivalence
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.
---
lldb/include/lldb/Utility/SupportFile.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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