]> granicus.if.org Git - clang/commitdiff
[ASTImporter] Add test for ExprWithCleanups
authorRaphael Isemann <teemperor@gmail.com>
Wed, 15 Aug 2018 22:51:37 +0000 (22:51 +0000)
committerRaphael Isemann <teemperor@gmail.com>
Wed, 15 Aug 2018 22:51:37 +0000 (22:51 +0000)
Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

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

test/Import/expr-with-cleanups/Inputs/S.cpp [new file with mode: 0644]
test/Import/expr-with-cleanups/test.cpp [new file with mode: 0644]

diff --git a/test/Import/expr-with-cleanups/Inputs/S.cpp b/test/Import/expr-with-cleanups/Inputs/S.cpp
new file mode 100644 (file)
index 0000000..7b69f48
--- /dev/null
@@ -0,0 +1,8 @@
+struct RAII {
+  int i = 0;
+  RAII() { i++; }
+  ~RAII() { i--; }
+};
+void f() {
+  RAII();
+}
diff --git a/test/Import/expr-with-cleanups/test.cpp b/test/Import/expr-with-cleanups/test.cpp
new file mode 100644 (file)
index 0000000..79b76f4
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s
+// CHECK: ExprWithCleanups
+// CHECK-SAME: 'RAII'
+// CHECK-NEXT: CXXBindTemporaryExpr
+
+void expr() {
+  f();
+}