summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-23 16:10:32 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-23 16:10:32 +0000
commit5e8c8c0e12ac15d0c07e84eccdcc7c58acb9fdad (patch)
tree0918f8f1615357dd52222d4a3660ebc380553e81 /clang/lib/AST
parent49f40e8c32ca9e10fb4775b84544dd3f6edf1d48 (diff)
downloadbcm5719-llvm-5e8c8c0e12ac15d0c07e84eccdcc7c58acb9fdad.tar.gz
bcm5719-llvm-5e8c8c0e12ac15d0c07e84eccdcc7c58acb9fdad.zip
Even though we don't unique VLA types, we still need to build a
canonical type where the element type is canonical. Fixes PR7206. llvm-svn: 104461
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 720a88c6b67..801a1f63917 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud