diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-01-14 23:05:52 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-01-14 23:05:52 +0000 |
commit | a73165e47aefbea60312d284343660c9c962c9c3 (patch) | |
tree | b72fbea03a8063cf53264dbc4dc5d3b1a76cd0bd /test/Rewriter | |
parent | aa97d7051ed3517c7b64787bcb65ae04e1a52594 (diff) | |
download | clang-a73165e47aefbea60312d284343660c9c962c9c3.tar.gz |
Patch to avoid duplicate declaration of byref structs
for __block variables of same name declared in multiple scopes.
Fixes radar 7540194
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Rewriter')
-rw-r--r-- | test/Rewriter/rewrite-byref-vars.mm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/Rewriter/rewrite-byref-vars.mm b/test/Rewriter/rewrite-byref-vars.mm new file mode 100644 index 0000000000..581437b5a5 --- /dev/null +++ b/test/Rewriter/rewrite-byref-vars.mm @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -fms-extensions -rewrite-objc -x objective-c++ -fblocks -o - %s +// radar 7540194 + +extern "C" __declspec(dllexport) void BreakTheRewriter(int i) { + __block int aBlockVariable = 0; + void (^aBlock)(void) = ^ { + aBlockVariable = 42; + }; + aBlockVariable++; + if (i) { + __block int bbBlockVariable = 0; + void (^aBlock)(void) = ^ { + bbBlockVariable = 42; + }; + } +} + +__declspec(dllexport) extern "C" __declspec(dllexport) void XXXXBreakTheRewriter(void) { + + __block int aBlockVariable = 0; + void (^aBlock)(void) = ^ { + aBlockVariable = 42; + }; + aBlockVariable++; + void (^bBlocks)(void) = ^ { + aBlockVariable = 43; + }; + void (^c)(void) = ^ { + aBlockVariable = 44; + }; + +} + +// $CLANG -cc1 -fms-extensions -rewrite-objc -x objective-c++ -fblocks bug.mm +// g++ -c -D"__declspec(X)=" bug.cpp |