r360225 - Fix for the greendragon bots.

Leonard Chan via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 22:59:25 PDT 2019


Author: leonardchan
Date: Tue May  7 22:59:25 2019
New Revision: 360225

URL: http://llvm.org/viewvc/llvm-project?rev=360225&view=rev
Log:
Fix for the greendragon bots.

Adds extra checks for ObjC GC and Ownership.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/SemaObjC/mrc-weak.m

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=360225&r1=360224&r2=360225&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Tue May  7 22:59:25 2019
@@ -7612,7 +7612,9 @@ static void processTypeAttrs(TypeProcess
     // 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(

Modified: cfe/trunk/test/SemaObjC/mrc-weak.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/mrc-weak.m?rev=360225&r1=360224&r2=360225&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/mrc-weak.m (original)
+++ cfe/trunk/test/SemaObjC/mrc-weak.m Tue May  7 22:59:25 2019
@@ -62,6 +62,6 @@ void test_unsafe_unretained_cast(id *val
 
 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}}
 }
 




More information about the cfe-commits mailing list