================ @@ -0,0 +1,198 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify=expected,default %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config legacy-inlining-prevention=false -verify=expected,disabled %s + +int getNum(void); // Get an opaque number. + +void clang_analyzer_numTimesReached(void); +void clang_analyzer_dump(int arg); + +//----------------------------------------------------------------------------- +// Simple case: inlined function never reaches `analyzer-max-loop`. + +int inner_simple(void) { + clang_analyzer_numTimesReached(); // expected-warning {{2}} + return 42; +} + +int outer_simple(void) { + int x = inner_simple(); + int y = inner_simple(); + return 53 / (x - y); // expected-warning {{Division by zero}} +} + +//----------------------------------------------------------------------------- +// Inlined function always reaches `analyzer-max-loop`. + +int inner_fixed_loop_1(void) { + int i; + clang_analyzer_numTimesReached(); // expected-warning {{1}} ---------------- NagyDonat wrote:
Ok, I can switch all testcases to using `clang_analyzer_dump(arg)` instead of `numTimesReached` to highlight _which_ calls were inlined (and not just their count). There are already a few testcases where I use that solution (because I need it for multiple entry points), but you're right that it would be helpful in the other cases as well. https://github.com/llvm/llvm-project/pull/136720 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits