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

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 04:25:40 PDT 2017


xazax.hun added a comment.

I have some comments and questions but maybe you do not want to address those until Devin, NoQ, or Anna approved the general directions.



================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:107
+/** Recursively check if variable is changed in code. */
+static bool isChanged(const Stmt *S, const VarDecl *VD, bool Write) {
+  if (!S)
----------------
Usually, we do not like bug recursions since it might eat up the stack. 
Also, do you consider the case when the variable is passed by reference to a function in another translation unit? 


================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:169
+  SVal Constraint_untested =
+      evalBinOp(State, BO_EQ, V, svalBuilder.makeIntVal(InitVal),
+                svalBuilder.getConditionType());
----------------
Does this work for non-integer typed e.g. structs? 


Repository:
  rL LLVM

https://reviews.llvm.org/D37897





More information about the cfe-commits mailing list