1 // RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -std=c++11 %s 2>&1 | FileCheck %s 2 3 // CHECK: ENTRY 4 // CHECK-NEXT: Succs (1): B1 5 // CHECK: [B1] 6 // CHECK: Succs (21): B2 B3 B4 B5 B6 B7 B8 B9 7 // CHECK: B10 B11 B12 B13 B14 B15 B16 B17 B18 B19 8 // CHECK: B20 B21 B0 9 // CHECK: [B0 (EXIT)] 10 // CHECK-NEXT: Preds (21): B2 B3 B4 B5 B6 B7 B8 B9 11 // CHECK-NEXT: B10 B11 B12 B13 B14 B15 B16 B17 B18 B19 12 // CHECK-NEXT: B20 B21 B1 13 void checkWrap(int i) { 14 switch(i) { 15 case 0: break; 16 case 1: break; 17 case 2: break; 18 case 3: break; 19 case 4: break; 20 case 5: break; 21 case 6: break; 22 case 7: break; 23 case 8: break; 24 case 9: break; 25 case 10: break; 26 case 11: break; 27 case 12: break; 28 case 13: break; 29 case 14: break; 30 case 15: break; 31 case 16: break; 32 case 17: break; 33 case 18: break; 34 case 19: break; 35 } 36 } 37 38 // CHECK: ENTRY 39 // CHECK-NEXT: Succs (1): B1 40 // CHECK: [B1] 41 // CHECK-NEXT: 1: int i; 42 // CHECK-NEXT: 2: int j; 43 // CHECK-NEXT: 3: 1 44 // CHECK-NEXT: 4: int k = 1; 45 // CHECK-NEXT: 5: int l; 46 // CHECK-NEXT: 6: 2 47 // CHECK-NEXT: 7: int m = 2; 48 // CHECK-NEXT: CXXConstructExpr 49 // CHECK-NEXT: 9: struct standalone myStandalone; 50 // CHECK-NEXT: CXXConstructExpr 51 // CHECK-NEXT: 11: struct <anonymous struct at {{.*}}> myAnon; 52 // CHECK-NEXT: CXXConstructExpr 53 // CHECK-NEXT: 13: struct named myNamed; 54 // CHECK-NEXT: Preds (1): B2 55 // CHECK-NEXT: Succs (1): B0 56 void checkDeclStmts() { 57 int i, j; 58 int k = 1, l, m = 2; 59 60 struct standalone { int x, y; }; 61 struct standalone myStandalone; 62 63 struct { int x, y; } myAnon; 64 65 struct named { int x, y; } myNamed; 66 67 static_assert(1, "abc"); 68 } 69 70 // CHECK: ENTRY 71 // CHECK-NEXT: Succs (1): B1 72 // CHECK: [B1] 73 // CHECK-NEXT: 1: e 74 // CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, enum EmptyE) 75 // CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, IntegralCast, int) 76 // CHECK-NEXT: T: switch [B1.3] 77 // CHECK-NEXT: Preds (1): B2 78 // CHECK-NEXT: Succs (1): B0 79 // CHECK: [B0 (EXIT)] 80 // CHECK-NEXT: Preds (1): B1 81 enum EmptyE {}; 82 void F(EmptyE e) { 83 switch (e) {} 84 } 85