[PATCH] D61051: [analyzer] Treat functions without runtime branches as "small".

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 14:45:59 PDT 2019


NoQ marked 4 inline comments as done.
NoQ added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h:723
+  /// should always inline simply because it's small enough.
+  bool isSmall(AnalysisDeclContext *ADC) const;
+
----------------
Szelethus wrote:
> Your explanation of state splitting, and early returns and the like could be added here as well :)
This function can be controlled through -analyzer-config, which breaks the explanation. I guess i'll put it inside the body.


================
Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:890
   // Do not inline large functions.
-  if (CalleeCFG->getNumBlockIDs() > Opts.MaxInlinableSize)
+  if (CalleeCFG->getNumBlockIDs() >= Opts.MaxInlinableSize)
     return false;
----------------
Szelethus wrote:
> Nice.
Whoops, that was actually accidental.


================
Comment at: clang/test/Analysis/inline-if-constexpr.cpp:16
+void bar() {
+  clang_analyzer_eval(f7()); // expected-warning{{TRUE}}
+}
----------------
Szelethus wrote:
> Aha, we wouldve seen UNKNOWN because the analyzer wouldn't inline these many functions, right? Neat!
Aha, yup.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61051/new/

https://reviews.llvm.org/D61051





More information about the cfe-commits mailing list