[ASTImporter] Add test for WhileStmt
authorRaphael Isemann <teemperor@gmail.com>
Thu, 16 Aug 2018 18:20:05 +0000 (18:20 +0000)
committerRaphael Isemann <teemperor@gmail.com>
Thu, 16 Aug 2018 18:20:05 +0000 (18:20 +0000)
Reviewers: a.sidorin, martong

Reviewed By: martong

Subscribers: rnkovacs, martong, cfe-commits

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

llvm-svn: 339916

clang/test/Import/while-stmt/Inputs/F.cpp [new file with mode: 0644]
clang/test/Import/while-stmt/test.cpp [new file with mode: 0644]

diff --git a/clang/test/Import/while-stmt/Inputs/F.cpp b/clang/test/Import/while-stmt/Inputs/F.cpp
new file mode 100644 (file)
index 0000000..6fd2d87
--- /dev/null
@@ -0,0 +1,8 @@
+void f() {
+  while (false)
+    ;
+  while (false) {
+  }
+  while (bool ini = true)
+    ;
+}
diff --git a/clang/test/Import/while-stmt/test.cpp b/clang/test/Import/while-stmt/test.cpp
new file mode 100644 (file)
index 0000000..f2d0d39
--- /dev/null
@@ -0,0 +1,23 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s
+
+// CHECK: WhileStmt
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: CXXBoolLiteralExpr
+// CHECK-NEXT: NullStmt
+
+// CHECK: WhileStmt
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: CXXBoolLiteralExpr
+// CHECK-NEXT: CompoundStmt
+
+// CHECK: WhileStmt
+// CHECK-NEXT: DeclStmt
+// CHECK-NEXT: VarDecl
+// CHECK-NEXT: CXXBoolLiteralExpr
+// CHECK-NEXT: ImplicitCastExpr
+// CHECK-NEXT: DeclRefExpr
+// CHECK-NEXT: NullStmt
+
+void expr() {
+  f();
+}