[PATCH] D63279: [Analyzer] Unroll for-loops where the upper boundary is a variable with know value

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 06:05:42 PDT 2019

baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added inline comments.

Comment at: lib/StaticAnalyzer/Core/LoopUnrolling.cpp:221-230
+  if (BoundNumVal.isUnknown()) {
+    if (const auto *BoundDeclRefExpr = dyn_cast<DeclRefExpr>(BoundExpr)) {
+      // FIXME: Add other declarations such as Objective-C fields
+      if (const auto *BoundVarDecl =
+              dyn_cast<VarDecl>(BoundDeclRefExpr->getDecl())) {
+        BoundNumVal = State->getSVal(
+            State->getLValue(BoundVarDecl, Pred->getLocationContext()));
Szelethus wrote:
> NoQ wrote:
> > Szelethus wrote:
> > > I don't see obvious test case for which `BoundNumVal` would be unknown, am I wrong?
> > We need an `ExprInspection` method that reliably produces an `UnknownVal`, because there's no truly valid reason to produce `UnknownVal` apart from "something is unimplemented".
> For this too.
Wrong request! :-) The test case is there. Actually we need a test case for which 'BoundNumVal' is **not** unknown. That I still fail to produce.

  rC Clang



More information about the cfe-commits mailing list