[cfe-commits] r65301 - /cfe/trunk/lib/Analysis/CFRefCount.cpp

Chris Lattner clattner at apple.com
Sun Feb 22 21:59:53 PST 2009


On Feb 22, 2009, at 6:31 PM, Ted Kremenek wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=65301&view=rev
> Log:
> '[NSAutoreleasePool addObject:]' has an 'autorelease' effect, not a  
> DoNothing effect.

Hi Ted,


>
> -    // [PR 3337] Use 'getDesugaredType' to strip away any typedefs  
> on the
> +    // [PR 3337]q Use 'getDesugaredType' to strip away any typedefs  
> on the
>     // function's type.
>     FunctionType* FT = cast<FunctionType>(FD->getType()- 
> >getDesugaredType());

Besides the excess q, you shouldn't use getDesugaredType for stuff  
like this.  Please use ->getAsFunctionType().  It will have the effect  
of desugaring where needed, and returns a pointer to the function type  
or null if the thing is not a function.

The reason for doing this is it is 1) more terse and 2) more standard  
across the sourcebase.  getDesugaredType should only be used for very  
specialized things.  ->isXXXType() and ->getAsXXXType() should be  
preferred instead.

-Chris




More information about the cfe-commits mailing list