aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBen Langmuir <ben.langmuir@intel.com>2013-05-03 19:20:19 +0000
committerBen Langmuir <ben.langmuir@intel.com>2013-05-03 19:20:19 +0000
commitdc5be4f54d6415cb88b2f8a7c5bc9011e332b9b8 (patch)
treec0601b4fba10524868f196d5ee845dec53db48f6 /test
parent0f2fc5ff49cb9abd6c6972ffd6db066295672867 (diff)
Serialization for captured statements
Add serialization for captured statements and captured decls. Also add a const_capture_iterator to CapturedStmt. Test contributed by Wei Pan Differential Revision: http://llvm-reviews.chandlerc.com/D727 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181048 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/PCH/captured-stmt.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/PCH/captured-stmt.cpp b/test/PCH/captured-stmt.cpp
new file mode 100644
index 0000000000..6f5ca3836e
--- /dev/null
+++ b/test/PCH/captured-stmt.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -x c++-header -emit-pch %s -o %t
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+
+#ifndef HEADER_INCLUDED
+#define HEADER_INCLUDED
+
+static inline void foo(int &x, int y) {
+ // Capturing x and y
+ #pragma clang __debug captured
+ {
+ x += y;
+ }
+}
+
+struct C {
+ int val;
+
+ explicit C(int v) : val(v) { }
+
+ void bar(int &x) {
+ // Capturing x and this
+ #pragma clang __debug captured
+ {
+ x += val;
+ }
+ }
+};
+
+#else
+
+void test_foo(int &x) {
+ foo(x, 10);
+}
+
+void test_bar(int &x) {
+ C Obj(10);
+ Obj.bar(x);
+}
+
+#endif