r340464 - [ASTImporter] Add test for SwitchStmt

Raphael Isemann via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 22 15:47:11 PDT 2018


Author: teemperor
Date: Wed Aug 22 15:47:10 2018
New Revision: 340464

URL: http://llvm.org/viewvc/llvm-project?rev=340464&view=rev
Log:
[ASTImporter] Add test for SwitchStmt

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

Differential Revision: https://reviews.llvm.org/D51056

Added:
    cfe/trunk/test/Import/switch-stmt/
    cfe/trunk/test/Import/switch-stmt/Inputs/
    cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp
    cfe/trunk/test/Import/switch-stmt/test.cpp

Added: cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp?rev=340464&view=auto
==============================================================================
--- cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp (added)
+++ cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp Wed Aug 22 15:47:10 2018
@@ -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)
+    ;
+}

Added: cfe/trunk/test/Import/switch-stmt/test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/switch-stmt/test.cpp?rev=340464&view=auto
==============================================================================
--- cfe/trunk/test/Import/switch-stmt/test.cpp (added)
+++ cfe/trunk/test/Import/switch-stmt/test.cpp Wed Aug 22 15:47:10 2018
@@ -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();
+}




More information about the cfe-commits mailing list