зеркало из https://github.com/microsoft/clang-1.git
Define __weak attribute for objective-c pointers in
win32 targets. Fixes radar 7530235. Daniel please review. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93246 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d9b600c1a5
Коммит
453c1349a5
|
@ -994,6 +994,10 @@ public:
|
|||
DefineStd(Builder, "WIN32", Opts);
|
||||
DefineStd(Builder, "WINNT", Opts);
|
||||
Builder.defineMacro("_X86_");
|
||||
if (Opts.ObjC1)
|
||||
// __weak is always defined, for use in blocks and with objc pointers,
|
||||
// even for i686-pc-win32 targets.
|
||||
Builder.defineMacro("__weak", "__attribute__((objc_gc(weak)))");
|
||||
}
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -fblocks -Dnil=0 -rewrite-objc -o - %s
|
||||
int main() {
|
||||
__weak __block id foo = nil;
|
||||
__block id foo2 = nil;
|
||||
id foo3 = nil;
|
||||
|
||||
void (^myblock)() = ^{
|
||||
foo = nil;
|
||||
foo2 = nil;
|
||||
[foo3 bar];
|
||||
id foo4 = foo3;
|
||||
};
|
||||
}
|
Загрузка…
Ссылка в новой задаче