summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/PCH/blocks.c12
-rw-r--r--clang/test/PCH/blocks.h14
-rw-r--r--clang/test/PCH/stmts.c6
3 files changed, 29 insertions, 3 deletions
diff --git a/clang/test/PCH/blocks.c b/clang/test/PCH/blocks.c
new file mode 100644
index 00000000000..0e5065cceed
--- /dev/null
+++ b/clang/test/PCH/blocks.c
@@ -0,0 +1,12 @@
+// Test this without pch.
+// RUN: clang-cc -fblocks -include %S/blocks.h -fsyntax-only -ast-print -o - %s
+
+// Test with pch.
+// RUN: clang-cc -emit-pch -fblocks -o %t %S/blocks.h &&
+// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -ast-print -o - %s
+
+int do_add(int x, int y) { return add(x, y); }
+
+int do_scaled_add(int a, int b, int s) {
+ return scaled_add(a, b, s);
+}
diff --git a/clang/test/PCH/blocks.h b/clang/test/PCH/blocks.h
new file mode 100644
index 00000000000..af7bb6fc657
--- /dev/null
+++ b/clang/test/PCH/blocks.h
@@ -0,0 +1,14 @@
+// Header for PCH test blocks.c
+
+int call_block(int (^bl)(int x, int y), int a, int b) {
+ return bl(a, b);
+}
+
+int add(int a, int b) {
+ return call_block(^(int x, int y) { return x + y; }, a, b);
+}
+
+int scaled_add(int a, int b, int s) {
+ __block int scale = s;
+ return call_block(^(int x, int y) { return x*scale + y; }, a, b);
+}
diff --git a/clang/test/PCH/stmts.c b/clang/test/PCH/stmts.c
index c8fbc83a0fa..f376a1dd37f 100644
--- a/clang/test/PCH/stmts.c
+++ b/clang/test/PCH/stmts.c
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: clang-cc -fblocks -include %S/stmts.h -fsyntax-only -ast-print -o - %s
+// RUN: clang-cc -include %S/stmts.h -fsyntax-only -ast-print -o - %s
// Test with pch.
-// RUN: clang-cc -emit-pch -fblocks -o %t %S/stmts.h &&
-// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -ast-print -o - %s
+// RUN: clang-cc -emit-pch -o %t %S/stmts.h &&
+// RUN: clang-cc -include-pch %t -fsyntax-only -ast-print -o - %s
void g0(void) { f0(5); }
int g1(int x) { return f1(x); }
OpenPOWER on IntegriCloud