]> granicus.if.org Git - clang/commitdiff
The element type should also be canonicalized. Add a case for VariableArrayType.
authorZhongxing Xu <xuzhongxing@gmail.com>
Wed, 30 Dec 2009 22:59:54 +0000 (22:59 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Wed, 30 Dec 2009 22:59:54 +0000 (22:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92318 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp

index fe9628060917a91a978d8c03b103e99cc3f5fa2f..74e74e7aba0bd186412fb0d162678240ee81e329 100644 (file)
@@ -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,