diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-23 16:10:32 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-23 16:10:32 +0000 |
commit | 715e9c8a39437347e838aa108df443fe1086d359 (patch) | |
tree | a5236afdb0b40417eb94c714a3e42b376b400465 /lib/AST/ASTContext.cpp | |
parent | fa037bd3f79d3c70197a3224bb1b29c6c4af0098 (diff) |
Even though we don't unique VLA types, we still need to build a
canonical type where the element type is canonical. Fixes PR7206.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 720a88c6b6..801a1f6391 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1356,9 +1356,17 @@ QualType ASTContext::getVariableArrayType(QualType EltTy, SourceRange Brackets) { // Since we don't unique expressions, it isn't possible to unique VLA's // that have an expression provided for their size. - + QualType CanonType; + + if (!EltTy.isCanonical()) { + if (NumElts) + NumElts->Retain(); + CanonType = getVariableArrayType(getCanonicalType(EltTy), NumElts, ASM, + EltTypeQuals, Brackets); + } + VariableArrayType *New = new(*this, TypeAlignment) - VariableArrayType(EltTy, QualType(), NumElts, ASM, EltTypeQuals, Brackets); + VariableArrayType(EltTy, CanonType, NumElts, ASM, EltTypeQuals, Brackets); VariableArrayTypes.push_back(New); Types.push_back(New); |