summaryrefslogtreecommitdiffstats
path: root/clang/test/Rewriter/rewrite-function-decl.mm
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-01-14 00:35:56 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-01-14 00:35:56 +0000
commite2dd5428e6ea76a83a009177a1be4334cedd70e6 (patch)
tree0821c14fd11460e663f009b8b137cea4d5b9bef2 /clang/test/Rewriter/rewrite-function-decl.mm
parente355daf7b03bfb68b1857c9e0642230cd3a9490e (diff)
downloadbcm5719-llvm-e2dd5428e6ea76a83a009177a1be4334cedd70e6.tar.gz
bcm5719-llvm-e2dd5428e6ea76a83a009177a1be4334cedd70e6.zip
Fix a bug in rewrite whereby functions using blocks put extern "C" in wrong place.
Fixes radar 7284618. llvm-svn: 93382
Diffstat (limited to 'clang/test/Rewriter/rewrite-function-decl.mm')
-rw-r--r--clang/test/Rewriter/rewrite-function-decl.mm31
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Rewriter/rewrite-function-decl.mm b/clang/test/Rewriter/rewrite-function-decl.mm
new file mode 100644
index 00000000000..023e55db4bb
--- /dev/null
+++ b/clang/test/Rewriter/rewrite-function-decl.mm
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fms-extensions -rewrite-objc -x objective-c++ -fblocks -o - %s
+
+extern "C" __declspec(dllexport) void BreakTheRewriter(void) {
+ __block int aBlockVariable = 0;
+ void (^aBlock)(void) = ^ {
+ aBlockVariable = 42;
+ };
+ aBlockVariable++;
+ void (^bBlocks)(void) = ^ {
+ aBlockVariable = 43;
+ };
+ void (^c)(void) = ^ {
+ aBlockVariable = 44;
+ };
+
+}
+__declspec(dllexport) extern "C" void AnotherBreakTheRewriter(int *p1, double d) {
+
+ __block int bBlockVariable = 0;
+ void (^aBlock)(void) = ^ {
+ bBlockVariable = 42;
+ };
+ bBlockVariable++;
+ void (^bBlocks)(void) = ^ {
+ bBlockVariable = 43;
+ };
+ void (^c)(void) = ^ {
+ bBlockVariable = 44;
+ };
+
+}
OpenPOWER on IntegriCloud