]> granicus.if.org Git - clang/commitdiff
Make r145697 actually work.
authorHans Wennborg <hans@hanshq.net>
Fri, 2 Dec 2011 20:32:01 +0000 (20:32 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 2 Dec 2011 20:32:01 +0000 (20:32 +0000)
Use the canonical type of the typedef to compare with the underlying type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145702 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/PrintfFormatString.cpp
test/Sema/format-strings-int-typedefs.c

index b37b23f3b184490e640034a4615a29fb9ffac72e..e3d76507cd9ce4835517e61917095eaebe70e591 100644 (file)
@@ -290,7 +290,7 @@ static QualType FindTypedef(Sema &S, const char *Name, QualType Underlying) {
 
   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;
   }
 
index 931449ccc39c43151d676cbef83c4b43663c564e..2cac9a875d1cc5ee19ad92fac8a233f2df10d511 100644 (file)
@@ -10,7 +10,7 @@ void test(void) {
   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;