diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-05-20 16:38:50 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-05-20 16:38:50 +0000 |
commit | 6ab2fa8f78f4c76da056580ec3ee1780eab08c76 (patch) | |
tree | b174ce5a814cd52cca8718ca8e7867f84f3abf15 /clang/lib/CodeGen/CGExprCXX.cpp | |
parent | 24b31b6b7d082cbbeb81b1d4106f3fdd4e349d1d (diff) | |
download | bcm5719-llvm-6ab2fa8f78f4c76da056580ec3ee1780eab08c76.tar.gz bcm5719-llvm-6ab2fa8f78f4c76da056580ec3ee1780eab08c76.zip |
Introduce Type::isSignedIntegerOrEnumerationType() and
Type::isUnsignedIntegerOrEnumerationType(), which are like
Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also
consider the underlying type of a C++0x scoped enumeration type.
Audited all callers to the existing functions, switching those that
need to also handle scoped enumeration types (e.g., those that deal
with constant values) over to the new functions. Fixes PR9923 /
<rdar://problem/9447851>.
llvm-svn: 131735
Diffstat (limited to 'clang/lib/CodeGen/CGExprCXX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprCXX.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 1d668477c1b..81fee677f61 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -489,7 +489,8 @@ static llvm::Value *EmitCXXNewAllocSize(CodeGenFunction &CGF, // size_t. That's just a gloss, though, and it's wrong in one // important way: if the count is negative, it's an error even if // the cookie size would bring the total size >= 0. - bool isSigned = e->getArraySize()->getType()->isSignedIntegerType(); + bool isSigned + = e->getArraySize()->getType()->isSignedIntegerOrEnumerationType(); const llvm::IntegerType *numElementsType = cast<llvm::IntegerType>(numElements->getType()); unsigned numElementsWidth = numElementsType->getBitWidth(); |