Index: test/Import/switch-stmt/Inputs/F.cpp =================================================================== --- /dev/null +++ test/Import/switch-stmt/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + switch (1) { + case 1: + case 2: + break; + } + switch (int varname; 1) { + case 1: + break; + case 2: + break; + } + switch (1) + default: + break; + switch (0) + ; +} Index: test/Import/switch-stmt/test.cpp =================================================================== --- /dev/null +++ test/Import/switch-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: DefaultStmt +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: NullStmt + +void expr() { + f(); +}