[PATCH] D106370: [Analyzer][solver][NFC] Add explanatory comments to trivial eq classes

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 21 03:00:27 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG732a8a9dfb3e: [Analyzer][solver][NFC] Add explanatory comments to trivial eq classes (authored by martong).

Changed prior to commit:
  https://reviews.llvm.org/D106370?vs=360152&id=360398#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106370/new/

https://reviews.llvm.org/D106370

Files:
  clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp


Index: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -559,8 +559,20 @@
 
   /// 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106370.360398.patch
Type: text/x-patch
Size: 1524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210721/35eacc2e/attachment.bin>


More information about the cfe-commits mailing list