[PATCH] D51001: [ASTImporter] Add test for CXXForRangeStmt
Raphael Isemann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 20 15:06:18 PDT 2018
teemperor created this revision.
Herald added subscribers: cfe-commits, martong.
Herald added a reviewer: a.sidorin.
Repository:
rC Clang
https://reviews.llvm.org/D51001
Files:
test/Import/cxx-for-range/Inputs/F.cpp
test/Import/cxx-for-range/test.cpp
Index: test/Import/cxx-for-range/test.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-for-range/test.cpp
@@ -0,0 +1,53 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s
+
+// CHECK: CXXForRangeStmt
+
+// CHECK-NEXT: DeclStmt
+// CHECK-NEXT: VarDecl
+// CHECK-NEXT: DeclRefExpr
+// CHECK-SAME: 'c'
+// CHECK-SAME: Container
+
+// CHECK-NEXT: DeclStmt
+// CHECK-NEXT: VarDecl
+// CHECK-NEXT: CXXMemberCallExpr
+// CHECK-SAME: 'int *'
+// CHECK-NEXT: MemberExpr
+// CHECK-SAME: .begin
+// CHECK-NEXT: DeclRefExpr
+// CHECK-SAME: '__range1'
+// CHECK-SAME: Container
+
+// CHECK-NEXT: DeclStmt
+// CHECK-NEXT: VarDecl
+// CHECK-NEXT: CXXMemberCallExpr
+// CHECK-SAME: 'int *'
+// CHECK-NEXT: MemberExpr
+// CHECK-SAME: .end
+// CHECK-NEXT: DeclRefExpr
+// CHECK-SAME: '__range1'
+// CHECK-SAME: Container
+
+// CHECK-NEXT: BinaryOperator
+// CHECK-SAME: '!='
+// CHECK-NEXT: ImplicitCastExpr
+// CHECK-NEXT: DeclRefExpr
+// CHECK-SAME: '__begin1'
+// CHECK-NEXT: ImplicitCastExpr
+// CHECK-NEXT: DeclRefExpr
+// CHECK-SAME: '__end1'
+
+// CHECK-NEXT: UnaryOperator
+// CHECK-SAME: '++'
+// CHECK-NEXT: DeclRefExpr
+// CHECK-SAME: '__begin1'
+
+// CHECK-NEXT: DeclStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: varname
+
+// CHECK: ReturnStmt
+
+void expr() {
+ f();
+}
Index: test/Import/cxx-for-range/Inputs/F.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-for-range/Inputs/F.cpp
@@ -0,0 +1,11 @@
+struct Container {
+ int *begin();
+ int *end();
+};
+
+void f() {
+ Container c;
+ for (int varname : c) {
+ return;
+ }
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51001.161576.patch
Type: text/x-patch
Size: 1688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180820/dd246a61/attachment.bin>
More information about the cfe-commits
mailing list