aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/FormatString.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/FormatString.cpp')
-rw-r--r--lib/Analysis/FormatString.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Analysis/FormatString.cpp b/lib/Analysis/FormatString.cpp
index 6498ded4e3..0853164df7 100644
--- a/lib/Analysis/FormatString.cpp
+++ b/lib/Analysis/FormatString.cpp
@@ -228,6 +228,7 @@ bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const {
return false;
}
+ case TypedefTy:
case SpecificTy: {
argTy = C.getCanonicalType(argTy).getUnqualifiedType();
if (T == argTy)
@@ -331,6 +332,7 @@ QualType ArgTypeResult::getRepresentativeType(ASTContext &C) const {
case AnyCharTy:
return C.CharTy;
case SpecificTy:
+ case TypedefTy:
return T;
case CStrTy:
return C.getPointerType(C.CharTy);
@@ -351,6 +353,13 @@ QualType ArgTypeResult::getRepresentativeType(ASTContext &C) const {
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 @@ bool FormatSpecifier::hasValidLengthModifier() const {
}
return false;
}
-
-