Make printf warnings refer to intmax_t et al. by name
in addition to underlying type.

For example, the warning for printf("%zu", 42.0);
changes from "conversion specifies type 'unsigned long'" to "conversion
specifies type 'size_t' (aka 'unsigned long')"

(This is a second attempt after r145697, which got reverted.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146032 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/FormatString.cpp b/lib/Analysis/FormatString.cpp
index 6498ded..0853164 100644
--- a/lib/Analysis/FormatString.cpp
+++ b/lib/Analysis/FormatString.cpp
@@ -228,6 +228,7 @@
       return false;
     }
       
+    case TypedefTy:
     case SpecificTy: {
       argTy = C.getCanonicalType(argTy).getUnqualifiedType();
       if (T == argTy)
@@ -331,6 +332,7 @@
     case AnyCharTy:
       return C.CharTy;
     case SpecificTy:
+    case TypedefTy:
       return T;
     case CStrTy:
       return C.getPointerType(C.CharTy);
@@ -351,6 +353,13 @@
   return QualType();
 }
 
+std::string ArgTypeResult::getRepresentativeTypeName(ASTContext &C) const {
+  if (K != TypedefTy)
+    return std::string("'") + getRepresentativeType(C).getAsString() + "'";
+  return std::string("'") + Name + "' (aka '" + T.getAsString() + "')";
+}
+
+
 //===----------------------------------------------------------------------===//
 // Methods on OptionalAmount.
 //===----------------------------------------------------------------------===//
@@ -485,5 +494,3 @@
   }
   return false;
 }
-
-