Define __unsafe_unretained and __autoreleasing in ObjC GC mode.

This was an accidental regression from the MRC __weak patch.

llvm-svn: 252668
This commit is contained in:
John McCall 2015-11-10 23:00:25 +00:00
parent a3219a70be
commit 28ea04fc4c
2 changed files with 6 additions and 0 deletions

View File

@ -867,6 +867,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
LangOpts.getGC() != LangOptions::NonGC) {
Builder.defineMacro("__weak", "__attribute__((objc_gc(weak)))");
Builder.defineMacro("__strong", "__attribute__((objc_gc(strong)))");
Builder.defineMacro("__autoreleasing", "");
Builder.defineMacro("__unsafe_unretained", "");
} else if (LangOpts.ObjC1) {
Builder.defineMacro("__weak", "__attribute__((objc_ownership(weak)))");
Builder.defineMacro("__strong", "__attribute__((objc_ownership(strong)))");

View File

@ -20,3 +20,7 @@ void test_f1() {
f1(&a);
f1(&a2); // expected-warning{{passing 'A *__strong *' to parameter of type 'A *__weak *' discards qualifiers}}
}
// These qualifiers should silently expand to nothing in GC mode.
void test_unsafe_unretained(__unsafe_unretained id *x) {}
void test_autoreleasing(__autoreleasing id *x) {}