[PATCH] D64232: [analyzer] Prune calls to functions with linear CFGs that return a non-zero constrained value

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 11:44:39 PDT 2019

xazax.hun added inline comments.

Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:1052
+        // to return that every time.
+        if (N->getCFG().isLinear())
+          WouldEventBeMeaningless = true;
NoQ wrote:
> This time i'd rather go for "has exactly 3 blocks", because we're mostly interested in the CFG being "syntactically linear" rather than "semantically linear". I.e., if the CFG has an if-statement with a compile-time-constant condition, i'd rather show the path, because who knows what does the programmer think about this condition.
Yeah, this is a hard question, both sides can have its own reasons. 

One of my concern is that functions that does seem to be linear to people are actually not linear CFG wise. One example is single one liner functions with an assert preceding the line in question. 

Other interesting note is that once we add exception support and edges for exception handling in the CFG, all the analyzer budgets and CFG node count based heuristics need to be redone. But this is not something we should worry about at this point. 



More information about the cfe-commits mailing list