This revision was automatically updated to reflect the committed changes. Closed by commit rL340464: [ASTImporter] Add test for SwitchStmt (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D51056?vs=161798&id=162082#toc Repository: rL LLVM https://reviews.llvm.org/D51056 Files: cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp cfe/trunk/test/Import/switch-stmt/test.cpp Index: cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp =================================================================== --- cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp +++ cfe/trunk/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: cfe/trunk/test/Import/switch-stmt/test.cpp =================================================================== --- cfe/trunk/test/Import/switch-stmt/test.cpp +++ cfe/trunk/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: <<NULL>> +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: BreakStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: DefaultStmt +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: NullStmt + +void expr() { + f(); +}
Index: cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp =================================================================== --- cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp +++ cfe/trunk/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: cfe/trunk/test/Import/switch-stmt/test.cpp =================================================================== --- cfe/trunk/test/Import/switch-stmt/test.cpp +++ cfe/trunk/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: <<NULL>> +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: BreakStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: DefaultStmt +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: <<NULL>> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: NullStmt + +void expr() { + f(); +}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits