summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp2
-rw-r--r--clang/test/SemaObjC/gc-attributes.m4
2 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index c82e8974185..30bf118bc29 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -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)))");
diff --git a/clang/test/SemaObjC/gc-attributes.m b/clang/test/SemaObjC/gc-attributes.m
index 2f5432842e7..1023ba6eec3 100644
--- a/clang/test/SemaObjC/gc-attributes.m
+++ b/clang/test/SemaObjC/gc-attributes.m
@@ -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) {}
OpenPOWER on IntegriCloud