[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

Peter Szecsi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 6 07:58:38 PDT 2017


szepet added a comment.

Hello Daniel!

It is a great feature to add, thanks for working on this!
I have just small comments (rather questions) on the code.



================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:155
+  Children.push(FuncBody);
+  while (!Children.empty()) {
+    const Stmt *Child = Children.top();
----------------
I think instead of this logic it would be better to use ConstStmtVisitor. In this case it does quite the same thing in a (maybe?) more structured manner. What do you think?


================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:168
+          VD->getStorageClass() == SC_Static &&
+          !VD->getType()->isPointerType()) {
+        Vars->insert(VD);
----------------
Is it possible that a type is an IntegerType and a  PointerType at the same time? If these are excluding cases then the check for !isPointer could be removed.


Repository:
  rL LLVM

https://reviews.llvm.org/D37897





More information about the cfe-commits mailing list