[PATCH] D16044: getVariableName() for MemRegion

Alexander Droste via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 3 12:38:55 PST 2016


Alexander_Droste added a comment.




================
Comment at: tools/clang/lib/StaticAnalyzer/Core/MemRegion.cpp:662
@@ +661,3 @@
+    else if (auto SV =
+        ER->getIndex().getAs<clang::ento::nonloc::SymbolVal>()) {
+        llvm::SmallString<8> buf;
----------------
Alexander_Droste wrote:
> xazax.hun wrote:
> > These are the only cases that can occur? So it is not possible to have a loc index? Maybe we could get the value for loc and nonloc ConcreteInts and use getVariableName for everzthing else? Would that wok?
> `getIndex()` returns a `nonloc` and `loc` is in no subclass relation to `nonloc`.
> Therefore, `getIndex()` cannot be a `loc` type.
> 
> There are actually 5 `nonloc` subclasses but I assumed 
> that it only makes sense to check for `SymbolVal` and 
> `ConcreteInt`. 
> http://clang.llvm.org/doxygen/classclang_1_1ento_1_1NonLoc.html
> 
> So would you suggest to only check for `ConcreteInt`
> and call `getVariableName()` recursively if it isn't one?
If we want to call `getVariableName` recursively, should we strip the single quotes then?
Else we would get something like `'x['a']['b']'`. What do you think?


http://reviews.llvm.org/D16044





More information about the cfe-commits mailing list