[cfe-commits] r92318 - /cfe/trunk/lib/AST/ASTContext.cpp

Zhongxing Xu xuzhongxing at gmail.com
Wed Dec 30 14:59:54 PST 2009


Author: zhongxingxu
Date: Wed Dec 30 16:59:54 2009
New Revision: 92318

URL: http://llvm.org/viewvc/llvm-project?rev=92318&view=rev
Log:
The element type should also be canonicalized. Add a case for VariableArrayType.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=92318&r1=92317&r2=92318&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Dec 30 16:59:54 2009
@@ -2383,7 +2383,7 @@
   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 @@
     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,





More information about the cfe-commits mailing list