[PATCH] D53076: [analyzer] Enhance ConditionBRVisitor to write out more information

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 24 21:55:50 PDT 2018


Charusso added inline comments.


================
Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h:202
+  void finalizeConstraints() {
+    Constraints.clear();
+  }
----------------
george.karpenkov wrote:
> These constraints are conceptually part of the visitor, not part of the constraint manager. Could they be simply stored in the visitor?
My idea was to have a generic constraint map as @NoQ mentioned, then we could attach this to other places to reduce noisy reports. But probably this is the best place for now.


================
Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:244
+    if (I == Constraints.end() || !Message.equals(I->second)) {
+      Constraints[Cond] = Message;
+      return true;
----------------
george.karpenkov wrote:
> Isn't that equivalent to `Constraints.insert(make_pair(Cond, Message)).second` ?
> I think I have written that before.
We have multiple messages at the same place so we have to update the message. The problem with your code is `insert` operates with disjunct keys, not values.


https://reviews.llvm.org/D53076





More information about the cfe-commits mailing list