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.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/Analysis/FormatString.cpp b/lib/Analysis/FormatString.cpp
index 144d62b67d..5f3cd4c615 100644
--- a/lib/Analysis/FormatString.cpp
+++ b/lib/Analysis/FormatString.cpp
@@ -206,10 +206,6 @@ clang::analyze_format_string::ParseLengthModifier(FormatSpecifier &FS,
// Methods on ArgTypeResult.
//===----------------------------------------------------------------------===//
-static bool hasSameSize(ASTContext &astContext, QualType typeA, QualType typeB) {
- return astContext.getTypeSize(typeA) == astContext.getTypeSize(typeB);
-}
-
bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const {
switch (K) {
case InvalidTy:
@@ -224,31 +220,33 @@ bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const {
if (T == argTy)
return true;
// Check for "compatible types".
- if (const BuiltinType *BT = argTy->getAs<BuiltinType>()) {
- if (!T->isIntegerType())
- return false;
+ if (const BuiltinType *BT = argTy->getAs<BuiltinType>())
switch (BT->getKind()) {
default:
break;
case BuiltinType::Char_S:
case BuiltinType::SChar:
+ return T == C.UnsignedCharTy;
case BuiltinType::Char_U:
- case BuiltinType::UChar:
- return hasSameSize(C, T, C.UnsignedCharTy);
+ case BuiltinType::UChar:
+ return T == C.SignedCharTy;
case BuiltinType::Short:
+ return T == C.UnsignedShortTy;
case BuiltinType::UShort:
- return hasSameSize(C, T, C.ShortTy);
+ return T == C.ShortTy;
case BuiltinType::Int:
+ return T == C.UnsignedIntTy;
case BuiltinType::UInt:
- return hasSameSize(C, T, C.IntTy);
+ return T == C.IntTy;
case BuiltinType::Long:
+ return T == C.UnsignedLongTy;
case BuiltinType::ULong:
- return hasSameSize(C, T, C.LongTy);
+ return T == C.LongTy;
case BuiltinType::LongLong:
+ return T == C.UnsignedLongLongTy;
case BuiltinType::ULongLong:
- return hasSameSize(C, T, C.LongLongTy);
+ return T == C.LongLongTy;
}
- }
return false;
}