diff options
author | Anders Carlsson <andersca@mac.com> | 2008-01-29 01:28:48 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2008-01-29 01:28:48 +0000 |
commit | a3881fc62ac1ddbf9c236fffd47b637fb4745bbd (patch) | |
tree | eb454448b4ec35f5619354923bf9675be94e0006 /CodeGen/CGExprConstant.cpp | |
parent | f6884ac7cfc4c5562c0678ad65b3460a38f56e23 (diff) |
Correctly handle constants that refer to enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CGExprConstant.cpp')
-rw-r--r-- | CodeGen/CGExprConstant.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/CodeGen/CGExprConstant.cpp b/CodeGen/CGExprConstant.cpp index da2fef66f0..faf2096d28 100644 --- a/CodeGen/CGExprConstant.cpp +++ b/CodeGen/CGExprConstant.cpp @@ -186,6 +186,8 @@ public: const ValueDecl *Decl = E->getDecl(); if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Decl)) return CGM.GetAddrOfFunctionDecl(FD, false); + if (const EnumConstantDecl *EC = dyn_cast<EnumConstantDecl>(Decl)) + return llvm::ConstantInt::get(EC->getInitVal()); assert(0 && "Unsupported decl ref type!"); return 0; } |