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 | 575a1c9dc8dc5b4977194993e289f9eda7295c39 (patch) | |
tree | 0c66c4e1cf78a06c917e05557458f05fcf025a99 /lib/CodeGen/CGExprCXX.cpp | |
parent | f752d5bbaee7485b484f5e6aa69e50748e02dda8 (diff) |
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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 1d668477c1..81fee677f6 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/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(); |