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
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
--- /dev/null
+// 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;
+ };
+}