diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-10-08 23:50:27 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-10-08 23:50:27 +0000 |
| commit | 0bf3140424a0a13a928a4e6bf0f112e6167a5636 (patch) | |
| tree | aef7f4fa057fc4672999ce4ec62b01064035c242 /clang/lib/CodeGen/CGExpr.cpp | |
| parent | 959fcc6c634cb4d4fd8bd8c8b4bc3e6b99ebc228 (diff) | |
| download | bcm5719-llvm-0bf3140424a0a13a928a4e6bf0f112e6167a5636.tar.gz bcm5719-llvm-0bf3140424a0a13a928a4e6bf0f112e6167a5636.zip | |
Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a
bit by me).
llvm-svn: 116122
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 78c1da5060c..e4ed5d64d90 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -599,11 +599,17 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(llvm::Value *Addr, bool Volatile, return V; } +static bool isBooleanUnderlyingType(QualType Ty) { + if (const EnumType *ET = dyn_cast<EnumType>(Ty)) + return ET->getDecl()->getIntegerType()->isBooleanType(); + return false; +} + void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, llvm::Value *Addr, bool Volatile, unsigned Alignment, QualType Ty) { - if (Ty->isBooleanType()) { + if (Ty->isBooleanType() || isBooleanUnderlyingType(Ty)) { // Bool can have different representation in memory than in registers. const llvm::PointerType *DstPtr = cast<llvm::PointerType>(Addr->getType()); Value = Builder.CreateIntCast(Value, DstPtr->getElementType(), false); |

