Revert r135147 and r135075. The consensus was that this wasn't the right thing to do.

llvm-svn: 135152
This commit is contained in:
Ted Kremenek
2011-07-14 17:05:32 +00:00
parent 17cf05b953
commit d0c2afd2c3
4 changed files with 16 additions and 33 deletions

View File

@@ -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;
}