r339827 - [ASTImporter] Add test for IfStmt
Raphael Isemann via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 15 15:36:58 PDT 2018
Author: teemperor
Date: Wed Aug 15 15:36:58 2018
New Revision: 339827
URL: http://llvm.org/viewvc/llvm-project?rev=339827&view=rev
Log:
[ASTImporter] Add test for IfStmt
Reviewers: a.sidorin, hiraditya
Reviewed By: hiraditya
Subscribers: hiraditya, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D50796
Added:
cfe/trunk/test/Import/if-stmt/
cfe/trunk/test/Import/if-stmt/Inputs/
cfe/trunk/test/Import/if-stmt/Inputs/F.cpp
cfe/trunk/test/Import/if-stmt/test.cpp
Added: cfe/trunk/test/Import/if-stmt/Inputs/F.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/if-stmt/Inputs/F.cpp?rev=339827&view=auto
==============================================================================
--- cfe/trunk/test/Import/if-stmt/Inputs/F.cpp (added)
+++ cfe/trunk/test/Import/if-stmt/Inputs/F.cpp Wed Aug 15 15:36:58 2018
@@ -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;
+ }
+}
Added: cfe/trunk/test/Import/if-stmt/test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/if-stmt/test.cpp?rev=339827&view=auto
==============================================================================
--- cfe/trunk/test/Import/if-stmt/test.cpp (added)
+++ cfe/trunk/test/Import/if-stmt/test.cpp Wed Aug 15 15:36:58 2018
@@ -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();
+}
More information about the cfe-commits
mailing list