[cfe-commits] r145702 - in /cfe/trunk: lib/Analysis/PrintfFormatString.cpp test/Sema/format-strings-int-typedefs.c

Douglas Gregor dgregor at apple.com
Fri Dec 2 14:02:08 PST 2011


On Dec 2, 2011, at 12:32 PM, Hans Wennborg wrote:

> Author: hans
> Date: Fri Dec  2 14:32:01 2011
> New Revision: 145702
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=145702&view=rev
> Log:
> Make r145697 actually work.
> 
> Use the canonical type of the typedef to compare with the underlying type.
> 
> Modified:
>    cfe/trunk/lib/Analysis/PrintfFormatString.cpp
>    cfe/trunk/test/Sema/format-strings-int-typedefs.c
> 
> Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=145702&r1=145701&r2=145702&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
> +++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Fri Dec  2 14:32:01 2011
> @@ -290,7 +290,7 @@
> 
>   if (TypedefDecl *TD = dyn_cast_or_null<TypedefDecl>(D)) {
>     QualType TypedefType = Ctx.getTypedefType(TD, QualType());
> -    if (TD->getUnderlyingType() == Underlying)
> +    if (Ctx.getCanonicalType(TypedefType) == Underlying)
>       return TypedefType;
>   }

Ctx.isSameType() is a great way to get this right.

	- Doug



More information about the cfe-commits mailing list