[PATCH] D50796: [ASTImporter] Add test for IfStmt
Raphael Isemann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 15 11:45:28 PDT 2018
teemperor created this revision.
Herald added a subscriber: martong.
Herald added a reviewer: a.sidorin.
Repository:
rC Clang
https://reviews.llvm.org/D50796
Files:
test/Import/if-stmt/Inputs/F.cpp
test/Import/if-stmt/test.cpp
Index: test/Import/if-stmt/test.cpp
===================================================================
--- /dev/null
+++ test/Import/if-stmt/test.cpp
@@ -0,0 +1,47 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s
+
+// CHECK: IfStmt
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: CXXBoolLiteralExpr
+// CHECK-NEXT: ReturnStmt
+// CHECK-NEXT: <<NULL>>
+
+// CHECK: IfStmt
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: DeclStmt
+// CHECK-NEXT: VarDecl
+// CHECK-NEXT: IntegerLiteral
+// CHECK-NEXT: ImplicitCastExpr
+// CHECK-NEXT: ImplicitCastExpr
+// CHECK-NEXT: DeclRefExpr
+// CHECK-NEXT: ReturnStmt
+// CHECK-NEXT: <<NULL>>
+
+// CHECK: IfStmt
+// CHECK-NEXT: DeclStmt
+// CHECK-NEXT: VarDecl
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: CXXBoolLiteralExpr
+// CHECK-NEXT: ReturnStmt
+// CHECK-NEXT: <<NULL>>
+
+// CHECK: IfStmt
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: CXXBoolLiteralExpr
+// CHECK-NEXT: ReturnStmt
+// CHECK-NEXT: ReturnStmt
+
+// CHECK: IfStmt
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: CXXBoolLiteralExpr
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: ReturnStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: ReturnStmt
+
+void expr() {
+ f();
+}
Index: test/Import/if-stmt/Inputs/F.cpp
===================================================================
--- /dev/null
+++ test/Import/if-stmt/Inputs/F.cpp
@@ -0,0 +1,21 @@
+void f() {
+ if (true)
+ return;
+
+ if (int j = 3)
+ return;
+
+ if (int j; true)
+ return;
+
+ if (true)
+ return;
+ else
+ return;
+
+ if (true) {
+ return;
+ } else {
+ return;
+ }
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50796.160876.patch
Type: text/x-patch
Size: 1666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180815/f9e91e67/attachment.bin>
More information about the cfe-commits
mailing list