diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-11-24 16:57:33 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-11-24 16:57:33 +0000 |
| commit | c102297fb2857ef1af191a8e85e842cc3ac3239e (patch) | |
| tree | 32ead98cff95e863fb802a872999cea72c8305b8 /lib/CodeGen/CGExprScalar.cpp | |
| parent | a244dc3a554f6bf82416697e34f9e96dc1efbb88 (diff) | |
| download | clang-c102297fb2857ef1af191a8e85e842cc3ac3239e.tar.gz clang-c102297fb2857ef1af191a8e85e842cc3ac3239e.tar.bz2 clang-c102297fb2857ef1af191a8e85e842cc3ac3239e.tar.xz | |
We always need to emit the base expression of a member expression, even when the member decl refers to an enum. Thanks to Eli for pointing this out!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89775 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 84adc5fdcf..8bb02f9668 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -169,9 +169,16 @@ public: Value *VisitShuffleVectorExpr(ShuffleVectorExpr *E); Value *VisitMemberExpr(MemberExpr *E) { if (const EnumConstantDecl *EC = - dyn_cast<EnumConstantDecl>(E->getMemberDecl())) + dyn_cast<EnumConstantDecl>(E->getMemberDecl())) { + + // We still need to emit the base. + if (E->isArrow()) + CGF.EmitScalarExpr(E->getBase()); + else + CGF.EmitLValue(E->getBase()); return llvm::ConstantInt::get(VMContext, EC->getInitVal()); - + } + return EmitLoadOfLValue(E); } |
