[cfe-commits] r145702 - in /cfe/trunk: lib/Analysis/PrintfFormatString.cpp test/Sema/format-strings-int-typedefs.c
Hans Wennborg
hans at hanshq.net
Fri Dec 2 12:32:01 PST 2011
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;
}
Modified: cfe/trunk/test/Sema/format-strings-int-typedefs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings-int-typedefs.c?rev=145702&r1=145701&r2=145702&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings-int-typedefs.c (original)
+++ cfe/trunk/test/Sema/format-strings-int-typedefs.c Fri Dec 2 14:32:01 2011
@@ -10,7 +10,7 @@
printf("%zu", 42.0); // expected-warning {{conversion specifies type 'unsigned long'}}
printf("%td", 42.0); // expected-warning {{conversion specifies type 'int'}}
- typedef __SIZE_TYPE__ size_t;
+ typedef __typeof(sizeof(int)) size_t;
typedef __INTMAX_TYPE__ intmax_t;
typedef __UINTMAX_TYPE__ uintmax_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
More information about the cfe-commits
mailing list