[cfe-commits] r163824 - in /cfe/trunk/lib/Sema: SemaDeclObjC.cpp SemaType.cpp

John McCall rjmccall at apple.com
Thu Sep 13 13:22:20 PDT 2012


On Sep 13, 2012, at 11:53 AM, Fariborz Jahanian wrote:
> Author: fjahanian
> Date: Thu Sep 13 13:53:14 2012
> New Revision: 163824
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=163824&view=rev
> Log:
> Move back the stuff about missing ownership attribute warning
> to SemaDeclObjC and apply some simplification per John's
> comment. // rdar://12280826
> 
> Modified:
>    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>    cfe/trunk/lib/Sema/SemaType.cpp
> 
> Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=163824&r1=163823&r2=163824&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Thu Sep 13 13:53:14 2012
> @@ -282,6 +282,28 @@
>     AddFactoryMethodToGlobalPool(MDecl, true);
> }
> 
> +/// HasExplicitOwnershipAttr - returns true when pointer to ObjC pointer
> +/// has explicit ownership attribute; false otherwise.
> +static bool
> +HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param) {
> +  QualType T = Param->getType();
> +  
> +  if (!T->isPointerType() && !T->isReferenceType())
> +    return true;

This is now redundant with the code following it:

> +  
> +  if (const PointerType *PT = T->getAs<PointerType>()) {
> +    T = PT->getPointeeType();
> +  } else if (const ReferenceType *RT = T->getAs<ReferenceType>()) {
> +    T = RT->getPointeeType();
> +  } else {
> +    return true;
> +  }

John.




More information about the cfe-commits mailing list