[PATCH] D61051: [analyzer] Treat functions without runtime branches as "small".
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 25 15:08:24 PDT 2019
NoQ added inline comments.
================
Comment at: clang/lib/Analysis/CFG.cpp:4684
+ if (size() <= 3)
+ return true;
+
----------------
Szelethus wrote:
> What are the cases for the size being 2 or 1? Empty function? Is a size of 1 even possible? Can we enforce something here with asserts?
An empty function, i.e. `void foo() {}`, has two CFG blocks. Every CFG has (by construction) at least an ENTRY and an EXIT, but i don't think this is the right place to introduce such sanity check.
================
Comment at: clang/test/Analysis/inline-if-constexpr.cpp:16
+void bar() {
+ clang_analyzer_eval(f7()); // expected-warning{{TRUE}}
+}
----------------
NoQ wrote:
> Szelethus wrote:
> > Aha, we wouldve seen UNKNOWN because the analyzer wouldn't inline these many functions, right? Neat!
> Aha, yup.
Hardcoded the max stack depth count to make this more apparent and prevent the test from not testing anything if it's bumped.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61051/new/
https://reviews.llvm.org/D61051
More information about the cfe-commits
mailing list