Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / return-stmt-merge.cpp
bloba6bacc514575beccfb20cddd086bd435f30b4e76
1 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.AnalysisOrder,debug.ExprInspection -analyzer-config debug.AnalysisOrder:PreCall=true,debug.AnalysisOrder:PostCall=true,debug.AnalysisOrder:LiveSymbols=true %s 2>&1 | FileCheck %s
3 // This test ensures that check::LiveSymbols is called as many times on the
4 // path through the second "return" as it is through the first "return"
5 // (three), and therefore the two paths were not merged prematurely before the
6 // respective return statement is evaluated.
7 // The paths would still be merged later, so we'd have only one post-call for
8 // foo(), but it is incorrect to merge them in the middle of evaluating two
9 // different statements.
10 int coin();
12 void foo() {
13 int x = coin();
14 if (x > 0)
15 return;
16 else
17 return;
20 void bar() {
21 foo();
24 // CHECK: LiveSymbols
25 // CHECK-NEXT: LiveSymbols
26 // CHECK-NEXT: PreCall (foo)
27 // CHECK-NEXT: LiveSymbols
28 // CHECK-NEXT: LiveSymbols
29 // CHECK-NEXT: PreCall (coin)
30 // CHECK-NEXT: PostCall (coin)
31 // CHECK-NEXT: LiveSymbols
32 // CHECK-NEXT: LiveSymbols
33 // CHECK-NEXT: LiveSymbols
34 // CHECK-NEXT: PostCall (foo)
35 // CHECK-NEXT: LiveSymbols
36 // CHECK-NEXT: LiveSymbols
37 // CHECK-NEXT: LiveSymbols