diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-05-24 18:32:56 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-05-24 18:32:56 +0000 |
commit | a5a7987394ca15334c03b7e168677a8056561062 (patch) | |
tree | 195212b32156b867cdd7e3fd7682fd9c060fcd5f /test | |
parent | 73d1eb064350d5310f0475366cbe54d2d1da27bb (diff) |
Fix a rewriting bug where a local static objective-c
pointer is copied into a block. Fixes radar 7924024.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Rewriter/rewrite-local-static-id.mm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Rewriter/rewrite-local-static-id.mm b/test/Rewriter/rewrite-local-static-id.mm new file mode 100644 index 0000000000..a0b85f4f4d --- /dev/null +++ b/test/Rewriter/rewrite-local-static-id.mm @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp +// RUN: %clang_cc1 -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o %t %t-rw.cpp +// radar 7946975 + +void *sel_registerName(const char *); + +@interface foo +@end + +@interface foo2 : foo ++ (id)x; +@end + +typedef void (^b_t)(void); + +void bar(b_t block); + +void f() { + static id foo = 0; + bar(^{ + foo = [foo2 x]; + }); +} + |