Revert "Properly consider the range of enum for range comparisons in C mode"

The approach r183084 took was wrong, back it out.

llvm-svn: 183575
This commit is contained in:
David Majnemer 2013-06-07 22:07:20 +00:00
parent 9b08a0df1c
commit 6a42665f9f
2 changed files with 11 additions and 22 deletions

View File

@ -4020,9 +4020,8 @@ struct IntRange {
if (const ComplexType *CT = dyn_cast<ComplexType>(T))
T = CT->getElementType().getTypePtr();
if (const EnumType *ET = dyn_cast<EnumType>(T)) {
if (C.getLangOpts().CPlusPlus) {
// For enum types, use the known bit width of the enumerators.
if (const EnumType *ET = dyn_cast<EnumType>(T)) {
EnumDecl *Enum = ET->getDecl();
if (!Enum->isCompleteDefinition())
return IntRange(C.getIntWidth(QualType(T, 0)), false);
@ -4035,8 +4034,6 @@ struct IntRange {
else
return IntRange(std::max(NumPositive + 1, NumNegative),
false/*NonNegative*/);
} else
T = C.getCanonicalType(ET->getDecl()->getIntegerType().getTypePtr());
}
const BuiltinType *BT = cast<BuiltinType>(T);

View File

@ -147,11 +147,3 @@ int main()
return 1;
}
typedef enum {
alpha=0, bravo, charlie, delta, echo
} named_t;
static int bar(named_t foo) {
return foo > 42;
}