From: Zhongxing Xu Date: Wed, 30 Dec 2009 22:59:54 +0000 (+0000) Subject: The element type should also be canonicalized. Add a case for VariableArrayType. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8c6c448c9d3b09efdaf05023427bb8baafcc9dc;p=clang 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 --- 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(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(T)) { + return getVariableArrayType(UnqualElt, VAT->getSizeExpr()->Retain(), + VAT->getSizeModifier(), 0, + SourceRange()); + } + const DependentSizedArrayType *DSAT = cast(T); return getDependentSizedArrayType(UnqualElt, DSAT->getSizeExpr()->Retain(), DSAT->getSizeModifier(), 0,