[PATCH] D52667: [analyzer] Fix conversion from LocAsInteger to Loc symbol.

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 13:49:52 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC343631: [analyzer] Fix symbol discovery in nonloc::LocAsInteger values. (authored by dergachev, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D52667

Files:
  lib/StaticAnalyzer/Core/SVals.cpp
  test/Analysis/symbol-reaper.c


Index: test/Analysis/symbol-reaper.c
===================================================================
--- test/Analysis/symbol-reaper.c
+++ test/Analysis/symbol-reaper.c
@@ -85,8 +85,7 @@
     x = (int)&(s->field);
     ptr = &arr[x];
     if (s) {}
-  // FIXME: Should not warn. The symbol is still alive within the ptr's index.
-  } while (0); // expected-warning{{SYMBOL DEAD}}
+  } while (0);
 }
 
 // Test below checks lifetime of SymbolRegionValue in certain conditions.
Index: lib/StaticAnalyzer/Core/SVals.cpp
===================================================================
--- lib/StaticAnalyzer/Core/SVals.cpp
+++ lib/StaticAnalyzer/Core/SVals.cpp
@@ -85,7 +85,7 @@
 SymbolRef SVal::getAsLocSymbol(bool IncludeBaseRegions) const {
   // FIXME: should we consider SymbolRef wrapped in CodeTextRegion?
   if (Optional<nonloc::LocAsInteger> X = getAs<nonloc::LocAsInteger>())
-    return X->getLoc().getAsLocSymbol();
+    return X->getLoc().getAsLocSymbol(IncludeBaseRegions);
 
   if (Optional<loc::MemRegionVal> X = getAs<loc::MemRegionVal>()) {
     const MemRegion *R = X->getRegion();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52667.168019.patch
Type: text/x-patch
Size: 1105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181002/c933dcc7/attachment.bin>


More information about the cfe-commits mailing list