[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / domtest.cpp
blob2a2caed130d79f92dc324e5d88ee1cc1df64da4f
1 // RUN: %clang_analyze_cc1 -std=c++14 %s \
2 // RUN: -analyzer-checker=debug.DumpDominators \
3 // RUN: -analyzer-checker=debug.DumpPostDominators \
4 // RUN: -analyzer-checker=debug.DumpControlDependencies \
5 // RUN: 2>&1 | FileCheck %s
7 bool coin();
9 namespace pr42041_unreachable_cfg_successor {
10 enum Kind {
14 void f() {
15 switch(Kind{}) {
16 case A:
17 break;
20 } // end of namespace pr42041_unreachable_cfg_successor
22 // [B3 (ENTRY)] -> [B1] -> [B2] -> [B0 (EXIT)]
24 // CHECK: Control dependencies (Node#,Dependency#):
25 // CHECK-NEXT: Immediate dominance tree (Node#,IDom#):
26 // CHECK-NEXT: (0,2)
27 // CHECK-NEXT: (1,3)
28 // CHECK-NEXT: (2,1)
29 // CHECK-NEXT: (3,3)
30 // CHECK-NEXT: Immediate post dominance tree (Node#,IDom#):
31 // CHECK-NEXT: (0,0)
32 // CHECK-NEXT: (1,2)
33 // CHECK-NEXT: (2,0)
34 // CHECK-NEXT: (3,1)
36 void funcWithBranch() {
37 int x = 0;
38 if (coin()) {
39 if (coin()) {
40 x = 5;
42 int j = 10 / x;
43 (void)j;
47 // 1st if 2nd if
48 // [B5 (ENTRY)] -> [B4] -> [B3] -> [B2] -> [B1] -> [B0 (EXIT)]
49 // \ \ / /
50 // \ -------------> /
51 // ------------------------------>
53 // CHECK: Control dependencies (Node#,Dependency#):
54 // CHECK-NEXT: (1,4)
55 // CHECK-NEXT: (2,3)
56 // CHECK-NEXT: (2,4)
57 // CHECK-NEXT: (3,4)
58 // CHECK-NEXT: Immediate dominance tree (Node#,IDom#):
59 // CHECK-NEXT: (0,4)
60 // CHECK-NEXT: (1,3)
61 // CHECK-NEXT: (2,3)
62 // CHECK-NEXT: (3,4)
63 // CHECK-NEXT: (4,5)
64 // CHECK-NEXT: (5,5)
65 // CHECK-NEXT: Immediate post dominance tree (Node#,IDom#):
66 // CHECK-NEXT: (0,0)
67 // CHECK-NEXT: (1,0)
68 // CHECK-NEXT: (2,1)
69 // CHECK-NEXT: (3,1)
70 // CHECK-NEXT: (4,0)
71 // CHECK-NEXT: (5,4)