aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/FormatString.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-07-14 17:05:32 +0000
committerTed Kremenek <kremenek@apple.com>2011-07-14 17:05:32 +0000
commit1ad35bebcc07d34202850f46b5b7be46fda1c5d1 (patch)
tree9085996799b63ee3587a22d677de0cda310cf456 /lib/Analysis/FormatString.cpp
parent9f79a1f89695a79d5e29a72c28ffb59823b31cef (diff)
Revert r135147 and r135075. The consensus was that this wasn't the right thing to do.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135152 91177308-0d34-0410-b5e6-96231b3b80d8
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;
}