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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 07:55:35 PDT 2017


NoQ added a comment.

> however as far as I see this will mean the LoopUnroller AST matchers can't be reused unless I change them.

Hmm. What is the problem here? I'm expecting library linkage issues (i.e. libAnalysis is not linked to libASTMatchers directly), but i guess it'd better to have the whole thing in libAnalysis then (Peter, WDYT?). Or maybe we could move the code around a bit, so that we're still in libStaticAnalyzerCore but at roughly the same moment of time.

Because you're duplicating the solution for exact same problem, using different technology, and this problem is not trivial (eg. you still need to consider reference-type declstmts and initializer lists which are not taken into account in your solution yet) so i'd dislike the idea of duplicating it.



================
Comment at: lib/Analysis/CallGraph.cpp:104
+
+  void markModifiedVars(Stmt *S) {
+    // Increment/Decrement, taking address of variable
----------------
A hint, even if we don't use visitors: the whole point of having a visitor is about not needing to make a pattern-matching (switch or sequence of dyn_casts) by statement kind yourself, like you do in this function. You already have VisitUnaryOperator, VisitBinaryOperator, VisitCallExpr, etc., so you can add the code there.


Repository:
  rL LLVM

https://reviews.llvm.org/D37897





More information about the cfe-commits mailing list