]> granicus.if.org Git - clang/commitdiff
Define __unsafe_unretained and __autoreleasing in ObjC GC mode.
authorJohn McCall <rjmccall@apple.com>
Tue, 10 Nov 2015 23:00:25 +0000 (23:00 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 10 Nov 2015 23:00:25 +0000 (23:00 +0000)
This was an accidental regression from the MRC __weak patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252668 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/SemaObjC/gc-attributes.m

index c82e89741855891842c69be84cc824bd58474613..30bf118bc2940af186dcbd1dbcaf58d273d3a48c 100644 (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)))");
index 2f5432842e74e4f38a2cac66ea6f3154fac8d5b0..1023ba6eec3739ee9456951eefbfbffa9c51f2e5 100644 (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) {}