Emit codegen of enum literals.

llvm-svn: 39646
This commit is contained in:
Chris Lattner 2007-06-11 03:52:52 +00:00
parent 9fba02845b
commit f99b3f5ec2
1 changed files with 6 additions and 1 deletions

View File

@ -338,7 +338,12 @@ RValue CodeGenFunction::EmitExpr(const Expr *E) {
// 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: