change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 8050557..b9a061b 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -36,8 +36,7 @@
   /// diagnose the use of local variables or parameters within the
   /// default argument expression.
   class VISIBILITY_HIDDEN CheckDefaultArgumentVisitor 
-    : public StmtVisitor<CheckDefaultArgumentVisitor, bool>
-  {
+    : public StmtVisitor<CheckDefaultArgumentVisitor, bool> {
     Expr *DefaultArg;
     Sema *S;
 
@@ -52,11 +51,9 @@
   /// VisitExpr - Visit all of the children of this expression.
   bool CheckDefaultArgumentVisitor::VisitExpr(Expr *Node) {
     bool IsInvalid = false;
-    for (Stmt::child_iterator first = Node->child_begin(), 
-           last = Node->child_end();
-         first != last; ++first)
-      IsInvalid |= Visit(*first);
-
+    for (Stmt::child_iterator I = Node->child_begin(), 
+         E = Node->child_end(); I != E; ++I)
+      IsInvalid |= Visit(*I);
     return IsInvalid;
   }
 
@@ -427,13 +424,14 @@
     // C++ 9.2p4: A member-declarator can contain a constant-initializer only
     // if it declares a static member of const integral or const enumeration
     // type.
-    if (CXXClassVarDecl *CVD =
-              dyn_cast<CXXClassVarDecl>(Member)) { // ...static member of...
+    if (CXXClassVarDecl *CVD = dyn_cast<CXXClassVarDecl>(Member)) {
+      // ...static member of...
       CVD->setInit(Init);
-      QualType MemberTy = CVD->getType().getCanonicalType();
       // ...const integral or const enumeration type.
-      if (MemberTy.isConstQualified() && MemberTy->isIntegralType()) {
-        if (CheckForConstantInitializer(Init, MemberTy)) // constant-initializer
+      if (Context.getCanonicalType(CVD->getType()).isConstQualified() &&
+          CVD->getType()->isIntegralType()) {
+        // constant-initializer
+        if (CheckForConstantInitializer(Init, CVD->getType()))
           InvalidDecl = true;
 
       } else {