mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 13:06:40 +00:00

It was previously reverted by 8406839d1926486de900c7cabeea9f841bd3edf2. --- This flag was introduced by6818991d71
commit 6818991d7165f68fe196922d9e5c6648dd57cc47 Author: Ted Kremenek <kremenek@apple.com> Date: Mon Dec 7 22:06:12 2009 +0000 Add clang-cc option '-analyzer-opt-analyze-nested-blocks' to treat block literals as an entry point for analyzer checks. The last reference was removed by this commit:5c32dfc5fb
commit 5c32dfc5fb1cfcff8ae3671284e17daa8da3a188 Author: Anna Zaks <ganna@apple.com> Date: Fri Dec 21 01:19:15 2012 +0000 [analyzer] Add blocks and ObjC messages to the call graph. This paves the road for constructing a better function dependency graph. If we analyze a function before the functions it calls and inlines, there is more opportunity for optimization. Note, we add call edges to the called methods that correspond to function definitions (declarations with bodies). Consequently, we should remove this dead flag. However, this arises a couple of burning questions. - Should the `cc1` frontend still accept this flag - to keep tools/users passing this flag directly to `cc1` (which is unsupported, unadvertised) working. - If we should remain backward compatible, how long? - How can we get rid of deprecated and obsolete flags at some point? Reviewed By: martong Differential Revision: https://reviews.llvm.org/D126067
31 lines
887 B
C
31 lines
887 B
C
// RUN: %clang_analyze_cc1 -analyzer-checker=core,deadcode.DeadStores,debug.Stats -verify -Wno-unreachable-code -analyzer-max-loop 4 %s
|
|
|
|
int foo(void);
|
|
|
|
int test(void) { // expected-warning-re{{test -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: no | Empty WorkList: yes}}
|
|
int a = 1;
|
|
a = 34 / 12;
|
|
|
|
if (foo())
|
|
return a;
|
|
|
|
a /= 4;
|
|
return a;
|
|
}
|
|
|
|
|
|
int sink(void) // expected-warning-re{{sink -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 1 | Exhausted Block: yes | Empty WorkList: yes}}
|
|
{
|
|
for (int i = 0; i < 10; ++i) // expected-warning {{(sink): The analyzer generated a sink at this point}}
|
|
++i;
|
|
|
|
return 0;
|
|
}
|
|
|
|
int emptyConditionLoop(void) // expected-warning-re{{emptyConditionLoop -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: yes | Empty WorkList: yes}}
|
|
{
|
|
int num = 1;
|
|
for (;;)
|
|
num++;
|
|
}
|