31 lines · c
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,deadcode.DeadStores,debug.Stats -verify -Wno-unreachable-code -analyzer-max-loop 4 %s2 3int foo(void);4 5int test(void) { // expected-warning-re{{test -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: no | Empty WorkList: yes}}6 int a = 1;7 a = 34 / 12;8 9 if (foo())10 return a;11 12 a /= 4;13 return a;14}15 16 17int sink(void) // expected-warning-re{{sink -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 1 | Exhausted Block: yes | Empty WorkList: yes}}18{19 for (int i = 0; i < 10; ++i) // expected-warning {{(sink): The analyzer generated a sink at this point}}20 ++i;21 22 return 0;23}24 25int emptyConditionLoop(void) // expected-warning-re{{emptyConditionLoop -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: yes | Empty WorkList: yes}}26{27 int num = 1;28 for (;;)29 num++;30}31