[cfe-commits] r41499 - /cfe/trunk/Sema/SemaDecl.cpp
Chris Lattner
sabre at nondot.org
Mon Aug 27 10:37:25 PDT 2007
Author: lattner
Date: Mon Aug 27 12:37:24 2007
New Revision: 41499
URL: http://llvm.org/viewvc/llvm-project?rev=41499&view=rev
Log:
better error recovery for non-i-c-e enum constants.
Modified:
cfe/trunk/Sema/SemaDecl.cpp
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=41499&r1=41498&r2=41499&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Mon Aug 27 12:37:24 2007
@@ -942,19 +942,23 @@
Diag(ExpLoc, diag::err_enum_value_not_integer_constant_expr,
Id->getName());
// FIXME: Don't leak memory: delete Val;
- return 0;
+ Val = 0; // Just forget about it.
}
EltTy = Val->getType();
- } else if (LastEnumConst) {
- // Assign the last value + 1.
- EnumVal = LastEnumConst->getInitVal();
- ++EnumVal;
- // FIXME: detect overflow!
- EltTy = LastEnumConst->getType();
- } else {
- // First value, set to zero.
- EltTy = Context.IntTy;
- // FIXME: Resize EnumVal to the size of int.
+ }
+
+ if (!Val) {
+ if (LastEnumConst) {
+ // Assign the last value + 1.
+ EnumVal = LastEnumConst->getInitVal();
+ ++EnumVal;
+ // FIXME: detect overflow!
+ EltTy = LastEnumConst->getType();
+ } else {
+ // First value, set to zero.
+ EltTy = Context.IntTy;
+ // FIXME: Resize EnumVal to the size of int.
+ }
}
// TODO: Default promotions to int/uint.
More information about the cfe-commits
mailing list