On Sep 13, 2012, at 10:31 AM, jahanian wrote: > On Sep 12, 2012, at 5:02 PM, John McCall wrote: >> On Sep 12, 2012, at 1:34 PM, Fariborz Jahanian wrote: >>> Author: fjahanian >>> Date: Wed Sep 12 15:34:47 2012 >>> New Revision: 163738 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=163738&view=rev >>> Log: >>> objective-C arc: don't issue no explicit ownership warning when >>> __autoreleasing is explicitely added to param type. >>> // rdar://12280826 >>> >>> Modified: >>> cfe/trunk/lib/Sema/SemaDeclObjC.cpp >>> cfe/trunk/test/SemaObjC/arc-objc-lifetime.m >>> >>> Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=163738&r1=163737&r2=163738&view=diff >>> ============================================================================== >>> --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original) >>> +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Sep 12 15:34:47 2012 >>> @@ -282,11 +282,10 @@ >>> AddFactoryMethodToGlobalPool(MDecl, true); >>> } >>> >>> -/// StrongPointerToObjCPointer - returns true when pointer to ObjC pointer >>> -/// is __strong, or when it is any other type. It returns false when >>> -/// pointer to ObjC pointer is not __strong. >>> +/// HasExplicitOwnershipAttr - returns true when pointer to ObjC pointer >>> +/// has explicit ownership attribute; false otherwise. >>> static bool >>> -StrongPointerToObjCPointer(Sema &S, ParmVarDecl *Param) { >>> +HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param) { >>> QualType T = Param->getType(); >>> if (!T->isObjCIndirectLifetimeType()) >>> return true; >>> @@ -296,8 +295,11 @@ >>> ? T->getAs<PointerType>()->getPointeeType() >>> : T->getAs<ReferenceType>()->getPointeeType(); >>> if (T->isObjCLifetimeType()) { >>> - Qualifiers::ObjCLifetime lifetime = T.getObjCLifetime(); >>> - return lifetime == Qualifiers::OCL_Strong; >>> + // when lifetime is Qualifiers::OCL_None it means that it has >>> + // no implicit ownership qualifier (which means it is explicit). >>> + Qualifiers::ObjCLifetime lifetime = >>> + T.getLocalQualifiers().getObjCLifetime(); >>> + return lifetime == Qualifiers::OCL_None; >>> } >>> return true; >>> } >>> @@ -335,7 +337,7 @@ >>> Param->setInvalidDecl(); >>> if (!Param->isInvalidDecl() && >>> getLangOpts().ObjCAutoRefCount && >>> - !StrongPointerToObjCPointer(*this, Param)) >>> + !HasExplicitOwnershipAttr(*this, Param)) >>> Diag(Param->getLocation(), diag::warn_arc_strong_pointer_objc_pointer) >>> << >>> Param->getType(); >> >> Why is this code in SemaDeclObjC anyway? Shouldn't it be in the code in >> SemaType where we add the implicit ownership qualification? > > All right. This is done in r163813. It turned out to be more trouble than I > expected though.
Why didn't you do this as part of inferARCWriteback, where we're adding the qualifier in the first place? John. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
