[cfe-commits] r39646 - /cfe/cfe/trunk/CodeGen/CGExpr.cpp
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:46:37 PDT 2007
Author: clattner
Date: Wed Jul 11 11:46:36 2007
New Revision: 39646
URL: http://llvm.org/viewvc/llvm-project?rev=39646&view=rev
Log:
Emit codegen of enum literals.
Modified:
cfe/cfe/trunk/CodeGen/CGExpr.cpp
Modified: cfe/cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CGExpr.cpp?rev=39646&r1=39645&r2=39646&view=diff
==============================================================================
--- cfe/cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CGExpr.cpp Wed Jul 11 11:46:36 2007
@@ -338,7 +338,12 @@
// l-values.
case Expr::DeclRefExprClass:
- // FIXME: EnumConstantDecl's are not lvalues. This is wrong for them.
+ // DeclRef's of EnumConstantDecl's are simple rvalues.
+ if (const EnumConstantDecl *EC =
+ dyn_cast<EnumConstantDecl>(cast<DeclRefExpr>(E)->getDecl()))
+ return RValue::get(ConstantInt::get(EC->getInitVal()));
+
+ // FALLTHROUGH
case Expr::ArraySubscriptExprClass:
return EmitLoadOfLValue(E);
case Expr::StringLiteralClass:
More information about the cfe-commits
mailing list