]> granicus.if.org Git - clang/commitdiff
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339916 91177308-0d34-0410-b5e6-96231b3b80d8

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

diff --git a/test/Import/while-stmt/Inputs/F.cpp b/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/test/Import/while-stmt/test.cpp b/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();
+}