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

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 14 09:25:48 PDT 2019


Charusso added a comment.

Thanks you @NoQ for the great idea!

Without the duplicated `BugReport.cpp` reports it could be an on-by-default patch, see:

Before:
F8685549: before.html <https://reviews.llvm.org/F8685549>

After:
F8685550: after.html <https://reviews.llvm.org/F8685550>

It is not perfect, but I like that and I have already got ideas how to use these new pieces.



================
Comment at: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:187-190
+  // The value may hard-coded.
+  SVal HardCodedSVal = State->getSVal(CondVarExpr, LCtx);
+  if (auto HardCodedCI = HardCodedSVal.getAs<nonloc::ConcreteInt>())
+    return &HardCodedCI->getValue();
----------------
NoQ wrote:
> I don't see this triggered on tests. It looks to me that this function is for now only applied to `DeclRefExpr`s that are always glvalues and therefore should never be evaluated to a `nonloc` value.
Good catch!


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

https://reviews.llvm.org/D53076





More information about the cfe-commits mailing list