]> granicus.if.org Git - clang/commitdiff
Fix for the greendragon bots.
authorLeonard Chan <leonardchan@google.com>
Wed, 8 May 2019 05:59:25 +0000 (05:59 +0000)
committerLeonard Chan <leonardchan@google.com>
Wed, 8 May 2019 05:59:25 +0000 (05:59 +0000)
Adds extra checks for ObjC GC and Ownership.

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

lib/Sema/SemaType.cpp
test/SemaObjC/mrc-weak.m

index 17dbba921c4a220b6974d719947022297eeb16e9..4c7c13e9e2bbdefc5d7c8ed4b4eb01bbcfd0b436 100644 (file)
@@ -7612,7 +7612,9 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type,
     // applied to ObjC builtin attributes.
     if (isa<AttributedType>(type) && attr.hasMacroIdentifier() &&
         !type.getQualifiers().hasObjCLifetime() &&
-        !type.getQualifiers().hasObjCGCAttr()) {
+        !type.getQualifiers().hasObjCGCAttr() &&
+        attr.getKind() != ParsedAttr::AT_ObjCGC &&
+        attr.getKind() != ParsedAttr::AT_ObjCOwnership) {
       const IdentifierInfo *MacroII = attr.getMacroIdentifier();
       type = state.getSema().Context.getMacroQualifiedType(type, MacroII);
       state.setExpansionLocForMacroQualifiedType(
index af7081b53f82bd1315821e5532aa50af515d1ecc..e5f407c9d84da347832b7c24e5eed287e0e5cbdb 100644 (file)
@@ -62,6 +62,6 @@ void test_unsafe_unretained_cast(id *value) {
 
 void test_cast_qualifier_inference(__weak id *value) {
   __weak id *a = (id*) value;
-  __unsafe_unretained id *b = (id *)value; // expected-error {{initializing '__unsafe_unretained id *' with an expression of type '__weak id *' changes retain/release properties of pointer}}
+  __unsafe_unretained id *b = (id *)value; // expected-error {{initializing 'id *' with an expression of type '__weak id *' changes retain/release properties of pointer}}
 }