aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-12-30 22:59:54 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-12-30 22:59:54 +0000
commita8c6c448c9d3b09efdaf05023427bb8baafcc9dc (patch)
treed77e4e920d46d5fdae2e05509ee240cba69f42f5
parent634785ca8423b6dd6c15e80714a076c3aaa5a047 (diff)
The element type should also be canonicalized. Add a case for VariableArrayType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92318 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTContext.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index fe96280609..74e74e7aba 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -2383,7 +2383,7 @@ QualType ASTContext::getUnqualifiedArrayType(QualType T,
assert(!T.hasQualifiers() && "canonical array type has qualifiers!");
const ArrayType *AT = cast<ArrayType>(T);
QualType Elt = AT->getElementType();
- QualType UnqualElt = getUnqualifiedArrayType(Elt, Quals);
+ QualType UnqualElt = getUnqualifiedArrayType(getCanonicalType(Elt), Quals);
if (Elt == UnqualElt)
return T;
@@ -2396,6 +2396,12 @@ QualType ASTContext::getUnqualifiedArrayType(QualType T,
return getIncompleteArrayType(UnqualElt, IAT->getSizeModifier(), 0);
}
+ if (const VariableArrayType *VAT = dyn_cast<VariableArrayType>(T)) {
+ return getVariableArrayType(UnqualElt, VAT->getSizeExpr()->Retain(),
+ VAT->getSizeModifier(), 0,
+ SourceRange());
+ }
+
const DependentSizedArrayType *DSAT = cast<DependentSizedArrayType>(T);
return getDependentSizedArrayType(UnqualElt, DSAT->getSizeExpr()->Retain(),
DSAT->getSizeModifier(), 0,