[PATCH] D51056: [ASTImporter] Add test for SwitchStmt
Raphael Isemann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 21 12:40:21 PDT 2018
teemperor created this revision.
Herald added subscribers: cfe-commits, martong.
Herald added a reviewer: a.sidorin.
Repository:
rC Clang
https://reviews.llvm.org/D51056
Files:
test/Import/switch-stmt/Inputs/F.cpp
test/Import/switch-stmt/test.cpp
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: <<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: 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)
+ ;
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51056.161798.patch
Type: text/x-patch
Size: 1695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180821/10db0fea/attachment.bin>
More information about the cfe-commits
mailing list