summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-05-13 04:12:56 +0000
committerChris Lattner <sabre@nondot.org>2009-05-13 04:12:56 +0000
commite2df3f9fe5978dd0025247cf20ee4a20bb29fe75 (patch)
treefe3b19d617d1a2e3c23ca1e4346d23cd84254c44 /clang/lib/AST
parent851eb927d7e44b4f75d1f13a065ced7c19604ed3 (diff)
downloadbcm5719-llvm-e2df3f9fe5978dd0025247cf20ee4a20bb29fe75.tar.gz
bcm5719-llvm-e2df3f9fe5978dd0025247cf20ee4a20bb29fe75.zip
Fix rdar://6880874 - [sema] crash on array types with different index sizes
llvm-svn: 71634
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index ac46180b94d..ccd3762da05 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1133,9 +1133,14 @@ QualType ASTContext::getMemberPointerType(QualType T, const Type *Cls)
/// getConstantArrayType - Return the unique reference to the type for an
/// array of the specified element type.
QualType ASTContext::getConstantArrayType(QualType EltTy,
- const llvm::APInt &ArySize,
+ const llvm::APInt &ArySizeIn,
ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals) {
+ // Convert the array size into a canonical width matching the pointer size for
+ // the target.
+ llvm::APInt ArySize(ArySizeIn);
+ ArySize.zextOrTrunc(Target.getPointerWidth(EltTy.getAddressSpace()));
+
llvm::FoldingSetNodeID ID;
ConstantArrayType::Profile(ID, EltTy, ArySize, ASM, EltTypeQuals);
OpenPOWER on IntegriCloud