[clang] 732a8a9 - [Analyzer][solver][NFC] Add explanatory comments to trivial eq classes
Gabor Marton via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 21 03:00:19 PDT 2021
Author: Gabor Marton
Date: 2021-07-21T11:59:56+02:00
New Revision: 732a8a9dfb3ed96a0d3c9b4507b1d1a40dfa198a
URL: https://github.com/llvm/llvm-project/commit/732a8a9dfb3ed96a0d3c9b4507b1d1a40dfa198a
DIFF: https://github.com/llvm/llvm-project/commit/732a8a9dfb3ed96a0d3c9b4507b1d1a40dfa198a.diff
LOG: [Analyzer][solver][NFC] Add explanatory comments to trivial eq classes
Differential Revision: https://reviews.llvm.org/D106370
Added:
Modified:
clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
index f550aca808e56..9f64be7a5309e 100644
--- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -559,8 +559,20 @@ class EquivalenceClass : public llvm::FoldingSetNode {
/// Return a set of class members for the given state.
LLVM_NODISCARD inline SymbolSet getClassMembers(ProgramStateRef State) const;
+
/// Return true if the current class is trivial in the given state.
+ /// A class is trivial if and only if there is not any member relations stored
+ /// to it in State/ClassMembers.
+ /// An equivalence class with one member might seem as it does not hold any
+ /// meaningful information, i.e. that is a tautology. However, during the
+ /// removal of dead symbols we do not remove classes with one member for
+ /// resource and performance reasons. Consequently, a class with one member is
+ /// not necessarily trivial. It could happen that we have a class with two
+ /// members and then during the removal of dead symbols we remove one of its
+ /// members. In this case, the class is still non-trivial (it still has the
+ /// mappings in ClassMembers), even though it has only one member.
LLVM_NODISCARD inline bool isTrivial(ProgramStateRef State) const;
+
/// Return true if the current class is trivial and its only member is dead.
LLVM_NODISCARD inline bool isTriviallyDead(ProgramStateRef State,
SymbolReaper &Reaper) const;
More information about the cfe-commits
mailing list