[cfe-commits] r81346 [5/6] - in /cfe/trunk: include/clang/AST/ include/clang/Analysis/ include/clang/Analysis/Analyses/ include/clang/Analysis/FlowSensitive/ include/clang/Analysis/PathSensitive/ include/clang/Analysis/Support/ include/clang/Analysis/Visitors/ include/clang/Basic/ include/clang/CodeGen/ include/clang/Driver/ include/clang/Frontend/ include/clang/Index/ include/clang/Lex/ include/clang/Parse/ include/clang/Rewrite/ include/clang/Sema/ lib/AST/ lib/Analysis/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Front...

Mike Stump mrs at apple.com
Wed Sep 9 08:08:16 PDT 2009


Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Sep  9 10:08:12 2009
@@ -38,13 +38,13 @@
   /// contains any ill-formed subexpressions. For example, this will
   /// diagnose the use of local variables or parameters within the
   /// default argument expression.
-  class VISIBILITY_HIDDEN CheckDefaultArgumentVisitor 
+  class VISIBILITY_HIDDEN CheckDefaultArgumentVisitor
     : public StmtVisitor<CheckDefaultArgumentVisitor, bool> {
     Expr *DefaultArg;
     Sema *S;
 
   public:
-    CheckDefaultArgumentVisitor(Expr *defarg, Sema *s) 
+    CheckDefaultArgumentVisitor(Expr *defarg, Sema *s)
       : DefaultArg(defarg), S(s) {}
 
     bool VisitExpr(Expr *Node);
@@ -55,7 +55,7 @@
   /// VisitExpr - Visit all of the children of this expression.
   bool CheckDefaultArgumentVisitor::VisitExpr(Expr *Node) {
     bool IsInvalid = false;
-    for (Stmt::child_iterator I = Node->child_begin(), 
+    for (Stmt::child_iterator I = Node->child_begin(),
          E = Node->child_end(); I != E; ++I)
       IsInvalid |= Visit(*I);
     return IsInvalid;
@@ -75,7 +75,7 @@
       //   evaluated. Parameters of a function declared before a default
       //   argument expression are in scope and can hide namespace and
       //   class member names.
-      return S->Diag(DRE->getSourceRange().getBegin(), 
+      return S->Diag(DRE->getSourceRange().getBegin(),
                      diag::err_param_default_argument_references_param)
          << Param->getDeclName() << DefaultArg->getSourceRange();
     } else if (VarDecl *VDecl = dyn_cast<VarDecl>(Decl)) {
@@ -83,7 +83,7 @@
       //   Local variables shall not be used in default argument
       //   expressions.
       if (VDecl->isBlockVarDecl())
-        return S->Diag(DRE->getSourceRange().getBegin(), 
+        return S->Diag(DRE->getSourceRange().getBegin(),
                        diag::err_param_default_argument_references_local)
           << VDecl->getDeclName() << DefaultArg->getSourceRange();
     }
@@ -104,8 +104,7 @@
 
 bool
 Sema::SetParamDefaultArgument(ParmVarDecl *Param, ExprArg DefaultArg,
-                              SourceLocation EqualLoc)
-{
+                              SourceLocation EqualLoc) {
   QualType ParamType = Param->getType();
 
   if (RequireCompleteType(Param->getLocation(), Param->getType(),
@@ -115,24 +114,24 @@
   }
 
   Expr *Arg = (Expr *)DefaultArg.get();
-  
+
   // C++ [dcl.fct.default]p5
   //   A default argument expression is implicitly converted (clause
   //   4) to the parameter type. The default argument expression has
   //   the same semantic constraints as the initializer expression in
   //   a declaration of a variable of the parameter type, using the
   //   copy-initialization semantics (8.5).
-  if (CheckInitializerTypes(Arg, ParamType, EqualLoc, 
+  if (CheckInitializerTypes(Arg, ParamType, EqualLoc,
                             Param->getDeclName(), /*DirectInit=*/false))
     return true;
 
   Arg = MaybeCreateCXXExprWithTemporaries(Arg, /*DestroyTemps=*/false);
-  
+
   // Okay: add the default argument to the parameter
   Param->setDefaultArg(Arg);
-  
+
   DefaultArg.release();
-  
+
   return false;
 }
 
@@ -140,11 +139,11 @@
 /// provided for a function parameter is well-formed. If so, attach it
 /// to the parameter declaration.
 void
-Sema::ActOnParamDefaultArgument(DeclPtrTy param, SourceLocation EqualLoc, 
+Sema::ActOnParamDefaultArgument(DeclPtrTy param, SourceLocation EqualLoc,
                                 ExprArg defarg) {
   if (!param || !defarg.get())
     return;
-  
+
   ParmVarDecl *Param = cast<ParmVarDecl>(param.getAs<Decl>());
   UnparsedDefaultArgLocs.erase(Param);
 
@@ -165,7 +164,7 @@
     Param->setInvalidDecl();
     return;
   }
-  
+
   SetParamDefaultArgument(Param, move(DefaultArg), EqualLoc);
 }
 
@@ -173,16 +172,16 @@
 /// argument for a function parameter, but we can't parse it yet
 /// because we're inside a class definition. Note that this default
 /// argument will be parsed later.
-void Sema::ActOnParamUnparsedDefaultArgument(DeclPtrTy param, 
+void Sema::ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
                                              SourceLocation EqualLoc,
                                              SourceLocation ArgLoc) {
   if (!param)
     return;
-  
+
   ParmVarDecl *Param = cast<ParmVarDecl>(param.getAs<Decl>());
   if (Param)
     Param->setUnparsedDefaultArg();
-  
+
   UnparsedDefaultArgLocs[Param] = ArgLoc;
 }
 
@@ -191,11 +190,11 @@
 void Sema::ActOnParamDefaultArgumentError(DeclPtrTy param) {
   if (!param)
     return;
-  
+
   ParmVarDecl *Param = cast<ParmVarDecl>(param.getAs<Decl>());
-  
+
   Param->setInvalidDecl();
-  
+
   UnparsedDefaultArgLocs.erase(Param);
 }
 
@@ -258,8 +257,8 @@
     ParmVarDecl *OldParam = Old->getParamDecl(p);
     ParmVarDecl *NewParam = New->getParamDecl(p);
 
-    if(OldParam->getDefaultArg() && NewParam->getDefaultArg()) {
-      Diag(NewParam->getLocation(), 
+    if (OldParam->getDefaultArg() && NewParam->getDefaultArg()) {
+      Diag(NewParam->getLocation(),
            diag::err_param_default_argument_redefinition)
         << NewParam->getDefaultArg()->getSourceRange();
       Diag(OldParam->getLocation(), diag::note_previous_definition);
@@ -300,19 +299,19 @@
   //   declarations. A default argument shall not be redefined
   //   by a later declaration (not even to the same value).
   unsigned LastMissingDefaultArg = 0;
-  for(; p < NumParams; ++p) {
+  for (; p < NumParams; ++p) {
     ParmVarDecl *Param = FD->getParamDecl(p);
     if (!Param->hasDefaultArg()) {
       if (Param->isInvalidDecl())
         /* We already complained about this parameter. */;
       else if (Param->getIdentifier())
-        Diag(Param->getLocation(), 
+        Diag(Param->getLocation(),
              diag::err_param_default_argument_missing_name)
           << Param->getIdentifier();
       else
-        Diag(Param->getLocation(), 
+        Diag(Param->getLocation(),
              diag::err_param_default_argument_missing);
-    
+
       LastMissingDefaultArg = p;
     }
   }
@@ -352,7 +351,7 @@
     return false;
 }
 
-/// \brief Check the validity of a C++ base class specifier. 
+/// \brief Check the validity of a C++ base class specifier.
 ///
 /// \returns a new CXXBaseSpecifier if well-formed, emits diagnostics
 /// and returns NULL otherwise.
@@ -360,7 +359,7 @@
 Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
                          SourceRange SpecifierRange,
                          bool Virtual, AccessSpecifier Access,
-                         QualType BaseType, 
+                         QualType BaseType,
                          SourceLocation BaseLoc) {
   // C++ [class.union]p1:
   //   A union shall not have base classes.
@@ -371,7 +370,7 @@
   }
 
   if (BaseType->isDependentType())
-    return new (Context) CXXBaseSpecifier(SpecifierRange, Virtual, 
+    return new (Context) CXXBaseSpecifier(SpecifierRange, Virtual,
                                 Class->getTagKind() == RecordDecl::TK_class,
                                 Access, BaseType);
 
@@ -391,7 +390,7 @@
   // C++ [class.derived]p2:
   //   The class-name in a base-specifier shall not be an incompletely
   //   defined class.
-  if (RequireCompleteType(BaseLoc, BaseType, 
+  if (RequireCompleteType(BaseLoc, BaseType,
                           PDiag(diag::err_incomplete_base_class)
                             << SpecifierRange))
     return 0;
@@ -433,7 +432,7 @@
     Class->setEmpty(false);
   } else {
     // C++ [class.ctor]p5:
-    //   A constructor is trivial if all the direct base classes of its 
+    //   A constructor is trivial if all the direct base classes of its
     //   class have trivial constructors.
     if (!cast<CXXRecordDecl>(BaseDecl)->hasTrivialConstructor())
       Class->setHasTrivialConstructor(false);
@@ -456,20 +455,20 @@
   //   have trivial destructors.
   if (!cast<CXXRecordDecl>(BaseDecl)->hasTrivialDestructor())
     Class->setHasTrivialDestructor(false);
-  
+
   // Create the base specifier.
   // FIXME: Allocate via ASTContext?
-  return new (Context) CXXBaseSpecifier(SpecifierRange, Virtual, 
-                              Class->getTagKind() == RecordDecl::TK_class, 
+  return new (Context) CXXBaseSpecifier(SpecifierRange, Virtual,
+                              Class->getTagKind() == RecordDecl::TK_class,
                               Access, BaseType);
 }
 
 /// ActOnBaseSpecifier - Parsed a base specifier. A base specifier is
 /// one entry in the base class list of a class specifier, for
-/// example: 
-///    class foo : public bar, virtual private baz { 
+/// example:
+///    class foo : public bar, virtual private baz {
 /// 'public bar' and 'virtual private baz' are each base-specifiers.
-Sema::BaseResult 
+Sema::BaseResult
 Sema::ActOnBaseSpecifier(DeclPtrTy classdecl, SourceRange SpecifierRange,
                          bool Virtual, AccessSpecifier Access,
                          TypeTy *basetype, SourceLocation BaseLoc) {
@@ -483,7 +482,7 @@
                                                       Virtual, Access,
                                                       BaseType, BaseLoc))
     return BaseSpec;
-  
+
   return true;
 }
 
@@ -504,7 +503,7 @@
   unsigned NumGoodBases = 0;
   bool Invalid = false;
   for (unsigned idx = 0; idx < NumBases; ++idx) {
-    QualType NewBaseType 
+    QualType NewBaseType
       = Context.getCanonicalType(Bases[idx]->getType());
     NewBaseType = NewBaseType.getUnqualifiedType();
 
@@ -543,7 +542,7 @@
 /// ActOnBaseSpecifiers - Attach the given base specifiers to the
 /// class, after checking whether there are any duplicate base
 /// classes.
-void Sema::ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases, 
+void Sema::ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases,
                                unsigned NumBases) {
   if (!ClassDecl || !Bases || !NumBases)
     return;
@@ -592,7 +591,7 @@
           Diag(DS.getStorageClassSpecLoc(), diag::err_mutable_function);
         else
           Diag(DS.getThreadSpecLoc(), diag::err_mutable_function);
-        
+
         // FIXME: It would be nicer if the keyword was ignored only for this
         // declarator. Otherwise we could get follow-up errors.
         D.getMutableDeclSpec().ClearStorageClassSpecs();
@@ -670,17 +669,17 @@
         // A function typedef ("typedef int f(); f a;").
         // C++ 9.6p3: A bit-field shall have integral or enumeration type.
         Diag(Loc, diag::err_not_integral_type_bitfield)
-          << Name << cast<ValueDecl>(Member)->getType() 
+          << Name << cast<ValueDecl>(Member)->getType()
           << BitWidth->getSourceRange();
       }
-      
+
       DeleteExpr(BitWidth);
       BitWidth = 0;
       Member->setInvalidDecl();
     }
 
     Member->setAccess(AS);
-    
+
     // If we have declared a member function template, set the access of the
     // templated declaration as well.
     if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(Member))
@@ -702,7 +701,7 @@
 }
 
 /// ActOnMemInitializer - Handle a C++ member initializer.
-Sema::MemInitResult 
+Sema::MemInitResult
 Sema::ActOnMemInitializer(DeclPtrTy ConstructorD,
                           Scope *S,
                           const CXXScopeSpec &SS,
@@ -715,10 +714,10 @@
                           SourceLocation RParenLoc) {
   if (!ConstructorD)
     return true;
-  
+
   AdjustDeclIfTemplate(ConstructorD);
-  
-  CXXConstructorDecl *Constructor 
+
+  CXXConstructorDecl *Constructor
     = dyn_cast<CXXConstructorDecl>(ConstructorD.getAs<Decl>());
   if (!Constructor) {
     // The user wrote a constructor initializer on a function that is
@@ -743,7 +742,7 @@
   if (!SS.getScopeRep() && !TemplateTypeTy) {
     // Look for a member, first.
     FieldDecl *Member = 0;
-    DeclContext::lookup_result Result 
+    DeclContext::lookup_result Result
       = ClassDecl->lookup(MemberOrBase);
     if (Result.first != Result.second)
       Member = dyn_cast<FieldDecl>(*Result.first);
@@ -755,12 +754,12 @@
                                     RParenLoc);
   }
   // It didn't name a member, so see if it names a class.
-  TypeTy *BaseTy = TemplateTypeTy ? TemplateTypeTy 
+  TypeTy *BaseTy = TemplateTypeTy ? TemplateTypeTy
                      : getTypeName(*MemberOrBase, IdLoc, S, &SS);
   if (!BaseTy)
     return Diag(IdLoc, diag::err_mem_init_not_member_or_class)
       << MemberOrBase << SourceRange(IdLoc, RParenLoc);
-  
+
   QualType BaseType = GetTypeFromParser(BaseTy);
 
   return BuildBaseInitializer(BaseType, (Expr **)Args, NumArgs, IdLoc,
@@ -784,10 +783,10 @@
   } else if (FieldType->getAs<RecordType>()) {
     if (!HasDependentArg)
       C = PerformInitializationByConstructor(
-            FieldType, (Expr **)Args, NumArgs, IdLoc, 
+            FieldType, (Expr **)Args, NumArgs, IdLoc,
             SourceRange(IdLoc, RParenLoc), Member->getDeclName(), IK_Direct);
   } else if (NumArgs != 1 && NumArgs != 0) {
-    return Diag(IdLoc, diag::err_mem_initializer_mismatch) 
+    return Diag(IdLoc, diag::err_mem_initializer_mismatch)
                 << Member->getDeclName() << SourceRange(IdLoc, RParenLoc);
   } else if (!HasDependentArg) {
     Expr *NewExp;
@@ -807,7 +806,7 @@
     Args[0] = NewExp;
   }
   // FIXME: Perform direct initialization of the member.
-  return new (Context) CXXBaseOrMemberInitializer(Member, (Expr **)Args, 
+  return new (Context) CXXBaseOrMemberInitializer(Member, (Expr **)Args,
                                                   NumArgs, C, IdLoc, RParenLoc);
 }
 
@@ -830,12 +829,12 @@
     //   of that class, the mem-initializer is ill-formed. A
     //   mem-initializer-list can initialize a base class using any
     //   name that denotes that base class type.
-    
+
     // First, check for a direct base class.
     const CXXBaseSpecifier *DirectBaseSpec = 0;
     for (CXXRecordDecl::base_class_const_iterator Base =
          ClassDecl->bases_begin(); Base != ClassDecl->bases_end(); ++Base) {
-      if (Context.getCanonicalType(BaseType).getUnqualifiedType() == 
+      if (Context.getCanonicalType(BaseType).getUnqualifiedType() ==
           Context.getCanonicalType(Base->getType()).getUnqualifiedType()) {
         // We found a direct base of this type. That's what we're
         // initializing.
@@ -843,7 +842,7 @@
         break;
       }
     }
-    
+
     // Check for a virtual base class.
     // FIXME: We might be able to short-circuit this if we know in advance that
     // there are no virtual bases.
@@ -854,7 +853,7 @@
       BasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
                       /*DetectVirtual=*/false);
       if (IsDerivedFrom(Context.getTypeDeclType(ClassDecl), BaseType, Paths)) {
-        for (BasePaths::paths_iterator Path = Paths.begin(); 
+        for (BasePaths::paths_iterator Path = Paths.begin();
              Path != Paths.end(); ++Path) {
           if (Path->back().Base->isVirtual()) {
             VirtualBaseSpec = Path->back().Base;
@@ -886,11 +885,11 @@
     DeclarationName Name = Context.DeclarationNames.getCXXConstructorName(
                                             Context.getCanonicalType(BaseType));
     C = PerformInitializationByConstructor(BaseType, (Expr **)Args, NumArgs,
-                                           IdLoc, SourceRange(IdLoc, RParenLoc), 
+                                           IdLoc, SourceRange(IdLoc, RParenLoc),
                                            Name, IK_Direct);
   }
 
-  return new (Context) CXXBaseOrMemberInitializer(BaseType, (Expr **)Args, 
+  return new (Context) CXXBaseOrMemberInitializer(BaseType, (Expr **)Args,
                                                   NumArgs, C, IdLoc, RParenLoc);
 }
 
@@ -898,7 +897,7 @@
 Sema::setBaseOrMemberInitializers(CXXConstructorDecl *Constructor,
                               CXXBaseOrMemberInitializer **Initializers,
                               unsigned NumInitializers,
-                              llvm::SmallVectorImpl<CXXBaseSpecifier *>& Bases,          
+                              llvm::SmallVectorImpl<CXXBaseSpecifier *>& Bases,
                               llvm::SmallVectorImpl<FieldDecl *>&Fields) {
   // We need to build the initializer AST according to order of construction
   // and not what user specified in the Initializers list.
@@ -906,7 +905,7 @@
   llvm::SmallVector<CXXBaseOrMemberInitializer*, 32> AllToInit;
   llvm::DenseMap<const void *, CXXBaseOrMemberInitializer*> AllBaseFields;
   bool HasDependentBaseInit = false;
-  
+
   for (unsigned i = 0; i < NumInitializers; i++) {
     CXXBaseOrMemberInitializer *Member = Initializers[i];
     if (Member->isBaseInitializer()) {
@@ -917,13 +916,13 @@
       AllBaseFields[Member->getMember()] = Member;
     }
   }
-  
+
   if (HasDependentBaseInit) {
     // FIXME. This does not preserve the ordering of the initializers.
     // Try (with -Wreorder)
     // template<class X> struct A {};
-    // template<class X> struct B : A<X> { 
-    //   B() : x1(10), A<X>() {} 
+    // template<class X> struct B : A<X> {
+    //   B() : x1(10), A<X>() {}
     //   int x1;
     // };
     // B<int> x;
@@ -931,7 +930,7 @@
     // while preserving user-declared initializer list. When this routine is
     // called during instantiatiation process, this routine will rebuild the
     // oderdered initializer list correctly.
-    
+
     // If we have a dependent base initialization, we can't determine the
     // association between initializers and bases; just dump the known
     // initializers into the list, and don't try to deal with other bases.
@@ -947,9 +946,9 @@
          E = ClassDecl->vbases_end(); VBase != E; ++VBase) {
       if (VBase->getType()->isDependentType())
         continue;
-      if (CXXBaseOrMemberInitializer *Value = 
+      if (CXXBaseOrMemberInitializer *Value =
           AllBaseFields.lookup(VBase->getType()->getAs<RecordType>())) {
-        CXXRecordDecl *BaseDecl = 
+        CXXRecordDecl *BaseDecl =
           cast<CXXRecordDecl>(VBase->getType()->getAs<RecordType>()->getDecl());
         assert(BaseDecl && "setBaseOrMemberInitializers - BaseDecl null");
         if (CXXConstructorDecl *Ctor = BaseDecl->getDefaultConstructor(Context))
@@ -957,7 +956,7 @@
         AllToInit.push_back(Value);
       }
       else {
-        CXXRecordDecl *VBaseDecl = 
+        CXXRecordDecl *VBaseDecl =
         cast<CXXRecordDecl>(VBase->getType()->getAs<RecordType>()->getDecl());
         assert(VBaseDecl && "setBaseOrMemberInitializers - VBaseDecl null");
         CXXConstructorDecl *Ctor = VBaseDecl->getDefaultConstructor(Context);
@@ -966,7 +965,7 @@
         else
           MarkDeclarationReferenced(Constructor->getLocation(), Ctor);
 
-        CXXBaseOrMemberInitializer *Member = 
+        CXXBaseOrMemberInitializer *Member =
         new (Context) CXXBaseOrMemberInitializer(VBase->getType(), 0, 0,
                                     Ctor,
                                     SourceLocation(),
@@ -974,7 +973,7 @@
         AllToInit.push_back(Member);
       }
     }
-    
+
     for (CXXRecordDecl::base_class_iterator Base =
          ClassDecl->bases_begin(),
          E = ClassDecl->bases_end(); Base != E; ++Base) {
@@ -984,9 +983,9 @@
       // Skip dependent types.
       if (Base->getType()->isDependentType())
         continue;
-      if (CXXBaseOrMemberInitializer *Value = 
+      if (CXXBaseOrMemberInitializer *Value =
           AllBaseFields.lookup(Base->getType()->getAs<RecordType>())) {
-        CXXRecordDecl *BaseDecl = 
+        CXXRecordDecl *BaseDecl =
           cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
         assert(BaseDecl && "setBaseOrMemberInitializers - BaseDecl null");
         if (CXXConstructorDecl *Ctor = BaseDecl->getDefaultConstructor(Context))
@@ -994,7 +993,7 @@
         AllToInit.push_back(Value);
       }
       else {
-        CXXRecordDecl *BaseDecl = 
+        CXXRecordDecl *BaseDecl =
           cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
         assert(BaseDecl && "setBaseOrMemberInitializers - BaseDecl null");
          CXXConstructorDecl *Ctor = BaseDecl->getDefaultConstructor(Context);
@@ -1003,7 +1002,7 @@
         else
           MarkDeclarationReferenced(Constructor->getLocation(), Ctor);
 
-        CXXBaseOrMemberInitializer *Member = 
+        CXXBaseOrMemberInitializer *Member =
         new (Context) CXXBaseOrMemberInitializer(Base->getType(), 0, 0,
                                       BaseDecl->getDefaultConstructor(Context),
                                       SourceLocation(),
@@ -1012,16 +1011,16 @@
       }
     }
   }
-  
+
   // non-static data members.
   for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
        E = ClassDecl->field_end(); Field != E; ++Field) {
     if ((*Field)->isAnonymousStructOrUnion()) {
-      if (const RecordType *FieldClassType = 
+      if (const RecordType *FieldClassType =
           Field->getType()->getAs<RecordType>()) {
         CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
-        for(RecordDecl::field_iterator FA = FieldClassDecl->field_begin(),
+        for (RecordDecl::field_iterator FA = FieldClassDecl->field_begin(),
             EA = FieldClassDecl->field_end(); FA != EA; FA++) {
           if (CXXBaseOrMemberInitializer *Value = AllBaseFields.lookup(*FA)) {
             // 'Member' is the anonymous union field and 'AnonUnionMember' is
@@ -1041,21 +1040,21 @@
       if (const RecordType* RT = FT->getAs<RecordType>()) {
         CXXRecordDecl *FieldRecDecl = cast<CXXRecordDecl>(RT->getDecl());
         assert(FieldRecDecl && "setBaseOrMemberInitializers - BaseDecl null");
-        if (CXXConstructorDecl *Ctor = 
+        if (CXXConstructorDecl *Ctor =
               FieldRecDecl->getDefaultConstructor(Context))
           MarkDeclarationReferenced(Value->getSourceLocation(), Ctor);
       }
       AllToInit.push_back(Value);
       continue;
     }
-    
+
     QualType FT = Context.getBaseElementType((*Field)->getType());
     if (const RecordType* RT = FT->getAs<RecordType>()) {
       CXXConstructorDecl *Ctor =
         cast<CXXRecordDecl>(RT->getDecl())->getDefaultConstructor(Context);
       if (!Ctor && !FT->isDependentType())
         Fields.push_back(*Field);
-      CXXBaseOrMemberInitializer *Member = 
+      CXXBaseOrMemberInitializer *Member =
       new (Context) CXXBaseOrMemberInitializer((*Field), 0, 0,
                                          Ctor,
                                          SourceLocation(),
@@ -1080,13 +1079,13 @@
       Diag((*Field)->getLocation(), diag::note_declared_at);
     }
   }
-  
+
   NumInitializers = AllToInit.size();
   if (NumInitializers > 0) {
     Constructor->setNumBaseOrMemberInitializers(NumInitializers);
     CXXBaseOrMemberInitializer **baseOrMemberInitializers =
       new (Context) CXXBaseOrMemberInitializer*[NumInitializers];
-    
+
     Constructor->setBaseOrMemberInitializers(baseOrMemberInitializers);
     for (unsigned Idx = 0; Idx < NumInitializers; ++Idx)
       baseOrMemberInitializers[Idx] = AllToInit[Idx];
@@ -1101,14 +1100,14 @@
                                  ) {
   llvm::SmallVector<CXXBaseSpecifier *, 4>Bases;
   llvm::SmallVector<FieldDecl *, 4>Members;
-  
-  setBaseOrMemberInitializers(Constructor, 
+
+  setBaseOrMemberInitializers(Constructor,
                               Initializers, NumInitializers, Bases, Members);
   for (unsigned int i = 0; i < Bases.size(); i++)
-    Diag(Bases[i]->getSourceRange().getBegin(), 
+    Diag(Bases[i]->getSourceRange().getBegin(),
          diag::err_missing_default_constructor) << 0 << Bases[i]->getType();
   for (unsigned int i = 0; i < Members.size(); i++)
-    Diag(Members[i]->getLocation(), diag::err_missing_default_constructor) 
+    Diag(Members[i]->getLocation(), diag::err_missing_default_constructor)
           << 1 << Members[i]->getType();
 }
 
@@ -1124,20 +1123,20 @@
 static void *GetKeyForBase(QualType BaseType) {
   if (const RecordType *RT = BaseType->getAs<RecordType>())
     return (void *)RT;
-  
+
   assert(0 && "Unexpected base type!");
   return 0;
 }
 
-static void *GetKeyForMember(CXXBaseOrMemberInitializer *Member, 
+static void *GetKeyForMember(CXXBaseOrMemberInitializer *Member,
                              bool MemberMaybeAnon = false) {
   // For fields injected into the class via declaration of an anonymous union,
   // use its anonymous union class declaration as the unique key.
   if (Member->isMemberInitializer()) {
     FieldDecl *Field = Member->getMember();
-    
+
     // After BuildBaseOrMemberInitializers call, Field is the anonymous union
-    // data member of the class. Data member used in the initializer list is 
+    // data member of the class. Data member used in the initializer list is
     // in AnonUnionMember field.
     if (MemberMaybeAnon && Field->isAnonymousStructOrUnion())
       Field = Member->getAnonUnionMember();
@@ -1148,31 +1147,31 @@
     }
     return static_cast<void *>(Field);
   }
-  
+
   return GetKeyForBase(QualType(Member->getBaseClass(), 0));
 }
 
-void Sema::ActOnMemInitializers(DeclPtrTy ConstructorDecl, 
+void Sema::ActOnMemInitializers(DeclPtrTy ConstructorDecl,
                                 SourceLocation ColonLoc,
                                 MemInitTy **MemInits, unsigned NumMemInits) {
   if (!ConstructorDecl)
     return;
 
   AdjustDeclIfTemplate(ConstructorDecl);
-  
-  CXXConstructorDecl *Constructor 
+
+  CXXConstructorDecl *Constructor
     = dyn_cast<CXXConstructorDecl>(ConstructorDecl.getAs<Decl>());
-  
+
   if (!Constructor) {
     Diag(ColonLoc, diag::err_only_constructors_take_base_inits);
     return;
   }
-  
+
   if (!Constructor->isDependentContext()) {
     llvm::DenseMap<void*, CXXBaseOrMemberInitializer *>Members;
     bool err = false;
     for (unsigned i = 0; i < NumMemInits; i++) {
-      CXXBaseOrMemberInitializer *Member = 
+      CXXBaseOrMemberInitializer *Member =
         static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]);
       void *KeyToMember = GetKeyForMember(Member);
       CXXBaseOrMemberInitializer *&PrevMember = Members[KeyToMember];
@@ -1181,13 +1180,13 @@
         continue;
       }
       if (FieldDecl *Field = Member->getMember())
-        Diag(Member->getSourceLocation(), 
+        Diag(Member->getSourceLocation(),
              diag::error_multiple_mem_initialization)
         << Field->getNameAsString();
       else {
         Type *BaseClass = Member->getBaseClass();
         assert(BaseClass && "ActOnMemInitializers - neither field or base");
-        Diag(Member->getSourceLocation(),  
+        Diag(Member->getSourceLocation(),
              diag::error_multiple_base_initialization)
           << BaseClass->getDesugaredType(true);
       }
@@ -1195,28 +1194,28 @@
         << 0;
       err = true;
     }
-  
+
     if (err)
       return;
   }
-  
+
   BuildBaseOrMemberInitializers(Context, Constructor,
-                      reinterpret_cast<CXXBaseOrMemberInitializer **>(MemInits), 
+                      reinterpret_cast<CXXBaseOrMemberInitializer **>(MemInits),
                       NumMemInits);
-  
+
   if (Constructor->isDependentContext())
     return;
-  
-  if (Diags.getDiagnosticLevel(diag::warn_base_initialized) == 
+
+  if (Diags.getDiagnosticLevel(diag::warn_base_initialized) ==
       Diagnostic::Ignored &&
-      Diags.getDiagnosticLevel(diag::warn_field_initialized) == 
+      Diags.getDiagnosticLevel(diag::warn_field_initialized) ==
       Diagnostic::Ignored)
     return;
-  
+
   // Also issue warning if order of ctor-initializer list does not match order
   // of 1) base class declarations and 2) order of non-static data members.
   llvm::SmallVector<const void*, 32> AllBaseOrMembers;
-  
+
   CXXRecordDecl *ClassDecl
     = cast<CXXRecordDecl>(Constructor->getDeclContext());
   // Push virtual bases before others.
@@ -1224,7 +1223,7 @@
        ClassDecl->vbases_begin(),
        E = ClassDecl->vbases_end(); VBase != E; ++VBase)
     AllBaseOrMembers.push_back(GetKeyForBase(VBase->getType()));
-    
+
   for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
        E = ClassDecl->bases_end(); Base != E; ++Base) {
     // Virtuals are alread in the virtual base list and are constructed
@@ -1233,16 +1232,16 @@
       continue;
     AllBaseOrMembers.push_back(GetKeyForBase(Base->getType()));
   }
-  
+
   for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
        E = ClassDecl->field_end(); Field != E; ++Field)
     AllBaseOrMembers.push_back(GetKeyForTopLevelField(*Field));
-  
+
   int Last = AllBaseOrMembers.size();
   int curIndex = 0;
   CXXBaseOrMemberInitializer *PrevMember = 0;
   for (unsigned i = 0; i < NumMemInits; i++) {
-    CXXBaseOrMemberInitializer *Member = 
+    CXXBaseOrMemberInitializer *Member =
       static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]);
     void *MemberInCtorList = GetKeyForMember(Member, true);
 
@@ -1257,27 +1256,27 @@
         // Diagnostics is for an initialized base class.
         Type *BaseClass = PrevMember->getBaseClass();
         Diag(PrevMember->getSourceLocation(),
-             diag::warn_base_initialized) 
+             diag::warn_base_initialized)
               << BaseClass->getDesugaredType(true);
       } else {
         FieldDecl *Field = PrevMember->getMember();
         Diag(PrevMember->getSourceLocation(),
-             diag::warn_field_initialized) 
+             diag::warn_field_initialized)
           << Field->getNameAsString();
       }
       // Also the note!
       if (FieldDecl *Field = Member->getMember())
-        Diag(Member->getSourceLocation(), 
+        Diag(Member->getSourceLocation(),
              diag::note_fieldorbase_initialized_here) << 0
           << Field->getNameAsString();
       else {
         Type *BaseClass = Member->getBaseClass();
-        Diag(Member->getSourceLocation(),  
+        Diag(Member->getSourceLocation(),
              diag::note_fieldorbase_initialized_here) << 1
           << BaseClass->getDesugaredType(true);
       }
       for (curIndex = 0; curIndex < Last; curIndex++)
-        if (MemberInCtorList == AllBaseOrMembers[curIndex]) 
+        if (MemberInCtorList == AllBaseOrMembers[curIndex])
           break;
     }
     PrevMember = Member;
@@ -1288,7 +1287,7 @@
 Sema::computeBaseOrMembersToDestroy(CXXDestructorDecl *Destructor) {
   CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Destructor->getDeclContext());
   llvm::SmallVector<uintptr_t, 32> AllToDestruct;
-  
+
   for (CXXRecordDecl::base_class_iterator VBase = ClassDecl->vbases_begin(),
        E = ClassDecl->vbases_end(); VBase != E; ++VBase) {
     if (VBase->getType()->isDependentType())
@@ -1299,11 +1298,11 @@
     if (BaseClassDecl->hasTrivialDestructor())
       continue;
     if (const CXXDestructorDecl *Dtor = BaseClassDecl->getDestructor(Context))
-      MarkDeclarationReferenced(Destructor->getLocation(), 
+      MarkDeclarationReferenced(Destructor->getLocation(),
                                 const_cast<CXXDestructorDecl*>(Dtor));
-    
-    uintptr_t Member = 
-    reinterpret_cast<uintptr_t>(VBase->getType().getTypePtr()) 
+
+    uintptr_t Member =
+    reinterpret_cast<uintptr_t>(VBase->getType().getTypePtr())
       | CXXDestructorDecl::VBASE;
     AllToDestruct.push_back(Member);
   }
@@ -1320,37 +1319,37 @@
     if (BaseClassDecl->hasTrivialDestructor())
       continue;
     if (const CXXDestructorDecl *Dtor = BaseClassDecl->getDestructor(Context))
-      MarkDeclarationReferenced(Destructor->getLocation(), 
+      MarkDeclarationReferenced(Destructor->getLocation(),
                                 const_cast<CXXDestructorDecl*>(Dtor));
-    uintptr_t Member = 
-    reinterpret_cast<uintptr_t>(Base->getType().getTypePtr()) 
+    uintptr_t Member =
+    reinterpret_cast<uintptr_t>(Base->getType().getTypePtr())
       | CXXDestructorDecl::DRCTNONVBASE;
     AllToDestruct.push_back(Member);
   }
-  
+
   // non-static data members.
   for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
        E = ClassDecl->field_end(); Field != E; ++Field) {
     QualType FieldType = Context.getBaseElementType((*Field)->getType());
-    
+
     if (const RecordType* RT = FieldType->getAs<RecordType>()) {
       // Skip over virtual bases which have trivial destructors.
       CXXRecordDecl *FieldClassDecl = cast<CXXRecordDecl>(RT->getDecl());
       if (FieldClassDecl->hasTrivialDestructor())
         continue;
-      if (const CXXDestructorDecl *Dtor = 
+      if (const CXXDestructorDecl *Dtor =
             FieldClassDecl->getDestructor(Context))
-        MarkDeclarationReferenced(Destructor->getLocation(), 
+        MarkDeclarationReferenced(Destructor->getLocation(),
                                   const_cast<CXXDestructorDecl*>(Dtor));
       uintptr_t Member = reinterpret_cast<uintptr_t>(*Field);
       AllToDestruct.push_back(Member);
     }
   }
-  
+
   unsigned NumDestructions = AllToDestruct.size();
   if (NumDestructions > 0) {
     Destructor->setNumBaseOrMemberDestructions(NumDestructions);
-    uintptr_t *BaseOrMemberDestructions = 
+    uintptr_t *BaseOrMemberDestructions =
       new (Context) uintptr_t [NumDestructions];
     // Insert in reverse order.
     for (int Idx = NumDestructions-1, i=0 ; Idx >= 0; --Idx)
@@ -1362,10 +1361,10 @@
 void Sema::ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl) {
   if (!CDtorDecl)
     return;
-  
+
   AdjustDeclIfTemplate(CDtorDecl);
-  
-  if (CXXConstructorDecl *Constructor 
+
+  if (CXXConstructorDecl *Constructor
       = dyn_cast<CXXConstructorDecl>(CDtorDecl.getAs<Decl>()))
     BuildBaseOrMemberInitializers(Context,
                                      Constructor,
@@ -1383,31 +1382,31 @@
 
   private:
     MethodList Methods;
-    
+
     void Collect(const CXXRecordDecl* RD, MethodList& Methods);
-    
+
   public:
-    PureVirtualMethodCollector(ASTContext &Ctx, const CXXRecordDecl* RD) 
+    PureVirtualMethodCollector(ASTContext &Ctx, const CXXRecordDecl* RD)
       : Context(Ctx) {
-        
+
       MethodList List;
       Collect(RD, List);
-        
+
       // Copy the temporary list to methods, and make sure to ignore any
       // null entries.
       for (size_t i = 0, e = List.size(); i != e; ++i) {
         if (List[i])
           Methods.push_back(List[i]);
-      }          
+      }
     }
-    
+
     bool empty() const { return Methods.empty(); }
-    
+
     MethodList::const_iterator methods_begin() { return Methods.begin(); }
     MethodList::const_iterator methods_end() { return Methods.end(); }
   };
-  
-  void PureVirtualMethodCollector::Collect(const CXXRecordDecl* RD, 
+
+  void PureVirtualMethodCollector::Collect(const CXXRecordDecl* RD,
                                            MethodList& Methods) {
     // First, collect the pure virtual methods for the base classes.
     for (CXXRecordDecl::base_class_const_iterator Base = RD->bases_begin(),
@@ -1418,14 +1417,14 @@
           Collect(BaseDecl, Methods);
       }
     }
-    
+
     // Next, zero out any pure virtual methods that this class overrides.
     typedef llvm::SmallPtrSet<const CXXMethodDecl*, 4> MethodSetTy;
-  
+
     MethodSetTy OverriddenMethods;
     size_t MethodsSize = Methods.size();
 
-    for (RecordDecl::decl_iterator i = RD->decls_begin(), e = RD->decls_end(); 
+    for (RecordDecl::decl_iterator i = RD->decls_begin(), e = RD->decls_end();
          i != e; ++i) {
       // Traverse the record, looking for methods.
       if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(*i)) {
@@ -1434,7 +1433,7 @@
           Methods.push_back(MD);
           continue;
         }
-        
+
         // Otherwise, record all the overridden methods in our set.
         for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
              E = MD->end_overridden_methods(); I != E; ++I) {
@@ -1443,19 +1442,19 @@
         }
       }
     }
-    
-    // Now go through the methods and zero out all the ones we know are 
+
+    // Now go through the methods and zero out all the ones we know are
     // overridden.
     for (size_t i = 0, e = MethodsSize; i != e; ++i) {
       if (OverriddenMethods.count(Methods[i]))
         Methods[i] = 0;
     }
-    
+
   }
 }
 
 
-bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T, 
+bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T,
                                   unsigned DiagID, AbstractDiagSelID SelID,
                                   const CXXRecordDecl *CurrentRD) {
   if (SelID == -1)
@@ -1464,71 +1463,71 @@
   else
     return RequireNonAbstractType(Loc, T,
                                   PDiag(DiagID) << SelID, CurrentRD);
-}  
-  
+}
+
 bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T,
                                   const PartialDiagnostic &PD,
                                   const CXXRecordDecl *CurrentRD) {
   if (!getLangOptions().CPlusPlus)
     return false;
-  
+
   if (const ArrayType *AT = Context.getAsArrayType(T))
     return RequireNonAbstractType(Loc, AT->getElementType(), PD,
                                   CurrentRD);
-  
+
   if (const PointerType *PT = T->getAs<PointerType>()) {
     // Find the innermost pointer type.
     while (const PointerType *T = PT->getPointeeType()->getAs<PointerType>())
       PT = T;
-    
+
     if (const ArrayType *AT = Context.getAsArrayType(PT->getPointeeType()))
       return RequireNonAbstractType(Loc, AT->getElementType(), PD, CurrentRD);
   }
-  
+
   const RecordType *RT = T->getAs<RecordType>();
   if (!RT)
     return false;
-  
+
   const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl());
   if (!RD)
     return false;
 
   if (CurrentRD && CurrentRD != RD)
     return false;
-  
+
   if (!RD->isAbstract())
     return false;
-  
+
   Diag(Loc, PD) << RD->getDeclName();
-  
+
   // Check if we've already emitted the list of pure virtual functions for this
   // class.
   if (PureVirtualClassDiagSet && PureVirtualClassDiagSet->count(RD))
     return true;
-  
+
   PureVirtualMethodCollector Collector(Context, RD);
-  
-  for (PureVirtualMethodCollector::MethodList::const_iterator I = 
+
+  for (PureVirtualMethodCollector::MethodList::const_iterator I =
        Collector.methods_begin(), E = Collector.methods_end(); I != E; ++I) {
     const CXXMethodDecl *MD = *I;
-    
-    Diag(MD->getLocation(), diag::note_pure_virtual_function) << 
+
+    Diag(MD->getLocation(), diag::note_pure_virtual_function) <<
       MD->getDeclName();
   }
 
   if (!PureVirtualClassDiagSet)
     PureVirtualClassDiagSet.reset(new RecordDeclSetTy);
   PureVirtualClassDiagSet->insert(RD);
-  
+
   return true;
 }
 
 namespace {
-  class VISIBILITY_HIDDEN AbstractClassUsageDiagnoser 
+  class VISIBILITY_HIDDEN AbstractClassUsageDiagnoser
     : public DeclVisitor<AbstractClassUsageDiagnoser, bool> {
     Sema &SemaRef;
     CXXRecordDecl *AbstractClass;
-  
+
     bool VisitDeclContext(const DeclContext *DC) {
       bool Invalid = false;
 
@@ -1538,7 +1537,7 @@
 
       return Invalid;
     }
-      
+
   public:
     AbstractClassUsageDiagnoser(Sema& SemaRef, CXXRecordDecl *ac)
       : SemaRef(SemaRef), AbstractClass(ac) {
@@ -1549,36 +1548,36 @@
       if (FD->isThisDeclarationADefinition()) {
         // No need to do the check if we're in a definition, because it requires
         // that the return/param types are complete.
-        // because that requires 
+        // because that requires
         return VisitDeclContext(FD);
       }
-      
+
       // Check the return type.
       QualType RTy = FD->getType()->getAsFunctionType()->getResultType();
-      bool Invalid = 
+      bool Invalid =
         SemaRef.RequireNonAbstractType(FD->getLocation(), RTy,
                                        diag::err_abstract_type_in_decl,
                                        Sema::AbstractReturnType,
                                        AbstractClass);
 
-      for (FunctionDecl::param_const_iterator I = FD->param_begin(), 
+      for (FunctionDecl::param_const_iterator I = FD->param_begin(),
            E = FD->param_end(); I != E; ++I) {
         const ParmVarDecl *VD = *I;
-        Invalid |= 
+        Invalid |=
           SemaRef.RequireNonAbstractType(VD->getLocation(),
-                                         VD->getOriginalType(), 
-                                         diag::err_abstract_type_in_decl, 
+                                         VD->getOriginalType(),
+                                         diag::err_abstract_type_in_decl,
                                          Sema::AbstractParamType,
                                          AbstractClass);
       }
 
       return Invalid;
     }
-    
+
     bool VisitDecl(const Decl* D) {
       if (const DeclContext *DC = dyn_cast<DeclContext>(D))
         return VisitDeclContext(DC);
-      
+
       return false;
     }
   };
@@ -1590,7 +1589,7 @@
                                              SourceLocation RBrac) {
   if (!TagDecl)
     return;
-  
+
   AdjustDeclIfTemplate(TagDecl);
   ActOnFields(S, RLoc, TagDecl,
               (DeclPtrTy*)FieldCollector->getCurFields(),
@@ -1601,13 +1600,13 @@
     // Collect all the pure virtual methods and see if this is an abstract
     // class after all.
     PureVirtualMethodCollector Collector(Context, RD);
-    if (!Collector.empty()) 
+    if (!Collector.empty())
       RD->setAbstract(true);
   }
-  
-  if (RD->isAbstract()) 
+
+  if (RD->isAbstract())
     AbstractClassUsageDiagnoser(*this, RD);
-    
+
   if (!RD->isDependentType())
     AddImplicitlyDeclaredMembersToClass(RD);
 }
@@ -1618,7 +1617,7 @@
 /// [special]p1).  This routine can only be executed just before the
 /// definition of the class is complete.
 void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
-  CanQualType ClassType 
+  CanQualType ClassType
     = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl));
 
   // FIXME: Implicit declarations have exception specifications, which are
@@ -1631,9 +1630,9 @@
     //   user-declared constructor for class X, a default constructor is
     //   implicitly declared. An implicitly-declared default constructor
     //   is an inline public member of its class.
-    DeclarationName Name 
+    DeclarationName Name
       = Context.DeclarationNames.getCXXConstructorName(ClassType);
-    CXXConstructorDecl *DefaultCon = 
+    CXXConstructorDecl *DefaultCon =
       CXXConstructorDecl::Create(Context, ClassDecl,
                                  ClassDecl->getLocation(), Name,
                                  Context.getFunctionType(Context.VoidTy,
@@ -1669,7 +1668,7 @@
          HasConstCopyConstructor && Base != ClassDecl->bases_end(); ++Base) {
       const CXXRecordDecl *BaseClassDecl
         = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
-      HasConstCopyConstructor 
+      HasConstCopyConstructor
         = BaseClassDecl->hasConstCopyConstructor(Context);
     }
 
@@ -1684,9 +1683,9 @@
       if (const ArrayType *Array = Context.getAsArrayType(FieldType))
         FieldType = Array->getElementType();
       if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
-        const CXXRecordDecl *FieldClassDecl 
+        const CXXRecordDecl *FieldClassDecl
           = cast<CXXRecordDecl>(FieldClassType->getDecl());
-        HasConstCopyConstructor 
+        HasConstCopyConstructor
           = FieldClassDecl->hasConstCopyConstructor(Context);
       }
     }
@@ -1702,7 +1701,7 @@
 
     //   An implicitly-declared copy constructor is an inline public
     //   member of its class.
-    DeclarationName Name 
+    DeclarationName Name
       = Context.DeclarationNames.getCXXConstructorName(ClassType);
     CXXConstructorDecl *CopyConstructor
       = CXXConstructorDecl::Create(Context, ClassDecl,
@@ -1753,7 +1752,7 @@
       const CXXRecordDecl *BaseClassDecl
         = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
       const CXXMethodDecl *MD = 0;
-      HasConstCopyAssignment = BaseClassDecl->hasConstCopyAssignment(Context, 
+      HasConstCopyAssignment = BaseClassDecl->hasConstCopyAssignment(Context,
                                                                      MD);
     }
 
@@ -1818,9 +1817,9 @@
     //   If a class has no user-declared destructor, a destructor is
     //   declared implicitly. An implicitly-declared destructor is an
     //   inline public member of its class.
-    DeclarationName Name 
+    DeclarationName Name
       = Context.DeclarationNames.getCXXDestructorName(ClassType);
-    CXXDestructorDecl *Destructor 
+    CXXDestructorDecl *Destructor
       = CXXDestructorDecl::Create(Context, ClassDecl,
                                   ClassDecl->getLocation(), Name,
                                   Context.getFunctionType(Context.VoidTy,
@@ -1862,12 +1861,12 @@
 void Sema::ActOnStartDelayedCXXMethodDeclaration(Scope *S, DeclPtrTy MethodD) {
   if (!MethodD)
     return;
-  
+
   AdjustDeclIfTemplate(MethodD);
-  
+
   CXXScopeSpec SS;
   FunctionDecl *Method = cast<FunctionDecl>(MethodD.getAs<Decl>());
-  QualType ClassTy 
+  QualType ClassTy
     = Context.getTypeDeclType(cast<RecordDecl>(Method->getDeclContext()));
   SS.setScopeRep(
     NestedNameSpecifier::Create(Context, 0, false, ClassTy.getTypePtr()));
@@ -1882,7 +1881,7 @@
 void Sema::ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy ParamD) {
   if (!ParamD)
     return;
-  
+
   ParmVarDecl *Param = cast<ParmVarDecl>(ParamD.getAs<Decl>());
 
   // If this parameter has an unparsed default argument, clear it out
@@ -1904,12 +1903,12 @@
 void Sema::ActOnFinishDelayedCXXMethodDeclaration(Scope *S, DeclPtrTy MethodD) {
   if (!MethodD)
     return;
-  
+
   AdjustDeclIfTemplate(MethodD);
-  
+
   FunctionDecl *Method = cast<FunctionDecl>(MethodD.getAs<Decl>());
   CXXScopeSpec SS;
-  QualType ClassTy 
+  QualType ClassTy
     = Context.getTypeDeclType(cast<RecordDecl>(Method->getDeclContext()));
   SS.setScopeRep(
     NestedNameSpecifier::Create(Context, 0, false, ClassTy.getTypePtr()));
@@ -1957,7 +1956,7 @@
     D.setInvalidType();
     SC = FunctionDecl::None;
   }
-  
+
   DeclaratorChunk::FunctionTypeInfo &FTI = D.getTypeObject(0).Fun;
   if (FTI.TypeQuals != 0) {
     if (FTI.TypeQuals & QualType::Const)
@@ -1970,7 +1969,7 @@
       Diag(D.getIdentifierLoc(), diag::err_invalid_qualified_constructor)
         << "restrict" << SourceRange(D.getIdentifierLoc());
   }
-      
+
   // Rebuild the function type "R" without any type qualifiers (in
   // case any of the errors above fired) and with "void" as the
   // return type, since constructors don't have return types. We
@@ -1986,7 +1985,7 @@
 /// well-formedness, issuing any diagnostics required. Returns true if
 /// the constructor declarator is invalid.
 void Sema::CheckConstructor(CXXConstructorDecl *Constructor) {
-  CXXRecordDecl *ClassDecl 
+  CXXRecordDecl *ClassDecl
     = dyn_cast<CXXRecordDecl>(Constructor->getDeclContext());
   if (!ClassDecl)
     return Constructor->setInvalidDecl();
@@ -1997,8 +1996,8 @@
   //   either there are no other parameters or else all other
   //   parameters have default arguments.
   if (!Constructor->isInvalidDecl() &&
-      ((Constructor->getNumParams() == 1) || 
-       (Constructor->getNumParams() > 1 && 
+      ((Constructor->getNumParams() == 1) ||
+       (Constructor->getNumParams() > 1 &&
         Constructor->getParamDecl(1)->hasDefaultArg()))) {
     QualType ParamType = Constructor->getParamDecl(0)->getType();
     QualType ClassTy = Context.getTagDeclType(ClassDecl);
@@ -2009,12 +2008,12 @@
       Constructor->setInvalidDecl();
     }
   }
-  
+
   // Notify the class that we've added a constructor.
   ClassDecl->addedConstructor(Context, Constructor);
 }
 
-static inline bool 
+static inline bool
 FTIHasSingleVoidArgument(DeclaratorChunk::FunctionTypeInfo &FTI) {
   return (FTI.NumArgs == 1 && !FTI.isVariadic && FTI.ArgInfo[0].Ident == 0 &&
           FTI.ArgInfo[0].Param &&
@@ -2070,7 +2069,7 @@
       << SourceRange(D.getDeclSpec().getTypeSpecTypeLoc())
       << SourceRange(D.getIdentifierLoc());
   }
-  
+
   DeclaratorChunk::FunctionTypeInfo &FTI = D.getTypeObject(0).Fun;
   if (FTI.TypeQuals != 0 && !D.isInvalidType()) {
     if (FTI.TypeQuals & QualType::Const)
@@ -2094,7 +2093,7 @@
     D.setInvalidType();
   }
 
-  // Make sure the destructor isn't variadic.  
+  // Make sure the destructor isn't variadic.
   if (FTI.isVariadic) {
     Diag(D.getIdentifierLoc(), diag::err_destructor_variadic);
     D.setInvalidType();
@@ -2119,7 +2118,7 @@
   // C++ [class.conv.fct]p1:
   //   Neither parameter types nor return type can be specified. The
   //   type of a conversion function (8.3.5) is "function taking no
-  //   parameter returning conversion-type-id." 
+  //   parameter returning conversion-type-id."
   if (SC == FunctionDecl::Static) {
     if (!D.isInvalidType())
       Diag(D.getIdentifierLoc(), diag::err_conv_function_not_member)
@@ -2151,7 +2150,7 @@
     D.setInvalidType();
   }
 
-  // Make sure the conversion function isn't variadic.  
+  // Make sure the conversion function isn't variadic.
   if (R->getAsFunctionProtoType()->isVariadic() && !D.isInvalidType()) {
     Diag(D.getIdentifierLoc(), diag::err_conv_function_variadic);
     D.setInvalidType();
@@ -2173,13 +2172,13 @@
 
   // Rebuild the function type "R" without any parameters (in case any
   // of the errors above fired) and with the conversion type as the
-  // return type. 
-  R = Context.getFunctionType(ConvType, 0, 0, false, 
+  // return type.
+  R = Context.getFunctionType(ConvType, 0, 0, false,
                               R->getAsFunctionProtoType()->getTypeQuals());
 
   // C++0x explicit conversion operators.
   if (D.getDeclSpec().isExplicitSpecified() && !getLangOptions().CPlusPlus0x)
-    Diag(D.getDeclSpec().getExplicitSpecLoc(), 
+    Diag(D.getDeclSpec().getExplicitSpecLoc(),
          diag::warn_explicit_conversion_functions)
       << SourceRange(D.getDeclSpec().getExplicitSpecLoc());
 }
@@ -2204,7 +2203,7 @@
   //   or to (possibly cv-qualified) void.
   // FIXME: Suppress this warning if the conversion function ends up being a
   // virtual function that overrides a virtual function in a base class.
-  QualType ClassType 
+  QualType ClassType
     = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl));
   if (const ReferenceType *ConvTypeRef = ConvType->getAs<ReferenceType>())
     ConvType = ConvTypeRef->getPointeeType();
@@ -2223,11 +2222,11 @@
 
   if (Conversion->getPreviousDeclaration()) {
     const NamedDecl *ExpectedPrevDecl = Conversion->getPreviousDeclaration();
-    if (FunctionTemplateDecl *ConversionTemplate 
+    if (FunctionTemplateDecl *ConversionTemplate
           = Conversion->getDescribedFunctionTemplate())
       ExpectedPrevDecl = ConversionTemplate->getPreviousDeclaration();
     OverloadedFunctionDecl *Conversions = ClassDecl->getConversionFunctions();
-    for (OverloadedFunctionDecl::function_iterator 
+    for (OverloadedFunctionDecl::function_iterator
            Conv = Conversions->function_begin(),
            ConvEnd = Conversions->function_end();
          Conv != ConvEnd; ++Conv) {
@@ -2237,7 +2236,7 @@
       }
     }
     assert(Conversion->isInvalidDecl() && "Conversion should not get here.");
-  } else if (FunctionTemplateDecl *ConversionTemplate 
+  } else if (FunctionTemplateDecl *ConversionTemplate
                = Conversion->getDescribedFunctionTemplate())
     ClassDecl->addConversionFunction(Context, ConversionTemplate);
   else if (!Conversion->getPrimaryTemplate()) // ignore specializations
@@ -2272,7 +2271,7 @@
 
     NamedDecl *PrevDecl = LookupName(DeclRegionScope, II, LookupOrdinaryName,
                                      true);
-    
+
     if (NamespaceDecl *OrigNS = dyn_cast_or_null<NamespaceDecl>(PrevDecl)) {
       // This is an extended namespace definition.
       // Attach this namespace decl to the chain of extended namespace
@@ -2280,7 +2279,7 @@
       OrigNS->setNextNamespace(Namespc);
       Namespc->setOriginalNamespace(OrigNS->getOriginalNamespace());
 
-      // Remove the previous declaration from the scope.      
+      // Remove the previous declaration from the scope.
       if (DeclRegionScope->isDeclScope(DeclPtrTy::make(OrigNS))) {
         IdResolver.RemoveDecl(OrigNS);
         DeclRegionScope->RemoveDecl(DeclPtrTy::make(OrigNS));
@@ -2292,7 +2291,7 @@
       Diag(PrevDecl->getLocation(), diag::note_previous_definition);
       Namespc->setInvalidDecl();
       // Continue on to push Namespc as current DeclContext and return it.
-    } 
+    }
 
     PushOnScopeChains(Namespc, DeclRegionScope);
   } else {
@@ -2357,9 +2356,9 @@
     while (CommonAncestor && !CommonAncestor->Encloses(CurContext))
       CommonAncestor = CommonAncestor->getParent();
 
-    UDir = UsingDirectiveDecl::Create(Context, 
+    UDir = UsingDirectiveDecl::Create(Context,
                                       CurContext, UsingLoc,
-                                      NamespcLoc, 
+                                      NamespcLoc,
                                       SS.getRange(),
                                       (NestedNameSpecifier *)SS.getScopeRep(),
                                       IdentLoc,
@@ -2399,20 +2398,20 @@
                                             bool IsTypeName) {
   assert((TargetName || Op) && "Invalid TargetName.");
   assert(S->getFlags() & Scope::DeclScope && "Invalid Scope.");
-  
+
   DeclarationName Name;
   if (TargetName)
     Name = TargetName;
   else
     Name = Context.DeclarationNames.getCXXOperatorName(Op);
-  
-  NamedDecl *UD = BuildUsingDeclaration(UsingLoc, SS, IdentLoc, 
+
+  NamedDecl *UD = BuildUsingDeclaration(UsingLoc, SS, IdentLoc,
                                         Name, AttrList, IsTypeName);
   if (UD) {
     PushOnScopeChains(UD, S);
     UD->setAccess(AS);
   }
-  
+
   return DeclPtrTy::make(UD);
 }
 
@@ -2427,13 +2426,13 @@
 
   // FIXME: We ignore attributes for now.
   delete AttrList;
-  
+
   if (SS.isEmpty()) {
     Diag(IdentLoc, diag::err_using_requires_qualname);
     return 0;
   }
-  
-  NestedNameSpecifier *NNS = 
+
+  NestedNameSpecifier *NNS =
     static_cast<NestedNameSpecifier *>(SS.getScopeRep());
 
   if (isUnknownSpecialization(SS)) {
@@ -2441,15 +2440,15 @@
                                        SS.getRange(), NNS,
                                        IdentLoc, Name, IsTypeName);
   }
-  
+
   DeclContext *LookupContext = 0;
-  
+
   if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(CurContext)) {
     // C++0x N2914 [namespace.udecl]p3:
     // A using-declaration used as a member-declaration shall refer to a member
     // of a base class of the class being defined, shall refer to a member of an
     // anonymous union that is a member of a base class of the class being
-    // defined, or shall refer to an enumerator for an enumeration type that is 
+    // defined, or shall refer to an enumerator for an enumeration type that is
     // a member of a base class of the class being defined.
     const Type *Ty = NNS->getAsType();
     if (!Ty || !IsDerivedFrom(Context.getTagDeclType(RD), QualType(Ty, 0))) {
@@ -2469,7 +2468,7 @@
         << SS.getRange();
       return 0;
     }
-    
+
     // C++0x N2914 [namespace.udecl]p9:
     // In a using-declaration, a prefix :: refers to the global namespace.
     if (NNS->getKind() == NestedNameSpecifier::Global)
@@ -2480,16 +2479,16 @@
 
 
   // Lookup target name.
-  LookupResult R = LookupQualifiedName(LookupContext, 
+  LookupResult R = LookupQualifiedName(LookupContext,
                                        Name, LookupOrdinaryName);
-  
+
   if (!R) {
     DiagnoseMissingMember(IdentLoc, Name, NNS, SS.getRange());
     return 0;
   }
 
   NamedDecl *ND = R.getAsDecl();
-  
+
   if (IsTypeName && !isa<TypeDecl>(ND)) {
     Diag(IdentLoc, diag::err_using_typename_non_type);
     return 0;
@@ -2502,7 +2501,7 @@
       << SS.getRange();
     return 0;
   }
-  
+
   return UsingDecl::Create(Context, CurContext, IdentLoc, SS.getRange(),
                            ND->getLocation(), UsingLoc, ND, NNS, IsTypeName);
 }
@@ -2515,26 +2514,26 @@
   return dyn_cast_or_null<NamespaceDecl>(D);
 }
 
-Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S, 
+Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,
                                              SourceLocation NamespaceLoc,
                                              SourceLocation AliasLoc,
                                              IdentifierInfo *Alias,
                                              const CXXScopeSpec &SS,
                                              SourceLocation IdentLoc,
                                              IdentifierInfo *Ident) {
-  
+
   // Lookup the namespace name.
   LookupResult R = LookupParsedName(S, &SS, Ident, LookupNamespaceName, false);
 
   // Check if we have a previous declaration with the same name.
   if (NamedDecl *PrevDecl = LookupName(S, Alias, LookupOrdinaryName, true)) {
     if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(PrevDecl)) {
-      // We already have an alias with the same name that points to the same 
+      // We already have an alias with the same name that points to the same
       // namespace, so don't create a new one.
       if (!R.isAmbiguous() && AD->getNamespace() == getNamespaceDecl(R))
         return DeclPtrTy();
     }
-    
+
     unsigned DiagID = isa<NamespaceDecl>(PrevDecl) ? diag::err_redefinition :
       diag::err_redefinition_different_kind;
     Diag(AliasLoc, DiagID) << Alias;
@@ -2546,18 +2545,18 @@
     DiagnoseAmbiguousLookup(R, Ident, IdentLoc);
     return DeclPtrTy();
   }
-  
+
   if (!R) {
     Diag(NamespaceLoc, diag::err_expected_namespace_name) << SS.getRange();
     return DeclPtrTy();
   }
-  
+
   NamespaceAliasDecl *AliasDecl =
-    NamespaceAliasDecl::Create(Context, CurContext, NamespaceLoc, AliasLoc, 
-                               Alias, SS.getRange(), 
+    NamespaceAliasDecl::Create(Context, CurContext, NamespaceLoc, AliasLoc,
+                               Alias, SS.getRange(),
                                (NestedNameSpecifier *)SS.getScopeRep(),
                                IdentLoc, R);
-  
+
   CurContext->addDecl(AliasDecl);
   return DeclPtrTy::make(AliasDecl);
 }
@@ -2567,11 +2566,11 @@
   assert((Constructor->isImplicit() && Constructor->isDefaultConstructor() &&
           !Constructor->isUsed()) &&
     "DefineImplicitDefaultConstructor - call it for implicit default ctor");
-  
+
   CXXRecordDecl *ClassDecl
     = cast<CXXRecordDecl>(Constructor->getDeclContext());
   assert(ClassDecl && "DefineImplicitDefaultConstructor - invalid constructor");
-  // Before the implicitly-declared default constructor for a class is 
+  // Before the implicitly-declared default constructor for a class is
   // implicitly defined, all the implicitly-declared default constructors
   // for its base class and its non-static data members shall have been
   // implicitly defined.
@@ -2581,14 +2580,14 @@
     CXXRecordDecl *BaseClassDecl
       = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
     if (!BaseClassDecl->hasTrivialConstructor()) {
-      if (CXXConstructorDecl *BaseCtor = 
+      if (CXXConstructorDecl *BaseCtor =
             BaseClassDecl->getDefaultConstructor(Context))
         MarkDeclarationReferenced(CurrentLocation, BaseCtor);
       else {
-        Diag(CurrentLocation, diag::err_defining_default_ctor) 
-          << Context.getTagDeclType(ClassDecl) << 1 
+        Diag(CurrentLocation, diag::err_defining_default_ctor)
+          << Context.getTagDeclType(ClassDecl) << 1
           << Context.getTagDeclType(BaseClassDecl);
-        Diag(BaseClassDecl->getLocation(), diag::note_previous_class_decl) 
+        Diag(BaseClassDecl->getLocation(), diag::note_previous_class_decl)
               << Context.getTagDeclType(BaseClassDecl);
         err = true;
       }
@@ -2603,25 +2602,25 @@
       CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
       if (!FieldClassDecl->hasTrivialConstructor()) {
-        if (CXXConstructorDecl *FieldCtor = 
+        if (CXXConstructorDecl *FieldCtor =
             FieldClassDecl->getDefaultConstructor(Context))
           MarkDeclarationReferenced(CurrentLocation, FieldCtor);
         else {
-          Diag(CurrentLocation, diag::err_defining_default_ctor) 
+          Diag(CurrentLocation, diag::err_defining_default_ctor)
           << Context.getTagDeclType(ClassDecl) << 0 <<
               Context.getTagDeclType(FieldClassDecl);
-          Diag(FieldClassDecl->getLocation(), diag::note_previous_class_decl) 
+          Diag(FieldClassDecl->getLocation(), diag::note_previous_class_decl)
           << Context.getTagDeclType(FieldClassDecl);
           err = true;
         }
       }
     } else if (FieldType->isReferenceType()) {
-      Diag(CurrentLocation, diag::err_unintialized_member) 
+      Diag(CurrentLocation, diag::err_unintialized_member)
         << Context.getTagDeclType(ClassDecl) << 0 << Field->getDeclName();
       Diag((*Field)->getLocation(), diag::note_declared_at);
       err = true;
     } else if (FieldType.isConstQualified()) {
-      Diag(CurrentLocation, diag::err_unintialized_member) 
+      Diag(CurrentLocation, diag::err_unintialized_member)
         << Context.getTagDeclType(ClassDecl) << 1 << Field->getDeclName();
        Diag((*Field)->getLocation(), diag::note_declared_at);
       err = true;
@@ -2637,12 +2636,12 @@
                                     CXXDestructorDecl *Destructor) {
   assert((Destructor->isImplicit() && !Destructor->isUsed()) &&
          "DefineImplicitDestructor - call it for implicit default dtor");
-  
+
   CXXRecordDecl *ClassDecl
   = cast<CXXRecordDecl>(Destructor->getDeclContext());
   assert(ClassDecl && "DefineImplicitDestructor - invalid destructor");
   // C++ [class.dtor] p5
-  // Before the implicitly-declared default destructor for a class is 
+  // Before the implicitly-declared default destructor for a class is
   // implicitly defined, all the implicitly-declared default destructors
   // for its base class and its non-static data members shall have been
   // implicitly defined.
@@ -2651,15 +2650,15 @@
     CXXRecordDecl *BaseClassDecl
       = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
     if (!BaseClassDecl->hasTrivialDestructor()) {
-      if (CXXDestructorDecl *BaseDtor = 
+      if (CXXDestructorDecl *BaseDtor =
           const_cast<CXXDestructorDecl*>(BaseClassDecl->getDestructor(Context)))
         MarkDeclarationReferenced(CurrentLocation, BaseDtor);
       else
-        assert(false && 
+        assert(false &&
                "DefineImplicitDestructor - missing dtor in a base class");
     }
   }
-  
+
   for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
        E = ClassDecl->field_end(); Field != E; ++Field) {
     QualType FieldType = Context.getCanonicalType((*Field)->getType());
@@ -2669,12 +2668,12 @@
       CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
       if (!FieldClassDecl->hasTrivialDestructor()) {
-        if (CXXDestructorDecl *FieldDtor = 
+        if (CXXDestructorDecl *FieldDtor =
             const_cast<CXXDestructorDecl*>(
                                         FieldClassDecl->getDestructor(Context)))
           MarkDeclarationReferenced(CurrentLocation, FieldDtor);
         else
-          assert(false && 
+          assert(false &&
           "DefineImplicitDestructor - missing dtor in class of a data member");
       }
     }
@@ -2688,10 +2687,10 @@
           MethodDecl->getOverloadedOperator() == OO_Equal &&
           !MethodDecl->isUsed()) &&
          "DefineImplicitOverloadedAssign - call it for implicit assignment op");
-  
+
   CXXRecordDecl *ClassDecl
     = cast<CXXRecordDecl>(MethodDecl->getDeclContext());
-  
+
   // C++[class.copy] p12
   // Before the implicitly-declared copy assignment operator for a class is
   // implicitly defined, all implicitly-declared copy assignment operators
@@ -2702,7 +2701,7 @@
        E = ClassDecl->bases_end(); Base != E; ++Base) {
     CXXRecordDecl *BaseClassDecl
       = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
-    if (CXXMethodDecl *BaseAssignOpMethod = 
+    if (CXXMethodDecl *BaseAssignOpMethod =
           getAssignOperatorMethod(MethodDecl->getParamDecl(0), BaseClassDecl))
       MarkDeclarationReferenced(CurrentLocation, BaseAssignOpMethod);
   }
@@ -2714,17 +2713,17 @@
     if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
       CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
-      if (CXXMethodDecl *FieldAssignOpMethod = 
+      if (CXXMethodDecl *FieldAssignOpMethod =
           getAssignOperatorMethod(MethodDecl->getParamDecl(0), FieldClassDecl))
         MarkDeclarationReferenced(CurrentLocation, FieldAssignOpMethod);
     } else if (FieldType->isReferenceType()) {
-      Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign) 
+      Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign)
       << Context.getTagDeclType(ClassDecl) << 0 << Field->getDeclName();
       Diag(Field->getLocation(), diag::note_declared_at);
       Diag(CurrentLocation, diag::note_first_required_here);
       err = true;
     } else if (FieldType.isConstQualified()) {
-      Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign) 
+      Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign)
       << Context.getTagDeclType(ClassDecl) << 1 << Field->getDeclName();
       Diag(Field->getLocation(), diag::note_declared_at);
       Diag(CurrentLocation, diag::note_first_required_here);
@@ -2732,7 +2731,7 @@
     }
   }
   if (!err)
-    MethodDecl->setUsed();    
+    MethodDecl->setUsed();
 }
 
 CXXMethodDecl *
@@ -2741,24 +2740,24 @@
   QualType LHSType = Context.getTypeDeclType(ClassDecl);
   QualType RHSType(LHSType);
   // If class's assignment operator argument is const/volatile qualified,
-  // look for operator = (const/volatile B&). Otherwise, look for 
+  // look for operator = (const/volatile B&). Otherwise, look for
   // operator = (B&).
   if (ParmDecl->getType().isConstQualified())
     RHSType.addConst();
   if (ParmDecl->getType().isVolatileQualified())
     RHSType.addVolatile();
-  ExprOwningPtr<Expr> LHS(this,  new (Context) DeclRefExpr(ParmDecl, 
-                                                          LHSType, 
+  ExprOwningPtr<Expr> LHS(this,  new (Context) DeclRefExpr(ParmDecl,
+                                                          LHSType,
                                                           SourceLocation()));
-  ExprOwningPtr<Expr> RHS(this,  new (Context) DeclRefExpr(ParmDecl, 
-                                                          RHSType, 
+  ExprOwningPtr<Expr> RHS(this,  new (Context) DeclRefExpr(ParmDecl,
+                                                          RHSType,
                                                           SourceLocation()));
   Expr *Args[2] = { &*LHS, &*RHS };
   OverloadCandidateSet CandidateSet;
-  AddMemberOperatorCandidates(clang::OO_Equal, SourceLocation(), Args, 2, 
+  AddMemberOperatorCandidates(clang::OO_Equal, SourceLocation(), Args, 2,
                               CandidateSet);
   OverloadCandidateSet::iterator Best;
-  if (BestViableFunction(CandidateSet, 
+  if (BestViableFunction(CandidateSet,
                          ClassDecl->getLocation(), Best) == OR_Success)
     return cast<CXXMethodDecl>(Best->Function);
   assert(false &&
@@ -2769,16 +2768,16 @@
 void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
                                    CXXConstructorDecl *CopyConstructor,
                                    unsigned TypeQuals) {
-  assert((CopyConstructor->isImplicit() && 
+  assert((CopyConstructor->isImplicit() &&
           CopyConstructor->isCopyConstructor(Context, TypeQuals) &&
           !CopyConstructor->isUsed()) &&
          "DefineImplicitCopyConstructor - call it for implicit copy ctor");
-  
+
   CXXRecordDecl *ClassDecl
     = cast<CXXRecordDecl>(CopyConstructor->getDeclContext());
   assert(ClassDecl && "DefineImplicitCopyConstructor - invalid constructor");
   // C++ [class.copy] p209
-  // Before the implicitly-declared copy constructor for a class is 
+  // Before the implicitly-declared copy constructor for a class is
   // implicitly defined, all the implicitly-declared copy constructors
   // for its base class and its non-static data members shall have been
   // implicitly defined.
@@ -2786,7 +2785,7 @@
        Base != ClassDecl->bases_end(); ++Base) {
     CXXRecordDecl *BaseClassDecl
       = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
-    if (CXXConstructorDecl *BaseCopyCtor = 
+    if (CXXConstructorDecl *BaseCopyCtor =
         BaseClassDecl->getCopyConstructor(Context, TypeQuals))
       MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor);
   }
@@ -2799,7 +2798,7 @@
     if (const RecordType *FieldClassType = FieldType->getAs<RecordType>()) {
       CXXRecordDecl *FieldClassDecl
         = cast<CXXRecordDecl>(FieldClassType->getDecl());
-      if (CXXConstructorDecl *FieldCopyCtor = 
+      if (CXXConstructorDecl *FieldCopyCtor =
           FieldClassDecl->getCopyConstructor(Context, TypeQuals))
         MarkDeclarationReferenced(CurrentLocation, FieldCopyCtor);
     }
@@ -2809,28 +2808,28 @@
 
 Sema::OwningExprResult
 Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
-                            CXXConstructorDecl *Constructor, 
+                            CXXConstructorDecl *Constructor,
                             MultiExprArg ExprArgs) {
   bool Elidable = false;
-  
+
   // [class.copy]p15:
-  // Whenever a temporary class object is copied using a copy constructor, and 
-  // this object and the copy have the same cv-unqualified type, an 
+  // Whenever a temporary class object is copied using a copy constructor, and
+  // this object and the copy have the same cv-unqualified type, an
   // implementation is permitted to treat the original and the copy as two
   // different ways of referring to the same object and not perform a copy at
   //all, even if the class copy constructor or destructor have side effects.
-  
+
   // FIXME: Is this enough?
   if (Constructor->isCopyConstructor(Context) && ExprArgs.size() == 1) {
     Expr *E = ((Expr **)ExprArgs.get())[0];
     while (CXXBindTemporaryExpr *BE = dyn_cast<CXXBindTemporaryExpr>(E))
       E = BE->getSubExpr();
-    
+
     if (isa<CallExpr>(E) || isa<CXXTemporaryObjectExpr>(E))
       Elidable = true;
   }
-  
-  return BuildCXXConstructExpr(ConstructLoc, DeclInitType, Constructor, 
+
+  return BuildCXXConstructExpr(ConstructLoc, DeclInitType, Constructor,
                                Elidable, move(ExprArgs));
 }
 
@@ -2839,52 +2838,52 @@
                             CXXConstructExpr *E) {
   CXXConstructorDecl *Ctor = E->getConstructor();
   const FunctionProtoType *Proto = Ctor->getType()->getAsFunctionProtoType();
-  
+
   unsigned NumArgs = E->getNumArgs();
   unsigned NumArgsInProto = Proto->getNumArgs();
   unsigned NumRequiredArgs = Ctor->getMinRequiredArguments();
-  
+
   for (unsigned i = 0; i != NumArgsInProto; ++i) {
     QualType ProtoArgType = Proto->getArgType(i);
 
     Expr *Arg;
-    
+
     if (i < NumRequiredArgs) {
       Arg = E->getArg(i);
-      
+
       // Pass the argument.
       // FIXME: Do this.
     } else {
       // Build a default argument.
       ParmVarDecl *Param = Ctor->getParamDecl(i);
-      
-      Sema::OwningExprResult ArgExpr = 
+
+      Sema::OwningExprResult ArgExpr =
         SemaRef.BuildCXXDefaultArgExpr(ConstructLoc, Ctor, Param);
       if (ArgExpr.isInvalid())
         return true;
 
       Arg = ArgExpr.takeAs<Expr>();
     }
-    
+
     E->setArg(i, Arg);
   }
 
   // If this is a variadic call, handle args passed through "...".
   if (Proto->isVariadic()) {
     bool Invalid = false;
-    
+
     // Promote the arguments (C99 6.5.2.2p7).
     for (unsigned i = NumArgsInProto; i != NumArgs; i++) {
       Expr *Arg = E->getArg(i);
-      Invalid |= 
-        SemaRef.DefaultVariadicArgumentPromotion(Arg, 
+      Invalid |=
+        SemaRef.DefaultVariadicArgumentPromotion(Arg,
                                                  Sema::VariadicConstructor);
       E->setArg(i, Arg);
     }
-    
+
     return Invalid;
   }
-  
+
   return false;
 }
 
@@ -2896,15 +2895,15 @@
                             MultiExprArg ExprArgs) {
   unsigned NumExprs = ExprArgs.size();
   Expr **Exprs = (Expr **)ExprArgs.release();
-  
-  ExprOwningPtr<CXXConstructExpr> Temp(this, 
-                                       CXXConstructExpr::Create(Context, 
-                                                                DeclInitType, 
-                                                                Constructor, 
+
+  ExprOwningPtr<CXXConstructExpr> Temp(this,
+                                       CXXConstructExpr::Create(Context,
+                                                                DeclInitType,
+                                                                Constructor,
                                                                 Elidable,
                                                                 Exprs,
                                                                 NumExprs));
-  
+
   if (CheckConstructArgumentTypes(*this, ConstructLoc, Temp.get()))
     return ExprError();
 
@@ -2912,16 +2911,16 @@
 }
 
 Sema::OwningExprResult
-Sema::BuildCXXTemporaryObjectExpr(CXXConstructorDecl *Constructor, 
-                                  QualType Ty, 
-                                  SourceLocation TyBeginLoc, 
+Sema::BuildCXXTemporaryObjectExpr(CXXConstructorDecl *Constructor,
+                                  QualType Ty,
+                                  SourceLocation TyBeginLoc,
                                   MultiExprArg Args,
                                   SourceLocation RParenLoc) {
-  CXXTemporaryObjectExpr *E 
-    = new (Context) CXXTemporaryObjectExpr(Context, Constructor, Ty, TyBeginLoc, 
+  CXXTemporaryObjectExpr *E
+    = new (Context) CXXTemporaryObjectExpr(Context, Constructor, Ty, TyBeginLoc,
                                            (Expr **)Args.get(),
                                            Args.size(), RParenLoc);
-  
+
   ExprOwningPtr<CXXTemporaryObjectExpr> Temp(this, E);
 
   if (CheckConstructArgumentTypes(*this, TyBeginLoc, Temp.get()))
@@ -2931,35 +2930,34 @@
 }
 
 
-bool Sema::InitializeVarWithConstructor(VarDecl *VD, 
+bool Sema::InitializeVarWithConstructor(VarDecl *VD,
                                         CXXConstructorDecl *Constructor,
-                                        QualType DeclInitType, 
+                                        QualType DeclInitType,
                                         MultiExprArg Exprs) {
-  OwningExprResult TempResult = 
-    BuildCXXConstructExpr(VD->getLocation(), DeclInitType, Constructor, 
+  OwningExprResult TempResult =
+    BuildCXXConstructExpr(VD->getLocation(), DeclInitType, Constructor,
                           move(Exprs));
   if (TempResult.isInvalid())
     return true;
-  
+
   Expr *Temp = TempResult.takeAs<Expr>();
   MarkDeclarationReferenced(VD->getLocation(), Constructor);
   Temp = MaybeCreateCXXExprWithTemporaries(Temp, /*DestroyTemps=*/true);
   VD->setInit(Context, Temp);
-  
+
   return false;
 }
 
-void Sema::FinalizeVarWithDestructor(VarDecl *VD, QualType DeclInitType)
-{
+void Sema::FinalizeVarWithDestructor(VarDecl *VD, QualType DeclInitType) {
   CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(
                                   DeclInitType->getAs<RecordType>()->getDecl());
   if (!ClassDecl->hasTrivialDestructor())
-    if (CXXDestructorDecl *Destructor = 
+    if (CXXDestructorDecl *Destructor =
         const_cast<CXXDestructorDecl*>(ClassDecl->getDestructor(Context)))
       MarkDeclarationReferenced(VD->getLocation(), Destructor);
 }
 
-/// AddCXXDirectInitializerToDecl - This action is called immediately after 
+/// AddCXXDirectInitializerToDecl - This action is called immediately after
 /// ActOnDeclarator, when a C++ direct initializer is present.
 /// e.g: "int x(1);"
 void Sema::AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
@@ -2975,7 +2973,7 @@
   // the initializer.
   if (RealDecl == 0)
     return;
-  
+
   VarDecl *VDecl = dyn_cast<VarDecl>(RealDecl);
   if (!VDecl) {
     Diag(RealDecl->getLocation(), diag::err_illegal_initializer);
@@ -3000,16 +2998,16 @@
       Expr::hasAnyTypeDependentArguments((Expr **)Exprs.get(), Exprs.size())) {
     // Let clients know that initialization was done with a direct initializer.
     VDecl->setCXXDirectInitializer(true);
-    
+
     // Store the initialization expressions as a ParenListExpr.
     unsigned NumExprs = Exprs.size();
-    VDecl->setInit(Context, 
+    VDecl->setInit(Context,
                    new (Context) ParenListExpr(Context, LParenLoc,
                                                (Expr **)Exprs.release(),
                                                NumExprs, RParenLoc));
     return;
   }
-    
+
 
   // C++ 8.5p11:
   // The form of initialization (using parentheses or '=') is generally
@@ -3039,7 +3037,7 @@
       RealDecl->setInvalidDecl();
     else {
       VDecl->setCXXDirectInitializer(true);
-      if (InitializeVarWithConstructor(VDecl, Constructor, DeclInitType, 
+      if (InitializeVarWithConstructor(VDecl, Constructor, DeclInitType,
                                        move(Exprs)))
         RealDecl->setInvalidDecl();
       FinalizeVarWithDestructor(VDecl, DeclInitType);
@@ -3086,7 +3084,7 @@
   const RecordType *ClassRec = ClassType->getAs<RecordType>();
   assert(ClassRec && "Can only initialize a class type here");
 
-  // C++ [dcl.init]p14: 
+  // C++ [dcl.init]p14:
   //
   //   If the initialization is direct-initialization, or if it is
   //   copy-initialization where the cv-unqualified version of the
@@ -3102,7 +3100,7 @@
   OverloadCandidateSet CandidateSet;
 
   // Add constructors to the overload set.
-  DeclarationName ConstructorName 
+  DeclarationName ConstructorName
     = Context.DeclarationNames.getCXXConstructorName(
                        Context.getCanonicalType(ClassType.getUnqualifiedType()));
   DeclContext::lookup_const_iterator Con, ConEnd;
@@ -3112,17 +3110,17 @@
     CXXConstructorDecl *Constructor = 0;
     FunctionTemplateDecl *ConstructorTmpl= dyn_cast<FunctionTemplateDecl>(*Con);
     if (ConstructorTmpl)
-      Constructor 
+      Constructor
         = cast<CXXConstructorDecl>(ConstructorTmpl->getTemplatedDecl());
     else
       Constructor = cast<CXXConstructorDecl>(*Con);
 
     if ((Kind == IK_Direct) ||
-        (Kind == IK_Copy && 
+        (Kind == IK_Copy &&
          Constructor->isConvertingConstructor(/*AllowExplicit=*/false)) ||
         (Kind == IK_Default && Constructor->isDefaultConstructor())) {
       if (ConstructorTmpl)
-        AddTemplateOverloadCandidate(ConstructorTmpl, false, 0, 0, 
+        AddTemplateOverloadCandidate(ConstructorTmpl, false, 0, 0,
                                      Args, NumArgs, CandidateSet);
       else
         AddOverloadCandidate(Constructor, Args, NumArgs, CandidateSet);
@@ -3137,7 +3135,7 @@
   case OR_Success:
     // We found a constructor. Return it.
     return cast<CXXConstructorDecl>(Best->Function);
-    
+
   case OR_No_Viable_Function:
     if (InitEntity)
       Diag(Loc, diag::err_ovl_no_viable_function_in_init)
@@ -3147,7 +3145,7 @@
         << ClassType << Range;
     PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
     return 0;
-    
+
   case OR_Ambiguous:
     if (InitEntity)
       Diag(Loc, diag::err_ovl_ambiguous_init) << InitEntity << Range;
@@ -3168,7 +3166,7 @@
     PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
     return 0;
   }
-  
+
   return 0;
 }
 
@@ -3179,8 +3177,8 @@
 /// reference (C++ [dcl.ref.init]p4). Neither type can be a reference
 /// type, and the first type (T1) is the pointee type of the reference
 /// type being initialized.
-Sema::ReferenceCompareResult 
-Sema::CompareReferenceRelationship(QualType T1, QualType T2, 
+Sema::ReferenceCompareResult
+Sema::CompareReferenceRelationship(QualType T1, QualType T2,
                                    bool& DerivedToBase) {
   assert(!T1->isReferenceType() &&
     "T1 must be the pointee type of the reference type");
@@ -3193,7 +3191,7 @@
 
   // C++ [dcl.init.ref]p4:
   //   Given types "cv1 T1" and "cv2 T2," "cv1 T1" is
-  //   reference-related to "cv2 T2" if T1 is the same type as T2, or 
+  //   reference-related to "cv2 T2" if T1 is the same type as T2, or
   //   T1 is a base class of T2.
   if (UnqualT1 == UnqualT2)
     DerivedToBase = false;
@@ -3236,7 +3234,7 @@
 /// When @p AllowExplicit, we also permit explicit user-defined
 /// conversion functions.
 /// When @p ForceRValue, we unconditionally treat the initializer as an rvalue.
-bool 
+bool
 Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
                          bool SuppressUserConversions,
                          bool AllowExplicit, bool ForceRValue,
@@ -3250,7 +3248,7 @@
   // to resolve the overloaded function. If all goes well, T2 is the
   // type of the resulting function.
   if (Context.getCanonicalType(T2) == Context.OverloadTy) {
-    FunctionDecl *Fn = ResolveAddressOfOverloadedFunction(Init, DeclType, 
+    FunctionDecl *Fn = ResolveAddressOfOverloadedFunction(Init, DeclType,
                                                           ICS != 0);
     if (Fn) {
       // Since we're performing this reference-initialization for
@@ -3271,7 +3269,7 @@
   bool DerivedToBase = false;
   Expr::isLvalueResult InitLvalue = ForceRValue ? Expr::LV_InvalidExpression :
                                                   Init->isLvalue(Context);
-  ReferenceCompareResult RefRelationship 
+  ReferenceCompareResult RefRelationship
     = CompareReferenceRelationship(T1, T2, DerivedToBase);
 
   // Most paths end in a failed conversion.
@@ -3334,7 +3332,7 @@
       // Perform the conversion.
       // FIXME: Binding to a subobject of the lvalue is going to require more
       // AST annotation than this.
-      ImpCastExprToType(Init, T1, CastExpr::CK_Unknown, /*isLvalue=*/true);    
+      ImpCastExprToType(Init, T1, CastExpr::CK_Unknown, /*isLvalue=*/true);
     }
   }
 
@@ -3347,16 +3345,16 @@
   if (!isRValRef && !SuppressUserConversions && T2->isRecordType() &&
       !RequireCompleteType(SourceLocation(), T2, 0)) {
     // FIXME: Look for conversions in base classes!
-    CXXRecordDecl *T2RecordDecl 
+    CXXRecordDecl *T2RecordDecl
       = dyn_cast<CXXRecordDecl>(T2->getAs<RecordType>()->getDecl());
 
     OverloadCandidateSet CandidateSet;
-    OverloadedFunctionDecl *Conversions 
+    OverloadedFunctionDecl *Conversions
       = T2RecordDecl->getConversionFunctions();
-    for (OverloadedFunctionDecl::function_iterator Func 
+    for (OverloadedFunctionDecl::function_iterator Func
            = Conversions->function_begin();
          Func != Conversions->function_end(); ++Func) {
-      FunctionTemplateDecl *ConvTemplate 
+      FunctionTemplateDecl *ConvTemplate
         = dyn_cast<FunctionTemplateDecl>(*Func);
       CXXConversionDecl *Conv;
       if (ConvTemplate)
@@ -3369,7 +3367,7 @@
       if (Conv->getConversionType()->isLValueReferenceType() &&
           (AllowExplicit || !Conv->isExplicit())) {
         if (ConvTemplate)
-          AddTemplateConversionCandidate(ConvTemplate, Init, DeclType, 
+          AddTemplateConversionCandidate(ConvTemplate, Init, DeclType,
                                          CandidateSet);
         else
           AddConversionCandidate(Conv, Init, DeclType, CandidateSet);
@@ -3412,7 +3410,7 @@
     case OR_Ambiguous:
       assert(false && "Ambiguous reference binding conversions not implemented.");
       return true;
-      
+
     case OR_No_Viable_Function:
     case OR_Deleted:
       // There was no suitable conversion, or we found a deleted
@@ -3420,7 +3418,7 @@
       break;
     }
   }
-      
+
   if (BindsDirectly) {
     // C++ [dcl.init.ref]p4:
     //   [...] In all cases where the reference-related or
@@ -3434,8 +3432,8 @@
     // complain about errors, because we should not be checking for
     // ambiguity (or inaccessibility) unless the reference binding
     // actually happens.
-    if (DerivedToBase) 
-      return CheckDerivedToBaseConversion(T2, T1, 
+    if (DerivedToBase)
+      return CheckDerivedToBaseConversion(T2, T1,
                                           Init->getSourceRange().getBegin(),
                                           Init->getSourceRange());
     else
@@ -3535,7 +3533,7 @@
   // Actually try to convert the initializer to T1.
   if (ICS) {
     // C++ [over.ics.ref]p2:
-    // 
+    //
     //   When a parameter of reference type is not bound directly to
     //   an argument expression, the conversion sequence is the one
     //   required to convert the argument expression to the
@@ -3549,12 +3547,12 @@
                                  /*AllowExplicit=*/false,
                                  /*ForceRValue=*/false,
                                  /*InOverloadResolution=*/false);
-    
+
     // Of course, that's still a reference binding.
     if (ICS->ConversionKind == ImplicitConversionSequence::StandardConversion) {
       ICS->Standard.ReferenceBinding = true;
       ICS->Standard.RRefBinding = isRValRef;
-    } else if(ICS->ConversionKind ==
+    } else if (ICS->ConversionKind ==
               ImplicitConversionSequence::UserDefinedConversion) {
       ICS->UserDefined.After.ReferenceBinding = true;
       ICS->UserDefined.After.RRefBinding = isRValRef;
@@ -3574,7 +3572,7 @@
 
   OverloadedOperatorKind Op = FnDecl->getOverloadedOperator();
 
-  // C++ [over.oper]p5: 
+  // C++ [over.oper]p5:
   //   The allocation and deallocation functions, operator new,
   //   operator new[], operator delete and operator delete[], are
   //   described completely in 3.7.3. The attributes and restrictions
@@ -3617,13 +3615,13 @@
   //   An operator function cannot have default arguments (8.3.6),
   //   except where explicitly stated below.
   //
-  // Only the function-call operator allows default arguments 
+  // Only the function-call operator allows default arguments
   // (C++ [over.call]p1).
   if (Op != OO_Call) {
     for (FunctionDecl::param_iterator Param = FnDecl->param_begin();
          Param != FnDecl->param_end(); ++Param) {
       if ((*Param)->hasUnparsedDefaultArg())
-        return Diag((*Param)->getLocation(), 
+        return Diag((*Param)->getLocation(),
                     diag::err_operator_overload_default_arg)
           << FnDecl->getDeclName();
       else if (Expr *DefArg = (*Param)->getDefaultArg())
@@ -3648,7 +3646,7 @@
   //   [...] Operator functions cannot have more or fewer parameters
   //   than the number required for the corresponding operator, as
   //   described in the rest of this subclause.
-  unsigned NumParams = FnDecl->getNumParams() 
+  unsigned NumParams = FnDecl->getNumParams()
                      + (isa<CXXMethodDecl>(FnDecl)? 1 : 0);
   if (Op != OO_Call &&
       ((NumParams == 1 && !CanBeUnaryOperator) ||
@@ -3702,7 +3700,7 @@
 
     if (!ParamIsInt)
       return Diag(LastParam->getLocation(),
-                  diag::err_operator_overload_post_incdec_must_be_int) 
+                  diag::err_operator_overload_post_incdec_must_be_int)
         << LastParam->getType() << (Op == OO_MinusMinus);
   }
 
@@ -3741,11 +3739,11 @@
     Diag(LangLoc, diag::err_bad_language);
     return DeclPtrTy();
   }
-  
+
   // FIXME: Add all the various semantics of linkage specifications
-  
+
   LinkageSpecDecl *D = LinkageSpecDecl::Create(Context, CurContext,
-                                               LangLoc, Language, 
+                                               LangLoc, Language,
                                                LBraceLoc.isValid());
   CurContext->addDecl(D);
   PushDeclContext(S, D);
@@ -3784,7 +3782,7 @@
   // The exception-declaration shall not denote a pointer or reference to an
   // incomplete type, other than [cv] void*.
   // N2844 forbids rvalue references.
-  if(!ExDeclType->isDependentType() && ExDeclType->isRValueReferenceType()) {
+  if (!ExDeclType->isDependentType() && ExDeclType->isRValueReferenceType()) {
     Diag(Loc, diag::err_catch_rvalue_ref) << Range;
     Invalid = true;
   }
@@ -3796,7 +3794,7 @@
     BaseType = Ptr->getPointeeType();
     Mode = 1;
     DK = diag::err_catch_incomplete_ptr;
-  } else if(const ReferenceType *Ref = BaseType->getAs<ReferenceType>()) {
+  } else if (const ReferenceType *Ref = BaseType->getAs<ReferenceType>()) {
     // For the purpose of error recovery, we treat rvalue refs like lvalue refs.
     BaseType = Ref->getPointeeType();
     Mode = 2;
@@ -3806,7 +3804,7 @@
       !BaseType->isDependentType() && RequireCompleteType(Loc, BaseType, DK))
     Invalid = true;
 
-  if (!Invalid && !ExDeclType->isDependentType() && 
+  if (!Invalid && !ExDeclType->isDependentType() &&
       RequireNonAbstractType(Loc, ExDeclType,
                              diag::err_abstract_type_in_decl,
                              AbstractVariableType))
@@ -3817,7 +3815,7 @@
 
   // FIXME: Need to check for abstract classes.
 
-  VarDecl *ExDecl = VarDecl::Create(Context, CurContext, Loc, 
+  VarDecl *ExDecl = VarDecl::Create(Context, CurContext, Loc,
                                     Name, ExDeclType, DInfo, VarDecl::None);
 
   if (Invalid)
@@ -3857,7 +3855,7 @@
 
   if (Invalid)
     ExDecl->setInvalidDecl();
-  
+
   // Add the exception declaration into this scope.
   if (II)
     PushOnScopeChains(ExDecl, S);
@@ -3868,11 +3866,11 @@
   return DeclPtrTy::make(ExDecl);
 }
 
-Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc, 
+Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
                                                    ExprArg assertexpr,
                                                    ExprArg assertmessageexpr) {
   Expr *AssertExpr = (Expr *)assertexpr.get();
-  StringLiteral *AssertMessage = 
+  StringLiteral *AssertMessage =
     cast<StringLiteral>((Expr *)assertmessageexpr.get());
 
   if (!AssertExpr->isTypeDependent() && !AssertExpr->isValueDependent()) {
@@ -3884,18 +3882,18 @@
     }
 
     if (Value == 0) {
-      std::string str(AssertMessage->getStrData(), 
+      std::string str(AssertMessage->getStrData(),
                       AssertMessage->getByteLength());
-      Diag(AssertLoc, diag::err_static_assert_failed) 
+      Diag(AssertLoc, diag::err_static_assert_failed)
         << str << AssertExpr->getSourceRange();
     }
   }
-  
+
   assertexpr.release();
   assertmessageexpr.release();
-  Decl *Decl = StaticAssertDecl::Create(Context, CurContext, AssertLoc, 
+  Decl *Decl = StaticAssertDecl::Create(Context, CurContext, AssertLoc,
                                         AssertExpr, AssertMessage);
-  
+
   CurContext->addDecl(Decl);
   return DeclPtrTy::make(Decl);
 }
@@ -3944,7 +3942,7 @@
     }else {
       Diag(DS.getFriendSpecLoc(), diag::err_unexpected_friend)
           << DS.getSourceRange();
-      return DeclPtrTy();      
+      return DeclPtrTy();
     }
   }
 
@@ -4160,7 +4158,7 @@
   // Add the function declaration to the appropriate lookup tables,
   // adjusting the redeclarations list as necessary.  We don't
   // want to do this yet if the friending class is dependent.
-  // 
+  //
   // Also update the scope-based lookup if the target context's
   // lookup context is in lexical scope.
   if (!CurContext->isDependentContext()) {
@@ -4181,7 +4179,7 @@
 
 void Sema::SetDeclDeleted(DeclPtrTy dcl, SourceLocation DelLoc) {
   AdjustDeclIfTemplate(dcl);
-  
+
   Decl *Dcl = dcl.getAs<Decl>();
   FunctionDecl *Fn = dyn_cast<FunctionDecl>(Dcl);
   if (!Fn) {
@@ -4218,7 +4216,7 @@
   }
 }
 
-bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New, 
+bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
                                              const CXXMethodDecl *Old) {
   QualType NewTy = New->getType()->getAsFunctionType()->getResultType();
   QualType OldTy = Old->getType()->getAsFunctionType()->getResultType();
@@ -4226,13 +4224,13 @@
   QualType CNewTy = Context.getCanonicalType(NewTy);
   QualType COldTy = Context.getCanonicalType(OldTy);
 
-  if (CNewTy == COldTy && 
+  if (CNewTy == COldTy &&
       CNewTy.getCVRQualifiers() == COldTy.getCVRQualifiers())
     return false;
-  
+
   // Check if the return types are covariant
   QualType NewClassTy, OldClassTy;
-  
+
   /// Both types must be pointers or references to classes.
   if (PointerType *NewPT = dyn_cast<PointerType>(NewTy)) {
     if (PointerType *OldPT = dyn_cast<PointerType>(OldTy)) {
@@ -4245,14 +4243,14 @@
       OldClassTy = OldRT->getPointeeType();
     }
   }
-  
+
   // The return types aren't either both pointers or references to a class type.
   if (NewClassTy.isNull()) {
-    Diag(New->getLocation(), 
+    Diag(New->getLocation(),
          diag::err_different_return_type_for_overriding_virtual_function)
       << New->getDeclName() << NewTy << OldTy;
     Diag(Old->getLocation(), diag::note_overridden_virtual_function);
-    
+
     return true;
   }
 
@@ -4265,9 +4263,9 @@
       Diag(Old->getLocation(), diag::note_overridden_virtual_function);
       return true;
     }
-    
+
     // Check if we the conversion from derived to base is valid.
-    if (CheckDerivedToBaseConversion(NewClassTy, OldClassTy, 
+    if (CheckDerivedToBaseConversion(NewClassTy, OldClassTy,
                       diag::err_covariant_return_inaccessible_base,
                       diag::err_covariant_return_ambiguous_derived_to_base_conv,
                       // FIXME: Should this point to the return type?
@@ -4276,7 +4274,7 @@
       return true;
     }
   }
-  
+
   // The qualifiers of the return types must be the same.
   if (CNewTy.getCVRQualifiers() != COldTy.getCVRQualifiers()) {
     Diag(New->getLocation(),
@@ -4285,7 +4283,7 @@
     Diag(Old->getLocation(), diag::note_overridden_virtual_function);
     return true;
   };
-  
+
 
   // The new class type must have the same or less qualifiers as the old type.
   if (NewClassTy.isMoreQualifiedThan(OldClassTy)) {
@@ -4295,13 +4293,12 @@
     Diag(Old->getLocation(), diag::note_overridden_virtual_function);
     return true;
   };
-  
+
   return false;
 }
 
 bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New,
-                                                const CXXMethodDecl *Old)
-{
+                                                const CXXMethodDecl *Old) {
   return CheckExceptionSpecSubset(diag::err_override_exception_spec,
                                   diag::note_overridden_virtual_function,
                                   Old->getType()->getAsFunctionProtoType(),
@@ -4317,7 +4314,7 @@
 /// class X.
 void Sema::ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl) {
   AdjustDeclIfTemplate(Dcl);
-  
+
   Decl *D = Dcl.getAs<Decl>();
   // If there is no declaration, there was an error parsing it.
   if (D == 0)
@@ -4327,13 +4324,13 @@
   // int foo::bar;
   if (!D->isOutOfLine())
     return;
-  
+
   // C++ [basic.lookup.unqual]p13
   //
   // A name used in the definition of a static data member of class X
   // (after the qualified-id of the static member) is looked up as if the name
   // was used in a member function of X.
-  
+
   // Change current context into the context of the initializing declaration.
   EnterDeclaratorContext(S, D->getDeclContext());
 }
@@ -4342,7 +4339,7 @@
 /// initializer for the declaration 'Dcl'.
 void Sema::ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl) {
   AdjustDeclIfTemplate(Dcl);
-  
+
   Decl *D = Dcl.getAs<Decl>();
   // If there is no declaration, there was an error parsing it.
   if (D == 0)

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Sep  9 10:08:12 2009
@@ -28,7 +28,7 @@
     if (property->getType()->isObjCObjectPointerType())
       result = CheckAssignmentConstraints(GetterMethod->getResultType(), property->getType());
     if (result != Compatible) {
-      Diag(Loc, diag::warn_accessor_property_type_mismatch) 
+      Diag(Loc, diag::warn_accessor_property_type_mismatch)
         << property->getDeclName()
         << GetterMethod->getSelector();
       Diag(GetterMethod->getLocation(), diag::note_declared_at);
@@ -43,7 +43,7 @@
 void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) {
   assert(getCurMethodDecl() == 0 && "Method parsing confused");
   ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>(D.getAs<Decl>());
-  
+
   // If we don't have a valid method decl, simply return.
   if (!MDecl)
     return;
@@ -55,7 +55,7 @@
     AddInstanceMethodToGlobalPool(MDecl);
   else
     AddFactoryMethodToGlobalPool(MDecl);
-  
+
   // Allow all of Sema to see that we are entering a method definition.
   PushDeclContext(FnBodyScope, MDecl);
 
@@ -64,7 +64,7 @@
 
   // Insert the invisible arguments, self and _cmd!
   MDecl->createImplicitParams(Context, MDecl->getClassInterface());
-  
+
   PushOnScopeChains(MDecl->getSelfDecl(), FnBodyScope);
   PushOnScopeChains(MDecl->getCmdDecl(), FnBodyScope);
 
@@ -82,7 +82,7 @@
                          const DeclPtrTy *ProtoRefs, unsigned NumProtoRefs,
                          SourceLocation EndProtoLoc, AttributeList *AttrList) {
   assert(ClassName && "Missing class identifier");
-  
+
   // Check for another declaration kind with the same name.
   NamedDecl *PrevDecl = LookupName(TUScope, ClassName, LookupOrdinaryName);
   if (PrevDecl && PrevDecl->isTemplateParameter()) {
@@ -96,7 +96,7 @@
     Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
     Diag(PrevDecl->getLocation(), diag::note_previous_definition);
   }
-  
+
   ObjCInterfaceDecl* IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
   if (IDecl) {
     // Class already seen. Is it a forward declaration?
@@ -113,14 +113,14 @@
       IDecl->setForwardDecl(false);
     }
   } else {
-    IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtInterfaceLoc, 
+    IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtInterfaceLoc,
                                       ClassName, ClassLoc);
     if (AttrList)
       ProcessDeclAttributeList(TUScope, IDecl, AttrList);
-  
+
     PushOnScopeChains(IDecl, TUScope);
   }
-  
+
   if (SuperName) {
     // Check if a different kind of symbol declared in this scope.
     PrevDecl = LookupName(TUScope, SuperName, LookupOrdinaryName);
@@ -129,13 +129,13 @@
         << SuperName << ClassName << SourceRange(AtInterfaceLoc, ClassLoc);
       IDecl->setLocEnd(ClassLoc);
     } else {
-      ObjCInterfaceDecl *SuperClassDecl = 
+      ObjCInterfaceDecl *SuperClassDecl =
                                 dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
 
       // Diagnose classes that inherit from deprecated classes.
       if (SuperClassDecl)
         (void)DiagnoseUseOfDecl(SuperClassDecl, SuperLoc);
-    
+
       if (PrevDecl && SuperClassDecl == 0) {
         // The previous declaration was not a class decl. Check if we have a
         // typedef. If we do, get the underlying class type.
@@ -146,7 +146,7 @@
               SuperClassDecl = dyn_cast<ObjCInterfaceDecl>(IDecl);
           }
         }
-      
+
         // This handles the following case:
         //
         // typedef int SuperClass;
@@ -157,7 +157,7 @@
           Diag(PrevDecl->getLocation(), diag::note_previous_definition);
         }
       }
-  
+
       if (!dyn_cast_or_null<TypedefDecl>(PrevDecl)) {
         if (!SuperClassDecl)
           Diag(SuperLoc, diag::err_undef_superclass)
@@ -174,14 +174,14 @@
   } else { // we have a root class.
     IDecl->setLocEnd(ClassLoc);
   }
-  
+
   /// Check then save referenced protocols.
   if (NumProtoRefs) {
     IDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs,
                            Context);
     IDecl->setLocEnd(EndProtoLoc);
   }
-  
+
   CheckObjCDeclScope(IDecl);
   return DeclPtrTy::make(IDecl);
 }
@@ -189,7 +189,7 @@
 /// ActOnCompatiblityAlias - this action is called after complete parsing of
 /// @compatibility_alias declaration. It sets up the alias relationships.
 Sema::DeclPtrTy Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
-                                             IdentifierInfo *AliasName, 
+                                             IdentifierInfo *AliasName,
                                              SourceLocation AliasLocation,
                                              IdentifierInfo *ClassName,
                                              SourceLocation ClassLocation) {
@@ -221,11 +221,11 @@
       Diag(CDeclU->getLocation(), diag::note_previous_declaration);
     return DeclPtrTy();
   }
-  
+
   // Everything checked out, instantiate a new alias declaration AST.
-  ObjCCompatibleAliasDecl *AliasDecl = 
+  ObjCCompatibleAliasDecl *AliasDecl =
     ObjCCompatibleAliasDecl::Create(Context, CurContext, AtLoc, AliasName, CDecl);
-  
+
   if (!CheckObjCDeclScope(AliasDecl))
     PushOnScopeChains(AliasDecl, TUScope);
 
@@ -235,17 +235,16 @@
 void Sema::CheckForwardProtocolDeclarationForCircularDependency(
   IdentifierInfo *PName,
   SourceLocation &Ploc, SourceLocation PrevLoc,
-  const ObjCList<ObjCProtocolDecl> &PList) 
-{
+  const ObjCList<ObjCProtocolDecl> &PList) {
   for (ObjCList<ObjCProtocolDecl>::iterator I = PList.begin(),
        E = PList.end(); I != E; ++I) {
-       
+
     if (ObjCProtocolDecl *PDecl = LookupProtocol((*I)->getIdentifier())) {
       if (PDecl->getIdentifier() == PName) {
         Diag(Ploc, diag::err_protocol_has_circular_dependency);
         Diag(PrevLoc, diag::note_previous_definition);
       }
-      CheckForwardProtocolDeclarationForCircularDependency(PName, Ploc, 
+      CheckForwardProtocolDeclarationForCircularDependency(PName, Ploc,
         PDecl->getLocation(), PDecl->getReferencedProtocols());
     }
   }
@@ -272,16 +271,16 @@
       return DeclPtrTy::make(PDecl);
     }
     ObjCList<ObjCProtocolDecl> PList;
-    PList.set((ObjCProtocolDecl *const*)ProtoRefs, NumProtoRefs, Context); 
+    PList.set((ObjCProtocolDecl *const*)ProtoRefs, NumProtoRefs, Context);
     CheckForwardProtocolDeclarationForCircularDependency(
       ProtocolName, ProtocolLoc, PDecl->getLocation(), PList);
     PList.Destroy(Context);
-    
+
     // Make sure the cached decl gets a valid start location.
     PDecl->setLocation(AtProtoInterfaceLoc);
     PDecl->setForwardDecl(false);
   } else {
-    PDecl = ObjCProtocolDecl::Create(Context, CurContext, 
+    PDecl = ObjCProtocolDecl::Create(Context, CurContext,
                                      AtProtoInterfaceLoc,ProtocolName);
     PushOnScopeChains(PDecl, TUScope);
     PDecl->setForwardDecl(false);
@@ -293,8 +292,8 @@
     PDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs,Context);
     PDecl->setLocEnd(EndProtoLoc);
   }
-  
-  CheckObjCDeclScope(PDecl);  
+
+  CheckObjCDeclScope(PDecl);
   return DeclPtrTy::make(PDecl);
 }
 
@@ -313,7 +312,7 @@
         << ProtocolId[i].first;
       continue;
     }
-    
+
     (void)DiagnoseUseOfDecl(PDecl, ProtocolId[i].second);
 
     // If this is a forward declaration and we are supposed to warn in this
@@ -329,12 +328,12 @@
 /// attributes and types and warns on a variety of inconsistencies.
 ///
 void
-Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property, 
+Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
                                ObjCPropertyDecl *SuperProperty,
                                const IdentifierInfo *inheritedName) {
-  ObjCPropertyDecl::PropertyAttributeKind CAttr = 
+  ObjCPropertyDecl::PropertyAttributeKind CAttr =
   Property->getPropertyAttributes();
-  ObjCPropertyDecl::PropertyAttributeKind SAttr = 
+  ObjCPropertyDecl::PropertyAttributeKind SAttr =
   SuperProperty->getPropertyAttributes();
   if ((CAttr & ObjCPropertyDecl::OBJC_PR_readonly)
       && (SAttr & ObjCPropertyDecl::OBJC_PR_readwrite))
@@ -348,23 +347,23 @@
            != (SAttr & ObjCPropertyDecl::OBJC_PR_retain))
     Diag(Property->getLocation(), diag::warn_property_attribute)
       << Property->getDeclName() << "retain" << inheritedName;
-  
+
   if ((CAttr & ObjCPropertyDecl::OBJC_PR_nonatomic)
       != (SAttr & ObjCPropertyDecl::OBJC_PR_nonatomic))
     Diag(Property->getLocation(), diag::warn_property_attribute)
       << Property->getDeclName() << "atomic" << inheritedName;
   if (Property->getSetterName() != SuperProperty->getSetterName())
     Diag(Property->getLocation(), diag::warn_property_attribute)
-      << Property->getDeclName() << "setter" << inheritedName; 
+      << Property->getDeclName() << "setter" << inheritedName;
   if (Property->getGetterName() != SuperProperty->getGetterName())
     Diag(Property->getLocation(), diag::warn_property_attribute)
       << Property->getDeclName() << "getter" << inheritedName;
 
-  QualType LHSType = 
+  QualType LHSType =
     Context.getCanonicalType(SuperProperty->getType());
-  QualType RHSType = 
+  QualType RHSType =
     Context.getCanonicalType(Property->getType());
-    
+
   if (!Context.typesAreCompatible(LHSType, RHSType)) {
     // FIXME: Incorporate this test with typesAreCompatible.
     if (LHSType->isObjCQualifiedIdType() && RHSType->isObjCQualifiedIdType())
@@ -392,7 +391,7 @@
          E = IDecl->prop_end(); I != E; ++I) {
       ObjCPropertyDecl *PDecl = (*I);
       if (SuperPDecl->getIdentifier() == PDecl->getIdentifier())
-          DiagnosePropertyMismatch(PDecl, SuperPDecl, 
+          DiagnosePropertyMismatch(PDecl, SuperPDecl,
                                    SDecl->getIdentifier());
     }
   }
@@ -455,7 +454,7 @@
            E = MDecl->protocol_end(); P != E; ++P)
       // Merge properties of category (*P) into IDECL's
       MergeOneProtocolPropertiesIntoClass(CatDecl, *P);
-    
+
       // Go thru the list of protocols for this category and recursively merge
       // their properties into this class as well.
       for (ObjCCategoryDecl::protocol_iterator P = CatDecl->protocol_begin(),
@@ -475,7 +474,7 @@
          E = MDecl->protocol_end(); P != E; ++P)
       // Merge properties of class (*P) into IDECL's
       MergeOneProtocolPropertiesIntoClass(IDecl, *P);
-    
+
     // Go thru the list of protocols for this class and recursively merge
     // their properties into this class as well.
     for (ObjCInterfaceDecl::protocol_iterator P = IDecl->protocol_begin(),
@@ -492,7 +491,7 @@
 /// DiagnoseClassExtensionDupMethods - Check for duplicate declaration of
 /// a class method in its extension.
 ///
-void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, 
+void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT,
                                             ObjCInterfaceDecl *ID) {
   if (!ID)
     return;  // Possibly due to previous error
@@ -525,12 +524,12 @@
                                       unsigned NumElts,
                                       AttributeList *attrList) {
   llvm::SmallVector<ObjCProtocolDecl*, 32> Protocols;
-  
+
   for (unsigned i = 0; i != NumElts; ++i) {
     IdentifierInfo *Ident = IdentList[i].first;
     ObjCProtocolDecl *PDecl = LookupProtocol(Ident);
     if (PDecl == 0) { // Not already seen?
-      PDecl = ObjCProtocolDecl::Create(Context, CurContext, 
+      PDecl = ObjCProtocolDecl::Create(Context, CurContext,
                                        IdentList[i].second, Ident);
       PushOnScopeChains(PDecl, TUScope);
     }
@@ -538,8 +537,8 @@
       ProcessDeclAttributeList(TUScope, PDecl, attrList);
     Protocols.push_back(PDecl);
   }
-  
-  ObjCForwardProtocolDecl *PDecl = 
+
+  ObjCForwardProtocolDecl *PDecl =
     ObjCForwardProtocolDecl::Create(Context, CurContext, AtProtocolLoc,
                                     &Protocols[0], Protocols.size());
   CurContext->addDecl(PDecl);
@@ -555,7 +554,7 @@
                             const DeclPtrTy *ProtoRefs,
                             unsigned NumProtoRefs,
                             SourceLocation EndProtoLoc) {
-  ObjCCategoryDecl *CDecl = 
+  ObjCCategoryDecl *CDecl =
     ObjCCategoryDecl::Create(Context, CurContext, AtInterfaceLoc, CategoryName);
   // FIXME: PushOnScopeChains?
   CurContext->addDecl(CDecl);
@@ -569,7 +568,7 @@
   }
 
   CDecl->setClassInterface(IDecl);
-  
+
   // If the interface is deprecated, warn about it.
   (void)DiagnoseUseOfDecl(IDecl, ClassLoc);
 
@@ -591,7 +590,7 @@
     CDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs,Context);
     CDecl->setLocEnd(EndProtoLoc);
   }
-  
+
   CheckObjCDeclScope(CDecl);
   return DeclPtrTy::make(CDecl);
 }
@@ -617,7 +616,7 @@
     }
   }
 
-  ObjCCategoryImplDecl *CDecl = 
+  ObjCCategoryImplDecl *CDecl =
     ObjCCategoryImplDecl::Create(Context, CurContext, AtCatImplLoc, CatName,
                                  IDecl);
   /// Check that class of this category is already completely declared.
@@ -637,7 +636,7 @@
     } else
       CatIDecl->setImplementation(CDecl);
   }
-  
+
   CheckObjCDeclScope(CDecl);
   return DeclPtrTy::make(CDecl);
 }
@@ -645,7 +644,7 @@
 Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
                       SourceLocation AtClassImplLoc,
                       IdentifierInfo *ClassName, SourceLocation ClassLoc,
-                      IdentifierInfo *SuperClassname, 
+                      IdentifierInfo *SuperClassname,
                       SourceLocation SuperClassLoc) {
   ObjCInterfaceDecl* IDecl = 0;
   // Check for another declaration kind with the same name.
@@ -655,13 +654,13 @@
     Diag(PrevDecl->getLocation(), diag::note_previous_definition);
   }  else {
     // Is there an interface declaration of this class; if not, warn!
-    IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl); 
+    IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
     if (!IDecl || IDecl->isForwardDecl()) {
       Diag(ClassLoc, diag::warn_undef_interface) << ClassName;
       IDecl = 0;
     }
   }
-  
+
   // Check that super class name is valid class name
   ObjCInterfaceDecl* SDecl = 0;
   if (SuperClassname) {
@@ -672,7 +671,7 @@
         << SuperClassname;
       Diag(PrevDecl->getLocation(), diag::note_previous_definition);
     } else {
-      SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl); 
+      SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
       if (!SDecl)
         Diag(SuperClassLoc, diag::err_undef_superclass)
           << SuperClassname << ClassName;
@@ -685,14 +684,14 @@
       }
     }
   }
-  
+
   if (!IDecl) {
     // Legacy case of @implementation with no corresponding @interface.
     // Build, chain & install the interface decl into the identifier.
 
     // FIXME: Do we support attributes on the @implementation? If so we should
     // copy them over.
-    IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtClassImplLoc, 
+    IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtClassImplLoc,
                                       ClassName, ClassLoc, false, true);
     IDecl->setSuperClass(SDecl);
     IDecl->setLocEnd(ClassLoc);
@@ -704,14 +703,14 @@
     // declaration; the user cannot reopen it.
     IDecl->setForwardDecl(false);
   }
-  
-  ObjCImplementationDecl* IMPDecl = 
-    ObjCImplementationDecl::Create(Context, CurContext, AtClassImplLoc, 
+
+  ObjCImplementationDecl* IMPDecl =
+    ObjCImplementationDecl::Create(Context, CurContext, AtClassImplLoc,
                                    IDecl, SDecl);
-  
+
   if (CheckObjCDeclScope(IMPDecl))
     return DeclPtrTy::make(IMPDecl);
-  
+
   // Check that there is no duplicate implementation of this class.
   if (IDecl->getImplementation()) {
     // FIXME: Don't leak everything!
@@ -743,21 +742,21 @@
   // If implementation has empty ivar list, just return.
   if (numIvars == 0)
     return;
-  
+
   assert(ivars && "missing @implementation ivars");
-  
+
   // Check interface's Ivar list against those in the implementation.
   // names and types must match.
   //
   unsigned j = 0;
-  ObjCInterfaceDecl::ivar_iterator 
+  ObjCInterfaceDecl::ivar_iterator
     IVI = IDecl->ivar_begin(), IVE = IDecl->ivar_end();
   for (; numIvars > 0 && IVI != IVE; ++IVI) {
     ObjCIvarDecl* ImplIvar = ivars[j++];
     ObjCIvarDecl* ClsIvar = *IVI;
     assert (ImplIvar && "missing implementation ivar");
     assert (ClsIvar && "missing class ivar");
-    
+
     // First, make sure the types match.
     if (Context.getCanonicalType(ImplIvar->getType()) !=
         Context.getCanonicalType(ClsIvar->getType())) {
@@ -774,7 +773,7 @@
           << ImplIvar->getIdentifier();
         Diag(ClsBitWidth->getLocStart(), diag::note_previous_definition);
       }
-    } 
+    }
     // Make sure the names are identical.
     if (ImplIvar->getIdentifier() != ClsIvar->getIdentifier()) {
       Diag(ImplIvar->getLocation(), diag::err_conflicting_ivar_name)
@@ -783,7 +782,7 @@
     }
     --numIvars;
   }
-  
+
   if (numIvars > 0)
     Diag(ivars[j]->getLocation(), diag::err_inconsistant_ivar_count);
   else if (IVI != IVE)
@@ -805,21 +804,21 @@
                                   ImpMethodDecl->getResultType()) &&
       !Context.QualifiedIdConformsQualifiedId(IntfMethodDecl->getResultType(),
                                               ImpMethodDecl->getResultType())) {
-    Diag(ImpMethodDecl->getLocation(), diag::warn_conflicting_ret_types) 
+    Diag(ImpMethodDecl->getLocation(), diag::warn_conflicting_ret_types)
       << ImpMethodDecl->getDeclName() << IntfMethodDecl->getResultType()
       << ImpMethodDecl->getResultType();
     Diag(IntfMethodDecl->getLocation(), diag::note_previous_definition);
   }
-  
+
   for (ObjCMethodDecl::param_iterator IM = ImpMethodDecl->param_begin(),
        IF = IntfMethodDecl->param_begin(), EM = ImpMethodDecl->param_end();
        IM != EM; ++IM, ++IF) {
     if (Context.typesAreCompatible((*IF)->getType(), (*IM)->getType()) ||
-        Context.QualifiedIdConformsQualifiedId((*IF)->getType(), 
+        Context.QualifiedIdConformsQualifiedId((*IF)->getType(),
                                                (*IM)->getType()))
       continue;
-    
-    Diag((*IM)->getLocation(), diag::warn_conflicting_param_types) 
+
+    Diag((*IM)->getLocation(), diag::warn_conflicting_param_types)
       << ImpMethodDecl->getDeclName() << (*IF)->getType()
       << (*IM)->getType();
     Diag((*IF)->getLocation(), diag::note_previous_definition);
@@ -834,34 +833,34 @@
   // by far the most common case.
   if (!PDecl->isReadOnly())
     return false;
-  // Even if property is ready only, if interface has a user defined setter, 
+  // Even if property is ready only, if interface has a user defined setter,
   // it is not considered read only.
   if (IDecl->getInstanceMethod(PDecl->getSetterName()))
     return false;
-  
+
   // Main class has the property as 'readonly'. Must search
-  // through the category list to see if the property's 
+  // through the category list to see if the property's
   // attribute has been over-ridden to 'readwrite'.
   for (ObjCCategoryDecl *Category = IDecl->getCategoryList();
        Category; Category = Category->getNextClassCategory()) {
-    // Even if property is ready only, if a category has a user defined setter, 
-    // it is not considered read only. 
+    // Even if property is ready only, if a category has a user defined setter,
+    // it is not considered read only.
     if (Category->getInstanceMethod(PDecl->getSetterName()))
       return false;
-    ObjCPropertyDecl *P = 
+    ObjCPropertyDecl *P =
       Category->FindPropertyDeclaration(PDecl->getIdentifier());
     if (P && !P->isReadOnly())
       return false;
   }
-  
+
   // Also, check for definition of a setter method in the implementation if
   // all else failed.
   if (ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(CurContext)) {
-    if (ObjCImplementationDecl *IMD = 
+    if (ObjCImplementationDecl *IMD =
         dyn_cast<ObjCImplementationDecl>(OMD->getDeclContext())) {
       if (IMD->getInstanceMethod(PDecl->getSetterName()))
         return false;
-    } else if (ObjCCategoryImplDecl *CIMD = 
+    } else if (ObjCCategoryImplDecl *CIMD =
                dyn_cast<ObjCCategoryImplDecl>(OMD->getDeclContext())) {
       if (CIMD->getInstanceMethod(PDecl->getSetterName()))
         return false;
@@ -894,11 +893,11 @@
   ObjCInterfaceDecl *Super = IDecl->getSuperClass();
   ObjCInterfaceDecl *NSIDecl = 0;
   if (getLangOptions().NeXTRuntime) {
-    // check to see if class implements forwardInvocation method and objects 
-    // of this class are derived from 'NSProxy' so that to forward requests 
+    // check to see if class implements forwardInvocation method and objects
+    // of this class are derived from 'NSProxy' so that to forward requests
     // from one object to another.
-    // Under such conditions, which means that every method possible is 
-    // implemented in the class, we should not issue "Method definition not 
+    // Under such conditions, which means that every method possible is
+    // implemented in the class, we should not issue "Method definition not
     // found" warnings.
     // FIXME: Use a general GetUnarySelector method for this.
     IdentifierInfo* II = &Context.Idents.get("forwardInvocation");
@@ -908,7 +907,7 @@
       // need be implemented in the implementation.
       NSIDecl = IDecl->lookupInheritedClass(&Context.Idents.get("NSProxy"));
   }
-  
+
   // If a method lookup fails locally we still need to look and see if
   // the method was implemented by a base class or an inherited
   // protocol. This lookup is slow, but occurs rarely in correct code
@@ -916,24 +915,24 @@
 
   // check unimplemented instance methods.
   if (!NSIDecl)
-    for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), 
+    for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(),
          E = PDecl->instmeth_end(); I != E; ++I) {
       ObjCMethodDecl *method = *I;
-      if (method->getImplementationControl() != ObjCMethodDecl::Optional && 
+      if (method->getImplementationControl() != ObjCMethodDecl::Optional &&
           !method->isSynthesized() && !InsMap.count(method->getSelector()) &&
-          (!Super || 
+          (!Super ||
            !Super->lookupInstanceMethod(method->getSelector()))) {
             // Ugly, but necessary. Method declared in protcol might have
             // have been synthesized due to a property declared in the class which
             // uses the protocol.
-            ObjCMethodDecl *MethodInClass = 
+            ObjCMethodDecl *MethodInClass =
             IDecl->lookupInstanceMethod(method->getSelector());
             if (!MethodInClass || !MethodInClass->isSynthesized())
               WarnUndefinedMethod(ImpLoc, method, IncompleteImpl);
           }
     }
   // check unimplemented class methods
-  for (ObjCProtocolDecl::classmeth_iterator 
+  for (ObjCProtocolDecl::classmeth_iterator
          I = PDecl->classmeth_begin(), E = PDecl->classmeth_end();
        I != E; ++I) {
     ObjCMethodDecl *method = *I;
@@ -958,8 +957,7 @@
                                       ObjCImplDecl* IMPDecl,
                                       ObjCContainerDecl* CDecl,
                                       bool &IncompleteImpl,
-                                      bool ImmediateClass)
-{
+                                      bool ImmediateClass) {
   // Check and see if instance methods in class interface have been
   // implemented in the implementation class. If so, their types match.
   for (ObjCInterfaceDecl::instmeth_iterator I = CDecl->instmeth_begin(),
@@ -967,27 +965,27 @@
     if (InsMapSeen.count((*I)->getSelector()))
         continue;
     InsMapSeen.insert((*I)->getSelector());
-    if (!(*I)->isSynthesized() && 
+    if (!(*I)->isSynthesized() &&
         !InsMap.count((*I)->getSelector())) {
       if (ImmediateClass)
         WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl);
       continue;
     } else {
-      ObjCMethodDecl *ImpMethodDecl = 
+      ObjCMethodDecl *ImpMethodDecl =
       IMPDecl->getInstanceMethod((*I)->getSelector());
-      ObjCMethodDecl *IntfMethodDecl = 
+      ObjCMethodDecl *IntfMethodDecl =
       CDecl->getInstanceMethod((*I)->getSelector());
-      assert(IntfMethodDecl && 
+      assert(IntfMethodDecl &&
              "IntfMethodDecl is null in ImplMethodsVsClassMethods");
       // ImpMethodDecl may be null as in a @dynamic property.
       if (ImpMethodDecl)
         WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl);
     }
   }
-  
+
   // Check and see if class methods in class interface have been
   // implemented in the implementation class. If so, their types match.
-   for (ObjCInterfaceDecl::classmeth_iterator 
+   for (ObjCInterfaceDecl::classmeth_iterator
        I = CDecl->classmeth_begin(), E = CDecl->classmeth_end(); I != E; ++I) {
      if (ClsMapSeen.count((*I)->getSelector()))
        continue;
@@ -998,7 +996,7 @@
     } else {
       ObjCMethodDecl *ImpMethodDecl =
         IMPDecl->getClassMethod((*I)->getSelector());
-      ObjCMethodDecl *IntfMethodDecl = 
+      ObjCMethodDecl *IntfMethodDecl =
         CDecl->getClassMethod((*I)->getSelector());
       WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl);
     }
@@ -1007,26 +1005,26 @@
     // Check for any implementation of a methods declared in protocol.
     for (ObjCInterfaceDecl::protocol_iterator PI = I->protocol_begin(),
          E = I->protocol_end(); PI != E; ++PI)
-      MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen, 
-                                 IMPDecl, 
+      MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
+                                 IMPDecl,
                                  (*PI), IncompleteImpl, false);
     if (I->getSuperClass())
       MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
-                                 IMPDecl, 
+                                 IMPDecl,
                                  I->getSuperClass(), IncompleteImpl, false);
   }
 }
 
-void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl, 
-                                     ObjCContainerDecl* CDecl, 
+void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl,
+                                     ObjCContainerDecl* CDecl,
                                      bool IncompleteImpl) {
   llvm::DenseSet<Selector> InsMap;
   // Check and see if instance methods in class interface have been
   // implemented in the implementation class.
-  for (ObjCImplementationDecl::instmeth_iterator 
+  for (ObjCImplementationDecl::instmeth_iterator
          I = IMPDecl->instmeth_begin(), E = IMPDecl->instmeth_end(); I!=E; ++I)
     InsMap.insert((*I)->getSelector());
-  
+
   // Check and see if properties declared in the interface have either 1)
   // an implementation or 2) there is a @synthesize/@dynamic implementation
   // of the property in the @implementation.
@@ -1038,7 +1036,7 @@
           continue;
         ObjCPropertyImplDecl *PI = 0;
         // Is there a matching propery synthesize/dynamic?
-        for (ObjCImplDecl::propimpl_iterator 
+        for (ObjCImplDecl::propimpl_iterator
                I = IMPDecl->propimpl_begin(),
                EI = IMPDecl->propimpl_end(); I != EI; ++I)
           if ((*I)->getPropertyDecl() == Prop) {
@@ -1048,44 +1046,44 @@
         if (PI)
           continue;
         if (!InsMap.count(Prop->getGetterName())) {
-          Diag(Prop->getLocation(), 
-               diag::warn_setter_getter_impl_required) 
+          Diag(Prop->getLocation(),
+               diag::warn_setter_getter_impl_required)
           << Prop->getDeclName() << Prop->getGetterName();
           Diag(IMPDecl->getLocation(),
                diag::note_property_impl_required);
         }
-    
+
         if (!Prop->isReadOnly() && !InsMap.count(Prop->getSetterName())) {
-          Diag(Prop->getLocation(), 
-               diag::warn_setter_getter_impl_required) 
+          Diag(Prop->getLocation(),
+               diag::warn_setter_getter_impl_required)
           << Prop->getDeclName() << Prop->getSetterName();
           Diag(IMPDecl->getLocation(),
                diag::note_property_impl_required);
         }
       }
-  
+
   llvm::DenseSet<Selector> ClsMap;
-  for (ObjCImplementationDecl::classmeth_iterator 
+  for (ObjCImplementationDecl::classmeth_iterator
        I = IMPDecl->classmeth_begin(),
        E = IMPDecl->classmeth_end(); I != E; ++I)
     ClsMap.insert((*I)->getSelector());
-  
+
   // Check for type conflict of methods declared in a class/protocol and
   // its implementation; if any.
   llvm::DenseSet<Selector> InsMapSeen, ClsMapSeen;
-  MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen, 
-                             IMPDecl, CDecl, 
+  MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
+                             IMPDecl, CDecl,
                              IncompleteImpl, true);
-  
+
   // Check the protocol list for unimplemented methods in the @implementation
   // class.
   // Check and see if class methods in class interface have been
   // implemented in the implementation class.
-  
+
   if (ObjCInterfaceDecl *I = dyn_cast<ObjCInterfaceDecl> (CDecl)) {
     for (ObjCInterfaceDecl::protocol_iterator PI = I->protocol_begin(),
          E = I->protocol_end(); PI != E; ++PI)
-      CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl, 
+      CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl,
                               InsMap, ClsMap, I);
     // Check class extensions (unnamed categories)
     for (ObjCCategoryDecl *Categories = I->getCategoryList();
@@ -1098,19 +1096,19 @@
   } else if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl)) {
     for (ObjCCategoryDecl::protocol_iterator PI = C->protocol_begin(),
          E = C->protocol_end(); PI != E; ++PI)
-      CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl, 
+      CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl,
                               InsMap, ClsMap, C->getClassInterface());
   } else
     assert(false && "invalid ObjCContainerDecl type.");
 }
 
-/// ActOnForwardClassDeclaration - 
+/// ActOnForwardClassDeclaration -
 Action::DeclPtrTy
 Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
                                    IdentifierInfo **IdentList,
                                    unsigned NumElts) {
   llvm::SmallVector<ObjCInterfaceDecl*, 32> Interfaces;
-  
+
   for (unsigned i = 0; i != NumElts; ++i) {
     // Check for another declaration kind with the same name.
     NamedDecl *PrevDecl = LookupName(TUScope, IdentList[i], LookupOrdinaryName);
@@ -1127,7 +1125,7 @@
       // typedef NSObject < XCElementTogglerP > XCElementToggler;
       // @class XCElementToggler;
       //
-      // FIXME: Make an extension? 
+      // FIXME: Make an extension?
       TypedefDecl *TDD = dyn_cast<TypedefDecl>(PrevDecl);
       if (!TDD || !isa<ObjCInterfaceType>(TDD->getUnderlyingType())) {
         Diag(AtClassLoc, diag::err_redefinition_different_kind) << IdentList[i];
@@ -1135,21 +1133,21 @@
       } else if (TDD) {
         // a forward class declaration matching a typedef name of a class refers
         // to the underlying class.
-        if (ObjCInterfaceType * OI = 
+        if (ObjCInterfaceType * OI =
               dyn_cast<ObjCInterfaceType>(TDD->getUnderlyingType()))
           PrevDecl = OI->getDecl();
       }
     }
-    ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl); 
+    ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
     if (!IDecl) {  // Not already seen?  Make a forward decl.
-      IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtClassLoc, 
+      IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtClassLoc,
                                         IdentList[i], SourceLocation(), true);
       PushOnScopeChains(IDecl, TUScope);
     }
 
     Interfaces.push_back(IDecl);
   }
-  
+
   ObjCClassDecl *CDecl = ObjCClassDecl::Create(Context, CurContext, AtClassLoc,
                                                &Interfaces[0],
                                                Interfaces.size());
@@ -1162,12 +1160,12 @@
 /// MatchTwoMethodDeclarations - Checks that two methods have matching type and
 /// returns true, or false, accordingly.
 /// TODO: Handle protocol list; such as id<p1,p2> in type comparisons
-bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, 
+bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
                                       const ObjCMethodDecl *PrevMethod,
                                       bool matchBasedOnSizeAndAlignment) {
   QualType T1 = Context.getCanonicalType(Method->getResultType());
   QualType T2 = Context.getCanonicalType(PrevMethod->getResultType());
-  
+
   if (T1 != T2) {
     // The result types are different.
     if (!matchBasedOnSizeAndAlignment)
@@ -1179,11 +1177,11 @@
     if (Context.getTypeInfo(T1) != Context.getTypeInfo(T2))
       return false;
   }
-  
+
   ObjCMethodDecl::param_iterator ParamI = Method->param_begin(),
        E = Method->param_end();
   ObjCMethodDecl::param_iterator PrevI = PrevMethod->param_begin();
-  
+
   for (; ParamI != E; ++ParamI, ++PrevI) {
     assert(PrevI != PrevMethod->param_end() && "Param mismatch");
     T1 = Context.getCanonicalType((*ParamI)->getType());
@@ -1208,7 +1206,7 @@
 ///
 /// This routine should only be called once, when neither the instance
 /// nor the factory method pool has an entry for this selector.
-Sema::MethodPool::iterator Sema::ReadMethodPool(Selector Sel, 
+Sema::MethodPool::iterator Sema::ReadMethodPool(Selector Sel,
                                                 bool isInstance) {
   assert(ExternalSource && "We need an external AST source");
   assert(InstanceMethodPool.find(Sel) == InstanceMethodPool.end() &&
@@ -1219,12 +1217,12 @@
   // Read the method list from the external source.
   std::pair<ObjCMethodList, ObjCMethodList> Methods
     = ExternalSource->ReadMethodPool(Sel);
-  
+
   if (isInstance) {
     if (Methods.second.Method)
       FactoryMethodPool[Sel] = Methods.second;
     return InstanceMethodPool.insert(std::make_pair(Sel, Methods.first)).first;
-  } 
+  }
 
   if (Methods.first.Method)
     InstanceMethodPool[Sel] = Methods.first;
@@ -1250,20 +1248,20 @@
     Entry.Next = 0;
     return;
   }
-  
+
   // We've seen a method with this name, see if we have already seen this type
   // signature.
   for (ObjCMethodList *List = &Entry; List; List = List->Next)
     if (MatchTwoMethodDeclarations(Method, List->Method))
       return;
-    
+
   // We have a new signature for an existing method - add it.
   // This is extremely rare. Only 1% of Cocoa selectors are "overloaded".
   Entry.Next = new ObjCMethodList(Method, Entry.Next);
 }
 
 // FIXME: Finish implementing -Wno-strict-selector-match.
-ObjCMethodDecl *Sema::LookupInstanceMethodInGlobalPool(Selector Sel, 
+ObjCMethodDecl *Sema::LookupInstanceMethodInGlobalPool(Selector Sel,
                                                        SourceRange R,
                                                        bool warn) {
   llvm::DenseMap<Selector, ObjCMethodList>::iterator Pos
@@ -1277,7 +1275,7 @@
 
   ObjCMethodList &MethList = Pos->second;
   bool issueWarning = false;
-  
+
   if (MethList.Method && MethList.Next) {
     for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next)
       // This checks if the methods differ by size & alignment.
@@ -1314,11 +1312,11 @@
   } else {
     // We've seen a method with this name, now check the type signature(s).
     bool match = MatchTwoMethodDeclarations(Method, FirstMethod.Method);
-    
-    for (ObjCMethodList *Next = FirstMethod.Next; !match && Next; 
+
+    for (ObjCMethodList *Next = FirstMethod.Next; !match && Next;
          Next = Next->Next)
       match = MatchTwoMethodDeclarations(Method, Next->Method);
-      
+
     if (!match) {
       // We have a new signature for an existing method - add it.
       // This is extremely rare. Only 1% of Cocoa selectors are "overloaded".
@@ -1328,12 +1326,12 @@
   }
 }
 
-ObjCMethodDecl *Sema::LookupFactoryMethodInGlobalPool(Selector Sel, 
+ObjCMethodDecl *Sema::LookupFactoryMethodInGlobalPool(Selector Sel,
                                                       SourceRange R) {
   llvm::DenseMap<Selector, ObjCMethodList>::iterator Pos
     = FactoryMethodPool.find(Sel);
   if (Pos == FactoryMethodPool.end()) {
-    if (ExternalSource && !InstanceMethodPool.count(Sel)) 
+    if (ExternalSource && !InstanceMethodPool.count(Sel))
       Pos = ReadMethodPool(Sel, /*isInstance=*/false);
     else
       return 0;
@@ -1341,7 +1339,7 @@
 
   ObjCMethodList &MethList = Pos->second;
   bool issueWarning = false;
-  
+
   if (MethList.Method && MethList.Next) {
     for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next)
       // This checks if the methods differ by size & alignment.
@@ -1359,28 +1357,28 @@
   return MethList.Method;
 }
 
-/// ProcessPropertyDecl - Make sure that any user-defined setter/getter methods 
+/// ProcessPropertyDecl - Make sure that any user-defined setter/getter methods
 /// have the property type and issue diagnostics if they don't.
 /// Also synthesize a getter/setter method if none exist (and update the
 /// appropriate lookup tables. FIXME: Should reconsider if adding synthesized
 /// methods is the "right" thing to do.
-void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, 
+void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
                                ObjCContainerDecl *CD) {
   ObjCMethodDecl *GetterMethod, *SetterMethod;
-  
-  GetterMethod = CD->getInstanceMethod(property->getGetterName());  
+
+  GetterMethod = CD->getInstanceMethod(property->getGetterName());
   SetterMethod = CD->getInstanceMethod(property->getSetterName());
-  DiagnosePropertyAccessorMismatch(property, GetterMethod, 
+  DiagnosePropertyAccessorMismatch(property, GetterMethod,
                                    property->getLocation());
-    
+
   if (SetterMethod) {
-    if (Context.getCanonicalType(SetterMethod->getResultType()) 
+    if (Context.getCanonicalType(SetterMethod->getResultType())
         != Context.VoidTy)
       Diag(SetterMethod->getLocation(), diag::err_setter_type_void);
     if (SetterMethod->param_size() != 1 ||
         ((*SetterMethod->param_begin())->getType() != property->getType())) {
-      Diag(property->getLocation(), 
-           diag::warn_accessor_property_type_mismatch) 
+      Diag(property->getLocation(),
+           diag::warn_accessor_property_type_mismatch)
         << property->getDeclName()
         << SetterMethod->getSelector();
       Diag(SetterMethod->getLocation(), diag::note_declared_at);
@@ -1395,14 +1393,14 @@
   // declarations jive in that situation (which it is not currently).
   if (!GetterMethod) {
     // No instance method of same name as property getter name was found.
-    // Declare a getter method and add it to the list of methods 
+    // Declare a getter method and add it to the list of methods
     // for this class.
-    GetterMethod = ObjCMethodDecl::Create(Context, property->getLocation(), 
-                             property->getLocation(), property->getGetterName(), 
-                             property->getType(), CD, true, false, true, 
-                             (property->getPropertyImplementation() == 
-                              ObjCPropertyDecl::Optional) ? 
-                             ObjCMethodDecl::Optional : 
+    GetterMethod = ObjCMethodDecl::Create(Context, property->getLocation(),
+                             property->getLocation(), property->getGetterName(),
+                             property->getType(), CD, true, false, true,
+                             (property->getPropertyImplementation() ==
+                              ObjCPropertyDecl::Optional) ?
+                             ObjCMethodDecl::Optional :
                              ObjCMethodDecl::Required);
     CD->addDecl(GetterMethod);
   } else
@@ -1416,20 +1414,20 @@
     // Find the default setter and if one not found, add one.
     if (!SetterMethod) {
       // No instance method of same name as property setter name was found.
-      // Declare a setter method and add it to the list of methods 
+      // Declare a setter method and add it to the list of methods
       // for this class.
-      SetterMethod = ObjCMethodDecl::Create(Context, property->getLocation(), 
-                               property->getLocation(), 
-                               property->getSetterName(), 
+      SetterMethod = ObjCMethodDecl::Create(Context, property->getLocation(),
+                               property->getLocation(),
+                               property->getSetterName(),
                                Context.VoidTy, CD, true, false, true,
-                               (property->getPropertyImplementation() == 
-                                ObjCPropertyDecl::Optional) ? 
-                               ObjCMethodDecl::Optional : 
+                               (property->getPropertyImplementation() ==
+                                ObjCPropertyDecl::Optional) ?
+                               ObjCMethodDecl::Optional :
                                ObjCMethodDecl::Required);
       // Invent the arguments for the setter. We don't bother making a
       // nice name for the argument.
       ParmVarDecl *Argument = ParmVarDecl::Create(Context, SetterMethod,
-                                                  property->getLocation(), 
+                                                  property->getLocation(),
                                                   property->getIdentifier(),
                                                   property->getType(),
                                                   /*DInfo=*/0,
@@ -1443,7 +1441,7 @@
       SetterMethod->setSynthesized(true);
     property->setSetterMethodDecl(SetterMethod);
   }
-  // Add any synthesized methods to the global pool. This allows us to 
+  // Add any synthesized methods to the global pool. This allows us to
   // handle the following, which is supported by GCC (and part of the design).
   //
   // @interface Foo
@@ -1456,9 +1454,9 @@
   // }
   //
   if (GetterMethod)
-    AddInstanceMethodToGlobalPool(GetterMethod);  
+    AddInstanceMethodToGlobalPool(GetterMethod);
   if (SetterMethod)
-    AddInstanceMethodToGlobalPool(SetterMethod);     
+    AddInstanceMethodToGlobalPool(SetterMethod);
 }
 
 /// CompareMethodParamsInBaseAndSuper - This routine compares methods with
@@ -1469,9 +1467,9 @@
                                              bool IsInstance)  {
   ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(ClassDecl);
   if (ID == 0) return;
-  
+
   while (ObjCInterfaceDecl *SD = ID->getSuperClass()) {
-    ObjCMethodDecl *SuperMethodDecl = 
+    ObjCMethodDecl *SuperMethodDecl =
         SD->lookupMethod(Method->getSelector(), IsInstance);
     if (SuperMethodDecl == 0) {
       ID = SD;
@@ -1488,7 +1486,7 @@
       // If type of arguement of method in this class does not match its
       // respective argument type in the super class method, issue warning;
       if (!Context.typesAreCompatible(T1, T2)) {
-        Diag((*ParamI)->getLocation(), diag::ext_typecheck_base_super) 
+        Diag((*ParamI)->getLocation(), diag::ext_typecheck_base_super)
           << T1 << T2;
         Diag(SuperMethodDecl->getLocation(), diag::note_previous_declaration);
         return;
@@ -1511,8 +1509,8 @@
   // should be true.
   if (!ClassDecl)
     return;
-    
-  bool isInterfaceDeclKind = 
+
+  bool isInterfaceDeclKind =
         isa<ObjCInterfaceDecl>(ClassDecl) || isa<ObjCCategoryDecl>(ClassDecl)
          || isa<ObjCProtocolDecl>(ClassDecl);
   bool checkIdenticalMethods = isa<ObjCImplementationDecl>(ClassDecl);
@@ -1531,9 +1529,9 @@
     if (Method->isInstanceMethod()) {
       /// Check for instance method of the same name with incompatible types
       const ObjCMethodDecl *&PrevMethod = InsMap[Method->getSelector()];
-      bool match = PrevMethod ? MatchTwoMethodDeclarations(Method, PrevMethod) 
+      bool match = PrevMethod ? MatchTwoMethodDeclarations(Method, PrevMethod)
                               : false;
-      if ((isInterfaceDeclKind && PrevMethod && !match) 
+      if ((isInterfaceDeclKind && PrevMethod && !match)
           || (checkIdenticalMethods && match)) {
           Diag(Method->getLocation(), diag::err_duplicate_method_decl)
             << Method->getDeclName();
@@ -1543,16 +1541,16 @@
         InsMap[Method->getSelector()] = Method;
         /// The following allows us to typecheck messages to "id".
         AddInstanceMethodToGlobalPool(Method);
-        // verify that the instance method conforms to the same definition of 
+        // verify that the instance method conforms to the same definition of
         // parent methods if it shadows one.
         CompareMethodParamsInBaseAndSuper(ClassDecl, Method, true);
       }
     } else {
       /// Check for class method of the same name with incompatible types
       const ObjCMethodDecl *&PrevMethod = ClsMap[Method->getSelector()];
-      bool match = PrevMethod ? MatchTwoMethodDeclarations(Method, PrevMethod) 
+      bool match = PrevMethod ? MatchTwoMethodDeclarations(Method, PrevMethod)
                               : false;
-      if ((isInterfaceDeclKind && PrevMethod && !match) 
+      if ((isInterfaceDeclKind && PrevMethod && !match)
           || (checkIdenticalMethods && match)) {
         Diag(Method->getLocation(), diag::err_duplicate_method_decl)
           << Method->getDeclName();
@@ -1562,20 +1560,20 @@
         ClsMap[Method->getSelector()] = Method;
         /// The following allows us to typecheck messages to "Class".
         AddFactoryMethodToGlobalPool(Method);
-        // verify that the class method conforms to the same definition of 
+        // verify that the class method conforms to the same definition of
         // parent methods if it shadows one.
         CompareMethodParamsInBaseAndSuper(ClassDecl, Method, false);
       }
     }
   }
   if (ObjCInterfaceDecl *I = dyn_cast<ObjCInterfaceDecl>(ClassDecl)) {
-    // Compares properties declared in this class to those of its 
+    // Compares properties declared in this class to those of its
     // super class.
     ComparePropertiesInBaseAndSuper(I);
     MergeProtocolPropertiesIntoClass(I, DeclPtrTy::make(I));
   } else if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(ClassDecl)) {
     // Categories are used to extend the class by declaring new methods.
-    // By the same token, they are also used to add new properties. No 
+    // By the same token, they are also used to add new properties. No
     // need to compare the added property to those in the class.
 
     // Merge protocol properties into category
@@ -1597,10 +1595,10 @@
     IC->setAtEndLoc(AtEndLoc);
     if (ObjCInterfaceDecl* IDecl = IC->getClassInterface())
       ImplMethodsVsClassMethods(IC, IDecl);
-  } else if (ObjCCategoryImplDecl* CatImplClass = 
+  } else if (ObjCCategoryImplDecl* CatImplClass =
                                    dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) {
     CatImplClass->setAtEndLoc(AtEndLoc);
-    
+
     // Find category interface decl and then check that all methods declared
     // in this interface are implemented in the category @implementation.
     if (ObjCInterfaceDecl* IDecl = CatImplClass->getClassInterface()) {
@@ -1629,7 +1627,7 @@
 
 /// CvtQTToAstBitMask - utility routine to produce an AST bitmask for
 /// objective-c's type qualifier from the parser version of the same info.
-static Decl::ObjCDeclQualifier 
+static Decl::ObjCDeclQualifier
 CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal) {
   Decl::ObjCDeclQualifier ret = Decl::OBJC_TQ_None;
   if (PQTVal & ObjCDeclSpec::DQ_In)
@@ -1668,10 +1666,10 @@
     return DeclPtrTy();
   }
   QualType resultDeclType;
-  
+
   if (ReturnType) {
     resultDeclType = GetTypeFromParser(ReturnType);
-    
+
     // Methods cannot return interface types. All ObjC objects are
     // passed by reference.
     if (resultDeclType->isObjCInterfaceType()) {
@@ -1681,21 +1679,21 @@
     }
   } else // get the type for "id".
     resultDeclType = Context.getObjCIdType();
-  
-  ObjCMethodDecl* ObjCMethod = 
+
+  ObjCMethodDecl* ObjCMethod =
     ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, Sel, resultDeclType,
-                           cast<DeclContext>(ClassDecl), 
+                           cast<DeclContext>(ClassDecl),
                            MethodType == tok::minus, isVariadic,
                            false,
-                           MethodDeclKind == tok::objc_optional ? 
-                           ObjCMethodDecl::Optional : 
+                           MethodDeclKind == tok::objc_optional ?
+                           ObjCMethodDecl::Optional :
                            ObjCMethodDecl::Required);
-  
+
   llvm::SmallVector<ParmVarDecl*, 16> Params;
-  
+
   for (unsigned i = 0, e = Sel.getNumArgs(); i != e; ++i) {
     QualType ArgType, UnpromotedArgType;
-    
+
     if (ArgInfo[i].Type == 0) {
       UnpromotedArgType = ArgType = Context.getObjCIdType();
     } else {
@@ -1703,7 +1701,7 @@
       // Perform the default array/function conversions (C99 6.7.5.3p[7,8]).
       ArgType = adjustParameterType(ArgType);
     }
-    
+
     ParmVarDecl* Param;
     if (ArgType == UnpromotedArgType)
       Param = ParmVarDecl::Create(Context, ObjCMethod, ArgInfo[i].NameLoc,
@@ -1717,20 +1715,20 @@
                                           /*DInfo=*/0, //FIXME: Pass info here.
                                           UnpromotedArgType,
                                           VarDecl::None, 0);
-    
+
     if (ArgType->isObjCInterfaceType()) {
       Diag(ArgInfo[i].NameLoc,
            diag::err_object_cannot_be_passed_returned_by_value)
         << 1 << ArgType;
       Param->setInvalidDecl();
     }
-    
+
     Param->setObjCDeclQualifier(
       CvtQTToAstBitMask(ArgInfo[i].DeclSpec.getObjCDeclQualifier()));
-    
+
     // Apply the attributes to the parameter.
     ProcessDeclAttributeList(TUScope, Param, ArgInfo[i].ArgAttrs);
-    
+
     Params.push_back(Param);
   }
 
@@ -1741,12 +1739,12 @@
 
   if (AttrList)
     ProcessDeclAttributeList(TUScope, ObjCMethod, AttrList);
-  
-  // For implementations (which can be very "coarse grain"), we add the 
-  // method now. This allows the AST to implement lookup methods that work 
-  // incrementally (without waiting until we parse the @end). It also allows 
+
+  // For implementations (which can be very "coarse grain"), we add the
+  // method now. This allows the AST to implement lookup methods that work
+  // incrementally (without waiting until we parse the @end). It also allows
   // us to flag multiple declaration errors as they occur.
-  if (ObjCImplementationDecl *ImpDecl = 
+  if (ObjCImplementationDecl *ImpDecl =
         dyn_cast<ObjCImplementationDecl>(ClassDecl)) {
     if (MethodType == tok::minus) {
       PrevMethod = ImpDecl->getInstanceMethod(Sel);
@@ -1757,7 +1755,7 @@
     }
     if (AttrList)
       Diag(EndLoc, diag::warn_attribute_method_def);
-  } else if (ObjCCategoryImplDecl *CatImpDecl = 
+  } else if (ObjCCategoryImplDecl *CatImpDecl =
              dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) {
     if (MethodType == tok::minus) {
       PrevMethod = CatImpDecl->getInstanceMethod(Sel);
@@ -1774,11 +1772,11 @@
     Diag(ObjCMethod->getLocation(), diag::err_duplicate_method_decl)
       << ObjCMethod->getDeclName();
     Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
-  } 
+  }
   return DeclPtrTy::make(ObjCMethod);
 }
 
-void Sema::CheckObjCPropertyAttributes(QualType PropertyTy, 
+void Sema::CheckObjCPropertyAttributes(QualType PropertyTy,
                                        SourceLocation Loc,
                                        unsigned &Attributes) {
   // FIXME: Improve the reported location.
@@ -1795,8 +1793,8 @@
                           "assign" :
                          (Attributes & ObjCDeclSpec::DQ_PR_copy) ?
                           "copy" : "retain";
-                         
-    Diag(Loc, (Attributes & (ObjCDeclSpec::DQ_PR_readwrite)) ? 
+
+    Diag(Loc, (Attributes & (ObjCDeclSpec::DQ_PR_readwrite)) ?
                  diag::err_objc_property_attr_mutually_exclusive :
                  diag::warn_objc_property_attr_mutually_exclusive)
       << "readonly" << which;
@@ -1804,8 +1802,8 @@
 
   // Check for copy or retain on non-object types.
   if ((Attributes & (ObjCDeclSpec::DQ_PR_copy | ObjCDeclSpec::DQ_PR_retain)) &&
-      !PropertyTy->isObjCObjectPointerType() && 
-      !PropertyTy->isBlockPointerType() && 
+      !PropertyTy->isObjCObjectPointerType() &&
+      !PropertyTy->isBlockPointerType() &&
       !Context.isObjCNSObjectType(PropertyTy)) {
     Diag(Loc, diag::err_objc_property_requires_object)
       << (Attributes & ObjCDeclSpec::DQ_PR_copy ? "copy" : "retain");
@@ -1818,7 +1816,7 @@
       Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
         << "assign" << "copy";
       Attributes &= ~ObjCDeclSpec::DQ_PR_copy;
-    } 
+    }
     if (Attributes & ObjCDeclSpec::DQ_PR_retain) {
       Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
         << "assign" << "retain";
@@ -1839,13 +1837,13 @@
       !(Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
       PropertyTy->isObjCObjectPointerType()) {
     // Skip this warning in gc-only mode.
-    if (getLangOptions().getGCMode() != LangOptions::GCOnly)    
+    if (getLangOptions().getGCMode() != LangOptions::GCOnly)
       Diag(Loc, diag::warn_objc_property_no_assignment_attribute);
 
     // If non-gc code warn that this is likely inappropriate.
     if (getLangOptions().getGCMode() == LangOptions::NonGC)
       Diag(Loc, diag::warn_objc_property_default_assign_on_object);
-    
+
     // FIXME: Implement warning dependent on NSCopying being
     // implemented. See also:
     // <rdar://5168496&4855821&5607453&5096644&4947311&5698469&4947014&5168496>
@@ -1858,7 +1856,7 @@
     Diag(Loc, diag::warn_objc_property_copy_missing_on_block);
 }
 
-Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, 
+Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
                                     FieldDeclarator &FD,
                                     ObjCDeclSpec &ODS,
                                     Selector GetterSel,
@@ -1870,11 +1868,11 @@
   bool isReadWrite = ((Attributes & ObjCDeclSpec::DQ_PR_readwrite) ||
                       // default is readwrite!
                       !(Attributes & ObjCDeclSpec::DQ_PR_readonly));
-  // property is defaulted to 'assign' if it is readwrite and is 
+  // property is defaulted to 'assign' if it is readwrite and is
   // not retain or copy
   bool isAssign = ((Attributes & ObjCDeclSpec::DQ_PR_assign) ||
-                   (isReadWrite && 
-                    !(Attributes & ObjCDeclSpec::DQ_PR_retain) && 
+                   (isReadWrite &&
+                    !(Attributes & ObjCDeclSpec::DQ_PR_retain) &&
                     !(Attributes & ObjCDeclSpec::DQ_PR_copy)));
   QualType T = GetTypeForDeclarator(FD.D, S);
   Decl *ClassDecl = ClassCategory.getAs<Decl>();
@@ -1883,20 +1881,20 @@
   CheckObjCPropertyAttributes(T, AtLoc, Attributes);
   if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl))
     if (!CDecl->getIdentifier()) {
-      // This is a continuation class. property requires special 
+      // This is a continuation class. property requires special
       // handling.
       if ((CCPrimary = CDecl->getClassInterface())) {
         // Find the property in continuation class's primary class only.
         ObjCPropertyDecl *PIDecl = 0;
         IdentifierInfo *PropertyId = FD.D.getIdentifier();
-        for (ObjCInterfaceDecl::prop_iterator 
+        for (ObjCInterfaceDecl::prop_iterator
                I = CCPrimary->prop_begin(), E = CCPrimary->prop_end();
              I != E; ++I)
           if ((*I)->getIdentifier() == PropertyId) {
             PIDecl = *I;
             break;
           }
-            
+
         if (PIDecl) {
           // property 'PIDecl's readonly attribute will be over-ridden
           // with continuation class's readwrite property attribute!
@@ -1912,10 +1910,10 @@
               PIDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy);
             PIDecl->setSetterName(SetterSel);
           } else
-            Diag(AtLoc, diag::err_use_continuation_class) 
+            Diag(AtLoc, diag::err_use_continuation_class)
               << CCPrimary->getDeclName();
           *isOverridingProperty = true;
-          // Make sure setter decl is synthesized, and added to primary 
+          // Make sure setter decl is synthesized, and added to primary
           // class's list.
           ProcessPropertyDecl(PIDecl, CCPrimary);
           return DeclPtrTy();
@@ -1927,72 +1925,72 @@
         Diag(CDecl->getLocation(), diag::err_continuation_class);
         *isOverridingProperty = true;
         return DeclPtrTy();
-      } 
+      }
     }
-  
+
   // Issue a warning if property is 'assign' as default and its object, which is
-  // gc'able conforms to NSCopying protocol 
+  // gc'able conforms to NSCopying protocol
   if (getLangOptions().getGCMode() != LangOptions::NonGC &&
       isAssign && !(Attributes & ObjCDeclSpec::DQ_PR_assign))
       if (T->isObjCObjectPointerType()) {
         QualType InterfaceTy = T->getPointeeType();
-        if (const ObjCInterfaceType *OIT = 
+        if (const ObjCInterfaceType *OIT =
               InterfaceTy->getAsObjCInterfaceType()) {
         ObjCInterfaceDecl *IDecl = OIT->getDecl();
         if (IDecl)
-          if (ObjCProtocolDecl* PNSCopying = 
+          if (ObjCProtocolDecl* PNSCopying =
                 LookupProtocol(&Context.Idents.get("NSCopying")))
             if (IDecl->ClassImplementsProtocol(PNSCopying, true))
-              Diag(AtLoc, diag::warn_implements_nscopying)  
+              Diag(AtLoc, diag::warn_implements_nscopying)
                 << FD.D.getIdentifier();
         }
       }
   if (T->isObjCInterfaceType())
     Diag(FD.D.getIdentifierLoc(), diag::err_statically_allocated_object);
-  
+
   DeclContext *DC = dyn_cast<DeclContext>(ClassDecl);
   assert(DC && "ClassDecl is not a DeclContext");
   ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC,
-                                                     FD.D.getIdentifierLoc(), 
+                                                     FD.D.getIdentifierLoc(),
                                                      FD.D.getIdentifier(), T);
   DC->addDecl(PDecl);
-  
+
   if (T->isArrayType() || T->isFunctionType()) {
     Diag(AtLoc, diag::err_property_type) << T;
     PDecl->setInvalidDecl();
   }
-  
+
   ProcessDeclAttributes(S, PDecl, FD.D);
 
   // Regardless of setter/getter attribute, we save the default getter/setter
   // selector names in anticipation of declaration of setter/getter methods.
   PDecl->setGetterName(GetterSel);
   PDecl->setSetterName(SetterSel);
-  
+
   if (Attributes & ObjCDeclSpec::DQ_PR_readonly)
     PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readonly);
-  
+
   if (Attributes & ObjCDeclSpec::DQ_PR_getter)
     PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_getter);
-  
+
   if (Attributes & ObjCDeclSpec::DQ_PR_setter)
     PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_setter);
-  
+
   if (isReadWrite)
     PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readwrite);
-  
+
   if (Attributes & ObjCDeclSpec::DQ_PR_retain)
     PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_retain);
-  
+
   if (Attributes & ObjCDeclSpec::DQ_PR_copy)
     PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy);
-  
+
   if (isAssign)
     PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_assign);
-  
+
   if (Attributes & ObjCDeclSpec::DQ_PR_nonatomic)
     PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_nonatomic);
-  
+
   if (MethodImplKind == tok::objc_required)
     PDecl->setPropertyImplementation(ObjCPropertyDecl::Required);
   else if (MethodImplKind == tok::objc_optional)
@@ -2002,7 +2000,7 @@
   // Make sure setter/getters are declared here.
   if (CCPrimary)
     ProcessPropertyDecl(PDecl, CCPrimary);
-  
+
   return DeclPtrTy::make(PDecl);
 }
 
@@ -2010,9 +2008,9 @@
 /// builds the AST node for a property implementation declaration; declared
 /// as @synthesize or @dynamic.
 ///
-Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, 
+Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
                                             SourceLocation PropertyLoc,
-                                            bool Synthesize, 
+                                            bool Synthesize,
                                             DeclPtrTy ClassCatImpDecl,
                                             IdentifierInfo *PropertyId,
                                             IdentifierInfo *PropertyIvar) {
@@ -2032,9 +2030,9 @@
     IDecl = IC->getClassInterface();
     // We always synthesize an interface for an implementation
     // without an interface decl. So, IDecl is always non-zero.
-    assert(IDecl && 
+    assert(IDecl &&
            "ActOnPropertyImplDecl - @implementation without @interface");
-    
+
     // Look for this property declaration in the @implementation's @interface
     property = IDecl->FindPropertyDeclaration(PropertyId);
     if (!property) {
@@ -2045,15 +2043,15 @@
     if (Synthesize) {
       Diag(AtLoc, diag::error_synthesize_category_decl);
       return DeclPtrTy();
-    }    
+    }
     IDecl = CatImplClass->getClassInterface();
     if (!IDecl) {
       Diag(AtLoc, diag::error_missing_property_interface);
       return DeclPtrTy();
     }
-    ObjCCategoryDecl *Category = 
+    ObjCCategoryDecl *Category =
       IDecl->FindCategoryDeclaration(CatImplClass->getIdentifier());
-    
+
     // If category for this implementation not found, it is an error which
     // has already been reported eralier.
     if (!Category)
@@ -2081,10 +2079,10 @@
     Ivar = IDecl->lookupInstanceVariable(PropertyIvar, ClassDeclared);
     if (!Ivar) {
       DeclContext *EnclosingContext = cast_or_null<DeclContext>(IDecl);
-      assert(EnclosingContext && 
+      assert(EnclosingContext &&
              "null DeclContext for synthesized ivar - ActOnPropertyImplDecl");
-      Ivar = ObjCIvarDecl::Create(Context, EnclosingContext, PropertyLoc, 
-                                  PropertyIvar, PropType, /*Dinfo=*/0, 
+      Ivar = ObjCIvarDecl::Create(Context, EnclosingContext, PropertyLoc,
+                                  PropertyIvar, PropType, /*Dinfo=*/0,
                                   ObjCIvarDecl::Public,
                                   (Expr *)0);
       Ivar->setLexicalDeclContext(IDecl);
@@ -2092,34 +2090,34 @@
       property->setPropertyIvarDecl(Ivar);
       if (!getLangOptions().ObjCNonFragileABI)
         Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId;
-        // Note! I deliberately want it to fall thru so, we have a 
+        // Note! I deliberately want it to fall thru so, we have a
         // a property implementation and to avoid future warnings.
     } else if (getLangOptions().ObjCNonFragileABI &&
                ClassDeclared != IDecl) {
       Diag(PropertyLoc, diag::error_ivar_in_superclass_use)
-        << property->getDeclName() << Ivar->getDeclName() 
+        << property->getDeclName() << Ivar->getDeclName()
         << ClassDeclared->getDeclName();
       Diag(Ivar->getLocation(), diag::note_previous_access_declaration)
         << Ivar << Ivar->getNameAsCString();
       // Note! I deliberately want it to fall thru so more errors are caught.
     }
     QualType IvarType = Context.getCanonicalType(Ivar->getType());
-    
+
     // Check that type of property and its ivar are type compatible.
     if (PropType != IvarType) {
       if (CheckAssignmentConstraints(PropType, IvarType) != Compatible) {
         Diag(PropertyLoc, diag::error_property_ivar_type)
           << property->getDeclName() << Ivar->getDeclName();
-        // Note! I deliberately want it to fall thru so, we have a 
+        // Note! I deliberately want it to fall thru so, we have a
         // a property implementation and to avoid future warnings.
       }
-      
+
       // FIXME! Rules for properties are somewhat different that those
       // for assignments. Use a new routine to consolidate all cases;
       // specifically for property redeclarations as well as for ivars.
       QualType lhsType =Context.getCanonicalType(PropType).getUnqualifiedType();
       QualType rhsType =Context.getCanonicalType(IvarType).getUnqualifiedType();
-      if (lhsType != rhsType && 
+      if (lhsType != rhsType &&
           lhsType->isArithmeticType()) {
         Diag(PropertyLoc, diag::error_property_ivar_type)
         << property->getDeclName() << Ivar->getDeclName();
@@ -2132,36 +2130,36 @@
         << property->getDeclName() << Ivar->getDeclName();
         // Fall thru - see previous comment
       }
-      if ((property->getType()->isObjCObjectPointerType() || 
+      if ((property->getType()->isObjCObjectPointerType() ||
            PropType.isObjCGCStrong()) && IvarType.isObjCGCWeak() &&
            getLangOptions().getGCMode() != LangOptions::NonGC) {
         Diag(PropertyLoc, diag::error_strong_property)
         << property->getDeclName() << Ivar->getDeclName();
-        // Fall	thru - see previous comment
+        // Fall thru - see previous comment
       }
     }
   } else if (PropertyIvar)
       // @dynamic
       Diag(PropertyLoc, diag::error_dynamic_property_ivar_decl);
   assert (property && "ActOnPropertyImplDecl - property declaration missing");
-  ObjCPropertyImplDecl *PIDecl = 
-    ObjCPropertyImplDecl::Create(Context, CurContext, AtLoc, PropertyLoc, 
-                                 property, 
-                                 (Synthesize ? 
-                                  ObjCPropertyImplDecl::Synthesize 
+  ObjCPropertyImplDecl *PIDecl =
+    ObjCPropertyImplDecl::Create(Context, CurContext, AtLoc, PropertyLoc,
+                                 property,
+                                 (Synthesize ?
+                                  ObjCPropertyImplDecl::Synthesize
                                   : ObjCPropertyImplDecl::Dynamic),
                                  Ivar);
   if (IC) {
     if (Synthesize)
-      if (ObjCPropertyImplDecl *PPIDecl = 
+      if (ObjCPropertyImplDecl *PPIDecl =
           IC->FindPropertyImplIvarDecl(PropertyIvar)) {
-        Diag(PropertyLoc, diag::error_duplicate_ivar_use) 
-          << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier() 
+        Diag(PropertyLoc, diag::error_duplicate_ivar_use)
+          << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier()
           << PropertyIvar;
         Diag(PPIDecl->getLocation(), diag::note_previous_use);
       }
-    
-    if (ObjCPropertyImplDecl *PPIDecl 
+
+    if (ObjCPropertyImplDecl *PPIDecl
           = IC->FindPropertyImplDecl(PropertyId)) {
       Diag(PropertyLoc, diag::error_property_implemented) << PropertyId;
       Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
@@ -2170,39 +2168,39 @@
     IC->addPropertyImplementation(PIDecl);
   } else {
     if (Synthesize)
-      if (ObjCPropertyImplDecl *PPIDecl = 
+      if (ObjCPropertyImplDecl *PPIDecl =
           CatImplClass->FindPropertyImplIvarDecl(PropertyIvar)) {
-        Diag(PropertyLoc, diag::error_duplicate_ivar_use) 
-          << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier() 
+        Diag(PropertyLoc, diag::error_duplicate_ivar_use)
+          << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier()
           << PropertyIvar;
         Diag(PPIDecl->getLocation(), diag::note_previous_use);
       }
-    
-    if (ObjCPropertyImplDecl *PPIDecl = 
+
+    if (ObjCPropertyImplDecl *PPIDecl =
           CatImplClass->FindPropertyImplDecl(PropertyId)) {
       Diag(PropertyLoc, diag::error_property_implemented) << PropertyId;
       Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
       return DeclPtrTy();
-    }    
+    }
     CatImplClass->addPropertyImplementation(PIDecl);
   }
-    
+
   return DeclPtrTy::make(PIDecl);
 }
 
 bool Sema::CheckObjCDeclScope(Decl *D) {
   if (isa<TranslationUnitDecl>(CurContext->getLookupContext()))
     return false;
-  
+
   Diag(D->getLocation(), diag::err_objc_decls_may_only_appear_in_global_scope);
   D->setInvalidDecl();
-  
+
   return true;
 }
 
 /// Called whenever @defs(ClassName) is encountered in the source.  Inserts the
 /// instance variables of ClassName into Decls.
-void Sema::ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart, 
+void Sema::ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
                      IdentifierInfo *ClassName,
                      llvm::SmallVectorImpl<DeclPtrTy> &Decls) {
   // Check that ClassName is a valid class
@@ -2215,7 +2213,7 @@
     Diag(DeclStart, diag::err_atdef_nonfragile_interface);
     return;
   }
-  
+
   // Collect the instance variables
   llvm::SmallVector<FieldDecl*, 32> RecFields;
   Context.CollectObjCIvars(Class, RecFields);
@@ -2228,7 +2226,7 @@
                                            ID->getBitWidth());
     Decls.push_back(Sema::DeclPtrTy::make(FD));
   }
-  
+
   // Introduce all of these fields into the appropriate scope.
   for (llvm::SmallVectorImpl<DeclPtrTy>::iterator D = Decls.begin();
        D != Decls.end(); ++D) {

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Sep  9 10:08:12 2009
@@ -46,12 +46,12 @@
     // stuff. Don't warn if we are implementing a deprecated
     // construct.
     bool isSilenced = false;
-    
+
     if (NamedDecl *ND = getCurFunctionOrMethodDecl()) {
       // If this reference happens *in* a deprecated function or method, don't
       // warn.
       isSilenced = ND->getAttr<DeprecatedAttr>();
-      
+
       // If this is an Objective-C method implementation, check to see if the
       // method was deprecated on the declaration, not the definition.
       if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(ND)) {
@@ -59,14 +59,14 @@
         // ObjCImplementationDecl.
         if (ObjCImplementationDecl *Impl
               = dyn_cast<ObjCImplementationDecl>(MD->getParent())) {
-          
+
           MD = Impl->getClassInterface()->getMethod(MD->getSelector(),
                                                     MD->isInstanceMethod());
           isSilenced |= MD && MD->getAttr<DeprecatedAttr>();
         }
       }
     }
-    
+
     if (!isSilenced)
       Diag(Loc, diag::warn_deprecated) << D->getDeclName();
   }
@@ -90,18 +90,17 @@
 }
 
 /// DiagnoseSentinelCalls - This routine checks on method dispatch calls
-/// (and other functions in future), which have been declared with sentinel 
+/// (and other functions in future), which have been declared with sentinel
 /// attribute. It warns if call does not have the sentinel argument.
 ///
 void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
-                                 Expr **Args, unsigned NumArgs)
-{
+                                 Expr **Args, unsigned NumArgs) {
   const SentinelAttr *attr = D->getAttr<SentinelAttr>();
-  if (!attr) 
+  if (!attr)
     return;
   int sentinelPos = attr->getSentinel();
   int nullPos = attr->getNullPos();
-  
+
   // FIXME. ObjCMethodDecl and FunctionDecl need be derived from the same common
   // base class. Then we won't be needing two versions of the same code.
   unsigned int i = 0;
@@ -132,7 +131,7 @@
     // block or function pointer call.
     QualType Ty = V->getType();
     if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) {
-      const FunctionType *FT = Ty->isFunctionPointerType() 
+      const FunctionType *FT = Ty->isFunctionPointerType()
       ? Ty->getAs<PointerType>()->getPointeeType()->getAsFunctionType()
       : Ty->getAs<BlockPointerType>()->getPointeeType()->getAsFunctionType();
       if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FT)) {
@@ -196,7 +195,7 @@
   assert(!Ty.isNull() && "DefaultFunctionArrayConversion - missing type");
 
   if (Ty->isFunctionType())
-    ImpCastExprToType(E, Context.getPointerType(Ty), 
+    ImpCastExprToType(E, Context.getPointerType(Ty),
                       CastExpr::CK_FunctionToPointerDecay);
   else if (Ty->isArrayType()) {
     // In C90 mode, arrays only promote to pointers if the array expression is
@@ -218,14 +217,14 @@
 }
 
 /// UsualUnaryConversions - Performs various conversions that are common to most
-/// operators (C99 6.3). The conversions of array and function types are 
+/// operators (C99 6.3). The conversions of array and function types are
 /// sometimes surpressed. For example, the array->pointer conversion doesn't
 /// apply if the array is an argument to the sizeof or address (&) operators.
 /// In these instances, this routine should *not* be called.
 Expr *Sema::UsualUnaryConversions(Expr *&Expr) {
   QualType Ty = Expr->getType();
   assert(!Ty.isNull() && "UsualUnaryConversions - missing type");
-  
+
   // C99 6.3.1.1p2:
   //
   //   The following may be used in an expression wherever an int or
@@ -255,17 +254,17 @@
 }
 
 /// DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
-/// do not have a prototype. Arguments that have type float are promoted to 
+/// do not have a prototype. Arguments that have type float are promoted to
 /// double. All other argument types are converted by UsualUnaryConversions().
 void Sema::DefaultArgumentPromotion(Expr *&Expr) {
   QualType Ty = Expr->getType();
   assert(!Ty.isNull() && "DefaultArgumentPromotion - missing type");
-  
+
   // If this is a 'float' (CVR qualified or typedef) promote to double.
   if (const BuiltinType *BT = Ty->getAsBuiltinType())
     if (BT->getKind() == BuiltinType::Float)
       return ImpCastExprToType(Expr, Context.DoubleTy);
-  
+
   UsualUnaryConversions(Expr);
 }
 
@@ -275,14 +274,14 @@
 /// completely illegal.
 bool Sema::DefaultVariadicArgumentPromotion(Expr *&Expr, VariadicCallType CT) {
   DefaultArgumentPromotion(Expr);
-  
+
   if (Expr->getType()->isObjCInterfaceType()) {
     Diag(Expr->getLocStart(),
          diag::err_cannot_pass_objc_interface_to_vararg)
       << Expr->getType() << CT;
     return true;
   }
-  
+
   if (!Expr->getType()->isPODType())
     Diag(Expr->getLocStart(), diag::warn_cannot_pass_non_pod_arg_to_vararg)
       << Expr->getType() << CT;
@@ -293,7 +292,7 @@
 
 /// UsualArithmeticConversions - Performs various conversions that are common to
 /// binary operators (C99 6.3.1.8). If both operands aren't arithmetic, this
-/// routine returns the first non-arithmetic type found. The client is 
+/// routine returns the first non-arithmetic type found. The client is
 /// responsible for emitting appropriate error diagnostics.
 /// FIXME: verify the conversion rules for "complex int" are consistent with
 /// GCC.
@@ -304,11 +303,11 @@
 
   UsualUnaryConversions(rhsExpr);
 
-  // For conversion purposes, we ignore any qualifiers. 
+  // For conversion purposes, we ignore any qualifiers.
   // For example, "const float" and "float" are equivalent.
   QualType lhs =
     Context.getCanonicalType(lhsExpr->getType()).getUnqualifiedType();
-  QualType rhs = 
+  QualType rhs =
     Context.getCanonicalType(rhsExpr->getType()).getUnqualifiedType();
 
   // If both types are identical, no conversion is needed.
@@ -372,9 +371,9 @@
   StrTy = Context.getConstantArrayType(StrTy,
                                  llvm::APInt(32, Literal.GetNumStringChars()+1),
                                        ArrayType::Normal, 0);
-  
+
   // Pass &StringTokLocs[0], StringTokLocs.size() to factory!
-  return Owned(StringLiteral::Create(Context, Literal.GetString(), 
+  return Owned(StringLiteral::Create(Context, Literal.GetString(),
                                      Literal.GetStringLength(),
                                      Literal.AnyWide, StrTy,
                                      &StringTokLocs[0],
@@ -395,7 +394,7 @@
   // we wanted to.
   if (CurBlock->TheDecl == VD->getDeclContext())
     return false;
-  
+
   // If this is an enum constant or function, it is constant, don't snapshot.
   if (isa<EnumConstantDecl>(VD) || isa<FunctionDecl>(VD))
     return false;
@@ -406,7 +405,7 @@
   if (const VarDecl *Var = dyn_cast<VarDecl>(VD))
     if (!Var->hasLocalStorage())
       return false;
-  
+
   // Blocks that have these can't be constant.
   CurBlock->hasBlockDeclRefExprs = true;
 
@@ -420,15 +419,15 @@
     // having a reference outside it.
     if (NextBlock->TheDecl == VD->getDeclContext())
       break;
-    
+
     // Otherwise, the DeclRef from the inner block causes the outer one to need
     // a snapshot as well.
     NextBlock->hasBlockDeclRefExprs = true;
   }
-  
+
   return true;
-}  
-    
+}
+
 
 
 /// ActOnIdentifierExpr - The parser read an identifier in expression context,
@@ -454,35 +453,35 @@
                        const CXXScopeSpec *SS) {
   if (Context.getCanonicalType(Ty) == Context.UndeducedAutoTy) {
     Diag(Loc,
-         diag::err_auto_variable_cannot_appear_in_own_initializer) 
+         diag::err_auto_variable_cannot_appear_in_own_initializer)
       << D->getDeclName();
     return ExprError();
   }
-  
+
   if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
     if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext)) {
       if (const FunctionDecl *FD = MD->getParent()->isLocalClass()) {
         if (VD->hasLocalStorage() && VD->getDeclContext() != CurContext) {
-          Diag(Loc, diag::err_reference_to_local_var_in_enclosing_function) 
+          Diag(Loc, diag::err_reference_to_local_var_in_enclosing_function)
             << D->getIdentifier() << FD->getDeclName();
-          Diag(D->getLocation(), diag::note_local_variable_declared_here) 
+          Diag(D->getLocation(), diag::note_local_variable_declared_here)
             << D->getIdentifier();
           return ExprError();
         }
       }
     }
   }
-  
+
   MarkDeclarationReferenced(Loc, D);
-  
+
   Expr *E;
   if (SS && !SS->isEmpty()) {
-    E = new (Context) QualifiedDeclRefExpr(D, Ty, Loc, TypeDependent, 
+    E = new (Context) QualifiedDeclRefExpr(D, Ty, Loc, TypeDependent,
                                           ValueDependent, SS->getRange(),
                   static_cast<NestedNameSpecifier *>(SS->getScopeRep()));
   } else
     E = new (Context) DeclRefExpr(D, Ty, Loc, TypeDependent, ValueDependent);
-  
+
   return Owned(E);
 }
 
@@ -491,14 +490,14 @@
 /// is Record.
 static Decl *getObjectForAnonymousRecordDecl(ASTContext &Context,
                                              RecordDecl *Record) {
-  assert(Record->isAnonymousStructOrUnion() && 
+  assert(Record->isAnonymousStructOrUnion() &&
          "Record must be an anonymous struct or union!");
-  
+
   // FIXME: Once Decls are directly linked together, this will be an O(1)
   // operation rather than a slow walk through DeclContext's vector (which
   // itself will be eliminated). DeclGroups might make this even better.
   DeclContext *Ctx = Record->getDeclContext();
-  for (DeclContext::decl_iterator D = Ctx->decls_begin(), 
+  for (DeclContext::decl_iterator D = Ctx->decls_begin(),
                                DEnd = Ctx->decls_end();
        D != DEnd; ++D) {
     if (*D == Record) {
@@ -547,7 +546,7 @@
       break;
     }
     Ctx = Ctx->getParent();
-  } while (Ctx->isRecord() && 
+  } while (Ctx->isRecord() &&
            cast<RecordDecl>(Ctx)->isAnonymousStructOrUnion());
 
   return BaseObject;
@@ -559,7 +558,7 @@
                                                Expr *BaseObjectExpr,
                                                SourceLocation OpLoc) {
   llvm::SmallVector<FieldDecl *, 4> AnonFields;
-  VarDecl *BaseObject = BuildAnonymousStructUnionMemberPath(Field, 
+  VarDecl *BaseObject = BuildAnonymousStructUnionMemberPath(Field,
                                                             AnonFields);
 
   // Build the expression that refers to the base object, from
@@ -575,7 +574,7 @@
     MarkDeclarationReferenced(Loc, BaseObject);
     BaseObjectExpr = new (Context) DeclRefExpr(BaseObject,BaseObject->getType(),
                                                SourceLocation());
-    ExtraQuals 
+    ExtraQuals
       = Context.getCanonicalType(BaseObject->getType()).getCVRQualifiers();
   } else if (BaseObjectExpr) {
     // The caller provided the base object expression. Determine
@@ -593,11 +592,11 @@
     // program our base object expression is "this".
     if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext)) {
       if (!MD->isStatic()) {
-        QualType AnonFieldType 
+        QualType AnonFieldType
           = Context.getTagDeclType(
                      cast<RecordDecl>(AnonFields.back()->getDeclContext()));
         QualType ThisType = Context.getTagDeclType(MD->getParent());
-        if ((Context.getCanonicalType(AnonFieldType) 
+        if ((Context.getCanonicalType(AnonFieldType)
                == Context.getCanonicalType(ThisType)) ||
             IsDerivedFrom(ThisType, AnonFieldType)) {
           // Our base object expression is "this".
@@ -612,7 +611,7 @@
       ExtraQuals = MD->getTypeQualifiers();
     }
 
-    if (!BaseObjectExpr) 
+    if (!BaseObjectExpr)
       return ExprError(Diag(Loc, diag::err_invalid_non_static_member_use)
         << Field->getDeclName());
   }
@@ -626,7 +625,7 @@
        FI != FIEnd; ++FI) {
     QualType MemberType = (*FI)->getType();
     if (!(*FI)->isMutable()) {
-      unsigned combinedQualifiers 
+      unsigned combinedQualifiers
         = MemberType.getCVRQualifiers() | ExtraQuals;
       MemberType = MemberType.getQualifiedType(combinedQualifiers);
     }
@@ -665,7 +664,7 @@
 Sema::OwningExprResult
 Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
                                DeclarationName Name, bool HasTrailingLParen,
-                               const CXXScopeSpec *SS, 
+                               const CXXScopeSpec *SS,
                                bool isAddressOfOperand) {
   // Could be enum-constant, value decl, instance variable, etc.
   if (SS && SS->isInvalid())
@@ -678,7 +677,7 @@
   // FIXME: Member of the current instantiation.
   if (SS && isDependentScopeSpecifier(*SS)) {
     return Owned(new (Context) UnresolvedDeclRefExpr(Name, Context.DependentTy,
-                                                     Loc, SS->getRange(), 
+                                                     Loc, SS->getRange(),
                 static_cast<NestedNameSpecifier *>(SS->getScopeRep()),
                                                      isAddressOfOperand));
   }
@@ -692,7 +691,7 @@
                                               : SourceRange());
     return ExprError();
   }
-  
+
   NamedDecl *D = Lookup.getAsDecl();
 
   // If this reference is in an Objective-C method, then ivar lookup happens as
@@ -701,8 +700,8 @@
   if (II && getCurMethodDecl()) {
     // There are two cases to handle here.  1) scoped lookup could have failed,
     // in which case we should look for an ivar.  2) scoped lookup could have
-    // found a decl, but that decl is outside the current instance method (i.e. 
-    // a global variable).  In these two cases, we do a lookup for an ivar with 
+    // found a decl, but that decl is outside the current instance method (i.e.
+    // a global variable).  In these two cases, we do a lookup for an ivar with
     // this name, if the lookup sucedes, we replace it our current decl.
     if (D == 0 || D->isDefinedOutsideFunctionOrMethod()) {
       ObjCInterfaceDecl *IFace = getCurMethodDecl()->getClassInterface();
@@ -711,12 +710,12 @@
         // Check if referencing a field with __attribute__((deprecated)).
         if (DiagnoseUseOfDecl(IV, Loc))
           return ExprError();
-        
+
         // If we're referencing an invalid decl, just return this as a silent
         // error node.  The error diagnostic was already emitted on the decl.
         if (IV->isInvalidDecl())
           return ExprError();
-        
+
         bool IsClsMethod = getCurMethodDecl()->isClassMethod();
         // If a class method attemps to use a free standing ivar, this is
         // an error.
@@ -735,8 +734,8 @@
           OwningExprResult SelfExpr = ActOnIdentifierExpr(S, SourceLocation(),
                                                           II, false);
           MarkDeclarationReferenced(Loc, IV);
-          return Owned(new (Context) 
-                       ObjCIvarRefExpr(IV, IV->getType(), Loc, 
+          return Owned(new (Context)
+                       ObjCIvarRefExpr(IV, IV->getType(), Loc,
                                        SelfExpr.takeAs<Expr>(), true, true));
         }
       }
@@ -753,7 +752,7 @@
     // Needed to implement property "super.method" notation.
     if (D == 0 && II->isStr("super")) {
       QualType T;
-      
+
       if (getCurMethodDecl()->isInstanceMethod())
         T = Context.getObjCObjectPointerType(Context.getObjCInterfaceType(
                                       getCurMethodDecl()->getClassInterface()));
@@ -765,7 +764,7 @@
 
   // Determine whether this name might be a candidate for
   // argument-dependent lookup.
-  bool ADL = getLangOptions().CPlusPlus && (!SS || !SS->isSet()) && 
+  bool ADL = getLangOptions().CPlusPlus && (!SS || !SS->isSet()) &&
              HasTrailingLParen;
 
   if (ADL && D == 0) {
@@ -791,7 +790,7 @@
       // If this name wasn't predeclared and if this is not a function call,
       // diagnose the problem.
       if (SS && !SS->isEmpty()) {
-        DiagnoseMissingMember(Loc, Name, 
+        DiagnoseMissingMember(Loc, Name,
                               (NestedNameSpecifier *)SS->getScopeRep(),
                               SS->getRange());
         return ExprError();
@@ -803,18 +802,18 @@
         return ExprError(Diag(Loc, diag::err_undeclared_var_use) << Name);
     }
   }
-  
+
   if (VarDecl *Var = dyn_cast<VarDecl>(D)) {
     // Warn about constructs like:
     //   if (void *X = foo()) { ... } else { X }.
     // In the else block, the pointer is always false.
-    
+
     // FIXME: In a template instantiation, we don't have scope
     // information to check this property.
     if (Var->isDeclaredInCondition() && Var->getType()->isScalarType()) {
       Scope *CheckS = S;
       while (CheckS) {
-        if (CheckS->isWithinElse() && 
+        if (CheckS->isWithinElse() &&
             CheckS->getControlParent()->isDeclScope(DeclPtrTy::make(Var))) {
           if (Var->getType()->isBooleanType())
             ExprError(Diag(Loc, diag::warn_value_always_false)
@@ -824,7 +823,7 @@
                       << Var->getDeclName());
           break;
         }
-        
+
         // Move up one more control parent to check again.
         CheckS = CheckS->getControlParent();
         if (CheckS)
@@ -848,16 +847,16 @@
       return BuildDeclRefExpr(Func, NoProtoType, Loc, false, false, SS);
     }
   }
-  
+
   return BuildDeclarationNameExpr(Loc, D, HasTrailingLParen, SS, isAddressOfOperand);
 }
 /// \brief Cast member's object to its own class if necessary.
 bool
 Sema::PerformObjectMemberConversion(Expr *&From, NamedDecl *Member) {
   if (FieldDecl *FD = dyn_cast<FieldDecl>(Member))
-    if (CXXRecordDecl *RD = 
+    if (CXXRecordDecl *RD =
         dyn_cast<CXXRecordDecl>(FD->getDeclContext())) {
-      QualType DestType = 
+      QualType DestType =
         Context.getCanonicalType(Context.getTypeDeclType(RD));
       if (DestType->isDependentType() || From->getType()->isDependentType())
         return false;
@@ -880,17 +879,17 @@
 }
 
 /// \brief Build a MemberExpr AST node.
-static MemberExpr *BuildMemberExpr(ASTContext &C, Expr *Base, bool isArrow, 
-                                   const CXXScopeSpec *SS, NamedDecl *Member, 
+static MemberExpr *BuildMemberExpr(ASTContext &C, Expr *Base, bool isArrow,
+                                   const CXXScopeSpec *SS, NamedDecl *Member,
                                    SourceLocation Loc, QualType Ty) {
   if (SS && SS->isSet())
-    return MemberExpr::Create(C, Base, isArrow, 
+    return MemberExpr::Create(C, Base, isArrow,
                               (NestedNameSpecifier *)SS->getScopeRep(),
-                              SS->getRange(), Member, Loc, 
+                              SS->getRange(), Member, Loc,
                               // FIXME: Explicit template argument lists
                               false, SourceLocation(), 0, 0, SourceLocation(),
                               Ty);
-  
+
   return new (C) MemberExpr(Base, isArrow, Member, Loc, Ty);
 }
 
@@ -898,11 +897,11 @@
 Sema::OwningExprResult
 Sema::BuildDeclarationNameExpr(SourceLocation Loc, NamedDecl *D,
                                bool HasTrailingLParen,
-                               const CXXScopeSpec *SS, 
+                               const CXXScopeSpec *SS,
                                bool isAddressOfOperand) {
   assert(D && "Cannot refer to a NULL declaration");
   DeclarationName Name = D->getDeclName();
-  
+
   // If this is an expression of the form &Class::member, don't build an
   // implicit member ref, because we want a pointer to the member in general,
   // not any specific instance's member.
@@ -935,7 +934,7 @@
 
   if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext)) {
     if (!MD->isStatic()) {
-      // C++ [class.mfct.nonstatic]p2: 
+      // C++ [class.mfct.nonstatic]p2:
       //   [...] if name lookup (3.4.1) resolves the name in the
       //   id-expression to a nonstatic nontype member of class X or of
       //   a base class of X, the id-expression is transformed into a
@@ -950,7 +949,7 @@
         if (const ReferenceType *RefType = MemberType->getAs<ReferenceType>())
           MemberType = RefType->getPointeeType();
         else if (!FD->isMutable()) {
-          unsigned combinedQualifiers 
+          unsigned combinedQualifiers
             = MemberType.getCVRQualifiers() | MD->getTypeQualifiers();
           MemberType = MemberType.getQualifiedType(combinedQualifiers);
         }
@@ -959,25 +958,25 @@
           Ctx = Method->getParent();
           MemberType = Method->getType();
         }
-      } else if (FunctionTemplateDecl *FunTmpl 
+      } else if (FunctionTemplateDecl *FunTmpl
                    = dyn_cast<FunctionTemplateDecl>(D)) {
-        if (CXXMethodDecl *Method 
+        if (CXXMethodDecl *Method
               = dyn_cast<CXXMethodDecl>(FunTmpl->getTemplatedDecl())) {
-          if (!Method->isStatic()) {          
+          if (!Method->isStatic()) {
             Ctx = Method->getParent();
             MemberType = Context.OverloadTy;
           }
         }
-      } else if (OverloadedFunctionDecl *Ovl 
+      } else if (OverloadedFunctionDecl *Ovl
                    = dyn_cast<OverloadedFunctionDecl>(D)) {
         // FIXME: We need an abstraction for iterating over one or more function
         // templates or functions. This code is far too repetitive!
-        for (OverloadedFunctionDecl::function_iterator 
+        for (OverloadedFunctionDecl::function_iterator
                Func = Ovl->function_begin(),
                FuncEnd = Ovl->function_end();
              Func != FuncEnd; ++Func) {
           CXXMethodDecl *DMethod = 0;
-          if (FunctionTemplateDecl *FunTmpl 
+          if (FunctionTemplateDecl *FunTmpl
                 = dyn_cast<FunctionTemplateDecl>(*Func))
             DMethod = dyn_cast<CXXMethodDecl>(FunTmpl->getTemplatedDecl());
           else
@@ -994,7 +993,7 @@
       if (Ctx && Ctx->isRecord()) {
         QualType CtxType = Context.getTagDeclType(cast<CXXRecordDecl>(Ctx));
         QualType ThisType = Context.getTagDeclType(MD->getParent());
-        if ((Context.getCanonicalType(CtxType) 
+        if ((Context.getCanonicalType(CtxType)
                == Context.getCanonicalType(ThisType)) ||
             IsDerivedFrom(ThisType, CtxType)) {
           // Build the implicit member access expression.
@@ -1042,8 +1041,8 @@
     return BuildDeclRefExpr(Template, Context.OverloadTy, Loc,
                             false, false, SS);
   else if (UnresolvedUsingDecl *UD = dyn_cast<UnresolvedUsingDecl>(D))
-    return BuildDeclRefExpr(UD, Context.DependentTy, Loc, 
-                            /*TypeDependent=*/true, 
+    return BuildDeclRefExpr(UD, Context.DependentTy, Loc,
+                            /*TypeDependent=*/true,
                             /*ValueDependent=*/true, SS);
 
   ValueDecl *VD = cast<ValueDecl>(D);
@@ -1052,7 +1051,7 @@
   // this check when we're going to perform argument-dependent lookup
   // on this function name, because this might not be the function
   // that overload resolution actually selects.
-  bool ADL = getLangOptions().CPlusPlus && (!SS || !SS->isSet()) && 
+  bool ADL = getLangOptions().CPlusPlus && (!SS || !SS->isSet()) &&
              HasTrailingLParen;
   if (!(ADL && isa<FunctionDecl>(VD)) && DiagnoseUseOfDecl(VD, Loc))
     return ExprError();
@@ -1078,9 +1077,9 @@
     // This is to record that a 'const' was actually synthesize and added.
     bool constAdded = !ExprTy.isConstQualified();
     // Variable will be bound by-copy, make it const within the closure.
-    
+
     ExprTy.addConst();
-    return Owned(new (Context) BlockDeclRefExpr(VD, ExprTy, Loc, false, 
+    return Owned(new (Context) BlockDeclRefExpr(VD, ExprTy, Loc, false,
                                                 constAdded));
   }
   // If this reference is not in a block or if the referenced variable is
@@ -1090,7 +1089,7 @@
   bool ValueDependent = false;
   if (getLangOptions().CPlusPlus) {
     // C++ [temp.dep.expr]p3:
-    //   An id-expression is type-dependent if it contains:   
+    //   An id-expression is type-dependent if it contains:
     //     - an identifier that was declared with a dependent type,
     if (VD->getType()->isDependentType())
       TypeDependent = true;
@@ -1151,7 +1150,7 @@
 
   // Pre-defined identifiers are of type char[x], where x is the length of the
   // string.
-  
+
   Decl *currentDecl = getCurFunctionOrMethodDecl();
   if (!currentDecl) {
     Diag(Loc, diag::ext_predef_outside_function);
@@ -1203,7 +1202,7 @@
   // Get the spelling of the token, which eliminates trigraphs, etc.
   unsigned ActualLength = PP.getSpelling(Tok, ThisTokBegin);
 
-  NumericLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength, 
+  NumericLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength,
                                Tok.getLocation(), PP);
   if (Literal.hadError)
     return ExprError();
@@ -1316,7 +1315,7 @@
 
   // If this is an imaginary literal, create the ImaginaryLiteral wrapper.
   if (Literal.isImaginary)
-    Res = new (Context) ImaginaryLiteral(Res, 
+    Res = new (Context) ImaginaryLiteral(Res,
                                         Context.getComplexType(Res->getType()));
 
   return Owned(Res);
@@ -1345,27 +1344,27 @@
       Diag(OpLoc, diag::ext_sizeof_function_type) << ExprRange;
     return false;
   }
-  
+
   // Allow sizeof(void)/alignof(void) as an extension.
   if (exprType->isVoidType()) {
     Diag(OpLoc, diag::ext_sizeof_void_type)
       << (isSizeof ? "sizeof" : "__alignof") << ExprRange;
     return false;
   }
-  
+
   if (RequireCompleteType(OpLoc, exprType,
-                          isSizeof ? diag::err_sizeof_incomplete_type : 
+                          isSizeof ? diag::err_sizeof_incomplete_type :
                           PDiag(diag::err_alignof_incomplete_type)
                             << ExprRange))
     return true;
-  
+
   // Reject sizeof(interface) and sizeof(interface<proto>) in 64-bit mode.
   if (LangOpts.ObjCNonFragileABI && exprType->isObjCInterfaceType()) {
     Diag(OpLoc, diag::err_sizeof_nonfragile_interface)
       << exprType << isSizeof << ExprRange;
     return true;
   }
-    
+
   return false;
 }
 
@@ -1373,7 +1372,7 @@
                             const SourceRange &ExprRange) {
   E = E->IgnoreParens();
 
-  // alignof decl is always ok. 
+  // alignof decl is always ok.
   if (isa<DeclRefExpr>(E))
     return false;
 
@@ -1396,8 +1395,8 @@
 }
 
 /// \brief Build a sizeof or alignof expression given a type operand.
-Action::OwningExprResult 
-Sema::CreateSizeOfAlignOfExpr(QualType T, SourceLocation OpLoc, 
+Action::OwningExprResult
+Sema::CreateSizeOfAlignOfExpr(QualType T, SourceLocation OpLoc,
                               bool isSizeOf, SourceRange R) {
   if (T.isNull())
     return ExprError();
@@ -1414,8 +1413,8 @@
 
 /// \brief Build a sizeof or alignof expression given an expression
 /// operand.
-Action::OwningExprResult 
-Sema::CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc, 
+Action::OwningExprResult
+Sema::CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc,
                               bool isSizeOf, SourceRange R) {
   // Verify that the operand is valid.
   bool isInvalid = false;
@@ -1452,7 +1451,7 @@
     // FIXME: Preserve type source info.
     QualType ArgTy = GetTypeFromParser(TyOrEx);
     return CreateSizeOfAlignOfExpr(ArgTy, OpLoc, isSizeof, ArgRange);
-  } 
+  }
 
   // Get the end location.
   Expr *ArgEx = (Expr *)TyOrEx;
@@ -1468,15 +1467,15 @@
 QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc, bool isReal) {
   if (V->isTypeDependent())
     return Context.DependentTy;
-  
+
   // These operators return the element type of a complex type.
   if (const ComplexType *CT = V->getType()->getAsComplexType())
     return CT->getElementType();
-  
+
   // Otherwise they pass through real integer and floating point types here.
   if (V->getType()->isArithmeticType())
     return V->getType();
-  
+
   // Reject anything else.
   Diag(Loc, diag::err_realimag_invalid_type) << V->getType()
     << (isReal ? "__real" : "__imag");
@@ -1514,9 +1513,9 @@
     //     for objects of that type. When the postfix increment is
     //     called as a result of using the ++ operator, the int
     //     argument will have value zero.
-    Expr *Args[2] = { 
-      Arg, 
-      new (Context) IntegerLiteral(llvm::APInt(Context.Target.getIntWidth(), 0, 
+    Expr *Args[2] = {
+      Arg,
+      new (Context) IntegerLiteral(llvm::APInt(Context.Target.getIntWidth(), 0,
                           /*isSigned=*/true), Context.IntTy, SourceLocation())
     };
 
@@ -1560,7 +1559,7 @@
         Input.release();
         Args[0] = Arg;
         return Owned(new (Context) CXXOperatorCallExpr(Context, OverOp, FnExpr,
-                                                       Args, 2, ResultTy, 
+                                                       Args, 2, ResultTy,
                                                        OpLoc));
       } else {
         // We matched a built-in operator. Convert the arguments, then
@@ -1613,7 +1612,7 @@
 
   Expr *LHSExp = static_cast<Expr*>(Base.get()),
        *RHSExp = static_cast<Expr*>(Idx.get());
-  
+
   if (getLangOptions().CPlusPlus &&
       (LHSExp->isTypeDependent() || RHSExp->isTypeDependent())) {
     Base.release();
@@ -1622,12 +1621,12 @@
                                                   Context.DependentTy, RLoc));
   }
 
-  if (getLangOptions().CPlusPlus && 
+  if (getLangOptions().CPlusPlus &&
       (LHSExp->getType()->isRecordType() ||
        LHSExp->getType()->isEnumeralType() ||
        RHSExp->getType()->isRecordType() ||
        RHSExp->getType()->isEnumeralType())) {
-    // Add the appropriate overloaded operators (C++ [over.match.oper]) 
+    // Add the appropriate overloaded operators (C++ [over.match.oper])
     // to the candidate set.
     OverloadCandidateSet CandidateSet;
     Expr *Args[2] = { LHSExp, RHSExp };
@@ -1648,7 +1647,7 @@
         // Convert the arguments.
         if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
           if (PerformObjectArgumentInitialization(LHSExp, Method) ||
-              PerformCopyInitialization(RHSExp, 
+              PerformCopyInitialization(RHSExp,
                                         FnDecl->getParamDecl(0)->getType(),
                                         "passing"))
             return ExprError();
@@ -1678,7 +1677,7 @@
         Args[0] = LHSExp;
         Args[1] = RHSExp;
         return Owned(new (Context) CXXOperatorCallExpr(Context, OO_Subscript,
-                                                       FnExpr, Args, 2, 
+                                                       FnExpr, Args, 2,
                                                        ResultTy, LLoc));
       } else {
         // We matched a built-in operator. Convert the arguments, then
@@ -1745,12 +1744,12 @@
     BaseExpr = RHSExp;
     IndexExpr = LHSExp;
     ResultType = PTy->getPointeeType();
-  } else if (const ObjCObjectPointerType *PTy = 
+  } else if (const ObjCObjectPointerType *PTy =
                LHSTy->getAsObjCObjectPointerType()) {
     BaseExpr = LHSExp;
     IndexExpr = RHSExp;
     ResultType = PTy->getPointeeType();
-  } else if (const ObjCObjectPointerType *PTy = 
+  } else if (const ObjCObjectPointerType *PTy =
                RHSTy->getAsObjCObjectPointerType()) {
      // Handle the uncommon case of "123[Ptr]".
     BaseExpr = RHSExp;
@@ -1797,28 +1796,28 @@
                      << IndexExpr->getSourceRange());
 
   // C99 6.5.2.1p1: "shall have type "pointer to *object* type". Similarly,
-  // C++ [expr.sub]p1: The type "T" shall be a completely-defined object 
-  // type. Note that Functions are not objects, and that (in C99 parlance) 
+  // C++ [expr.sub]p1: The type "T" shall be a completely-defined object
+  // type. Note that Functions are not objects, and that (in C99 parlance)
   // incomplete types are not object types.
   if (ResultType->isFunctionType()) {
     Diag(BaseExpr->getLocStart(), diag::err_subscript_function_type)
       << ResultType << BaseExpr->getSourceRange();
     return ExprError();
   }
-  
+
   if (!ResultType->isDependentType() &&
-      RequireCompleteType(LLoc, ResultType, 
+      RequireCompleteType(LLoc, ResultType,
                           PDiag(diag::err_subscript_incomplete_type)
                             << BaseExpr->getSourceRange()))
     return ExprError();
-  
+
   // Diagnose bad cases where we step over interface counts.
   if (ResultType->isObjCInterfaceType() && LangOpts.ObjCNonFragileABI) {
     Diag(LLoc, diag::err_subscript_nonfragile_interface)
       << ResultType << BaseExpr->getSourceRange();
     return ExprError();
   }
-  
+
   Base.release();
   Idx.release();
   return Owned(new (Context) ArraySubscriptExpr(LHSExp, RHSExp,
@@ -1827,7 +1826,7 @@
 
 QualType Sema::
 CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
-                        const IdentifierInfo *CompName, 
+                        const IdentifierInfo *CompName,
                         SourceLocation CompLoc) {
   const ExtVectorType *vecType = baseType->getAsExtVectorType();
 
@@ -1918,15 +1917,15 @@
                                                 IdentifierInfo *Member,
                                                 const Selector &Sel,
                                                 ASTContext &Context) {
-  
+
   if (ObjCPropertyDecl *PD = PDecl->FindPropertyDeclaration(Member))
     return PD;
   if (ObjCMethodDecl *OMD = PDecl->getInstanceMethod(Sel))
     return OMD;
-  
+
   for (ObjCProtocolDecl::protocol_iterator I = PDecl->protocol_begin(),
        E = PDecl->protocol_end(); I != E; ++I) {
-    if (Decl *D = FindGetterNameDeclFromProtocolList(*I, Member, Sel, 
+    if (Decl *D = FindGetterNameDeclFromProtocolList(*I, Member, Sel,
                                                      Context))
       return D;
   }
@@ -1972,16 +1971,16 @@
   ObjCMethodDecl *Method = 0;
   if (ObjCImplementationDecl *ImpDecl = IFace->getImplementation())
     Method = ImpDecl->getInstanceMethod(Sel);
-  
+
   if (!Method && IFace->getSuperClass())
     return FindMethodInNestedImplementations(IFace->getSuperClass(), Sel);
   return Method;
 }
-                       
-Action::OwningExprResult 
+
+Action::OwningExprResult
 Sema::BuildMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc,
                                tok::TokenKind OpKind, SourceLocation MemberLoc,
-                               DeclarationName MemberName, 
+                               DeclarationName MemberName,
                                bool HasExplicitTemplateArgs,
                                SourceLocation LAngleLoc,
                                const TemplateArgument *ExplicitTemplateArgs,
@@ -1997,7 +1996,7 @@
 
   Expr *BaseExpr = Base.takeAs<Expr>();
   assert(BaseExpr && "no base expression");
-  
+
   // Perform default conversions.
   DefaultFunctionArrayConversion(BaseExpr);
 
@@ -2028,8 +2027,8 @@
         if (!FirstQualifierInScope)
           FirstQualifierInScope = FindFirstQualifierInScope(S, Qualifier);
       }
-      
-      return Owned(CXXUnresolvedMemberExpr::Create(Context, BaseExpr, true, 
+
+      return Owned(CXXUnresolvedMemberExpr::Create(Context, BaseExpr, true,
                                                    OpLoc, Qualifier,
                                             SS? SS->getRange() : SourceRange(),
                                                    FirstQualifierInScope,
@@ -2051,17 +2050,17 @@
         << BaseType << BaseExpr->getSourceRange());
   } else {
     if (BaseType->isDependentType()) {
-      // Require that the base type isn't a pointer type 
+      // Require that the base type isn't a pointer type
       // (so we'll report an error for)
       // T* t;
       // t.f;
-      // 
+      //
       // In Obj-C++, however, the above expression is valid, since it could be
       // accessing the 'f' property if T is an Obj-C interface. The extra check
       // allows this, while still reporting an error if T is a struct pointer.
       const PointerType *PT = BaseType->getAs<PointerType>();
 
-      if (!PT || (getLangOptions().ObjC1 && 
+      if (!PT || (getLangOptions().ObjC1 &&
                   !PT->getPointeeType()->isRecordType())) {
         NestedNameSpecifier *Qualifier = 0;
         if (SS) {
@@ -2069,10 +2068,10 @@
           if (!FirstQualifierInScope)
             FirstQualifierInScope = FindFirstQualifierInScope(S, Qualifier);
         }
-        
+
         return Owned(CXXUnresolvedMemberExpr::Create(Context,
-                                                     BaseExpr, false, 
-                                                     OpLoc, 
+                                                     BaseExpr, false,
+                                                     OpLoc,
                                                      Qualifier,
                                             SS? SS->getRange() : SourceRange(),
                                                      FirstQualifierInScope,
@@ -2101,8 +2100,8 @@
       // If the member name was a qualified-id, look into the
       // nested-name-specifier.
       DC = computeDeclContext(*SS, false);
-      
-      // FIXME: If DC is not computable, we should build a 
+
+      // FIXME: If DC is not computable, we should build a
       // CXXUnresolvedMemberExpr.
       assert(DC && "Cannot handle non-computable dependent contexts in lookup");
     }
@@ -2119,22 +2118,22 @@
                               BaseExpr->getSourceRange());
       return ExprError();
     }
-    
+
     if (SS && SS->isSet()) {
-      QualType BaseTypeCanon 
+      QualType BaseTypeCanon
         = Context.getCanonicalType(BaseType).getUnqualifiedType();
-      QualType MemberTypeCanon 
+      QualType MemberTypeCanon
         = Context.getCanonicalType(
                   Context.getTypeDeclType(
                     dyn_cast<TypeDecl>(Result.getAsDecl()->getDeclContext())));
-      
+
       if (BaseTypeCanon != MemberTypeCanon &&
           !IsDerivedFrom(BaseTypeCanon, MemberTypeCanon))
         return ExprError(Diag(SS->getBeginLoc(),
                               diag::err_not_direct_base_or_virtual)
                          << MemberTypeCanon << BaseTypeCanon);
     }
-    
+
     NamedDecl *MemberDecl = Result;
 
     // If the decl being referenced had an error, return an error for this
@@ -2172,10 +2171,10 @@
       MarkDeclarationReferenced(MemberLoc, FD);
       if (PerformObjectMemberConversion(BaseExpr, FD))
         return ExprError();
-      return Owned(BuildMemberExpr(Context, BaseExpr, OpKind == tok::arrow, SS, 
+      return Owned(BuildMemberExpr(Context, BaseExpr, OpKind == tok::arrow, SS,
                                    FD, MemberLoc, MemberType));
     }
-    
+
     if (VarDecl *Var = dyn_cast<VarDecl>(MemberDecl)) {
       MarkDeclarationReferenced(MemberLoc, MemberDecl);
       return Owned(BuildMemberExpr(Context, BaseExpr, OpKind == tok::arrow, SS,
@@ -2188,19 +2187,19 @@
                                    MemberFn, MemberLoc,
                                    MemberFn->getType()));
     }
-    if (FunctionTemplateDecl *FunTmpl 
+    if (FunctionTemplateDecl *FunTmpl
           = dyn_cast<FunctionTemplateDecl>(MemberDecl)) {
       MarkDeclarationReferenced(MemberLoc, MemberDecl);
-      
+
       if (HasExplicitTemplateArgs)
-        return Owned(MemberExpr::Create(Context, BaseExpr, OpKind == tok::arrow, 
-                             (NestedNameSpecifier *)(SS? SS->getScopeRep() : 0), 
+        return Owned(MemberExpr::Create(Context, BaseExpr, OpKind == tok::arrow,
+                             (NestedNameSpecifier *)(SS? SS->getScopeRep() : 0),
                                        SS? SS->getRange() : SourceRange(),
-                                        FunTmpl, MemberLoc, true, 
-                                        LAngleLoc, ExplicitTemplateArgs, 
-                                        NumExplicitTemplateArgs, RAngleLoc, 
+                                        FunTmpl, MemberLoc, true,
+                                        LAngleLoc, ExplicitTemplateArgs,
+                                        NumExplicitTemplateArgs, RAngleLoc,
                                         Context.OverloadTy));
-      
+
       return Owned(BuildMemberExpr(Context, BaseExpr, OpKind == tok::arrow, SS,
                                    FunTmpl, MemberLoc,
                                    Context.OverloadTy));
@@ -2208,12 +2207,12 @@
     if (OverloadedFunctionDecl *Ovl
           = dyn_cast<OverloadedFunctionDecl>(MemberDecl)) {
       if (HasExplicitTemplateArgs)
-        return Owned(MemberExpr::Create(Context, BaseExpr, OpKind == tok::arrow, 
-                             (NestedNameSpecifier *)(SS? SS->getScopeRep() : 0), 
+        return Owned(MemberExpr::Create(Context, BaseExpr, OpKind == tok::arrow,
+                             (NestedNameSpecifier *)(SS? SS->getScopeRep() : 0),
                                         SS? SS->getRange() : SourceRange(),
-                                        Ovl, MemberLoc, true, 
-                                        LAngleLoc, ExplicitTemplateArgs, 
-                                        NumExplicitTemplateArgs, RAngleLoc, 
+                                        Ovl, MemberLoc, true,
+                                        LAngleLoc, ExplicitTemplateArgs,
+                                        NumExplicitTemplateArgs, RAngleLoc,
                                         Context.OverloadTy));
 
       return Owned(BuildMemberExpr(Context, BaseExpr, OpKind == tok::arrow, SS,
@@ -2241,13 +2240,13 @@
   // pseudo-destructor.
   if (MemberName.getNameKind() == DeclarationName::CXXDestructorName) {
     // C++ [expr.pseudo]p2:
-    //   The left hand side of the dot operator shall be of scalar type. The 
-    //   left hand side of the arrow operator shall be of pointer to scalar 
+    //   The left hand side of the dot operator shall be of scalar type. The
+    //   left hand side of the arrow operator shall be of pointer to scalar
     //   type.
     if (!BaseType->isScalarType())
       return Owned(Diag(OpLoc, diag::err_pseudo_dtor_base_not_scalar)
                      << BaseType << BaseExpr->getSourceRange());
-    
+
     //   [...] The type designated by the pseudo-destructor-name shall be the
     //   same as the object type.
     if (!MemberName.getCXXNameType()->isDependentType() &&
@@ -2255,28 +2254,28 @@
       return Owned(Diag(OpLoc, diag::err_pseudo_dtor_type_mismatch)
                      << BaseType << MemberName.getCXXNameType()
                      << BaseExpr->getSourceRange() << SourceRange(MemberLoc));
-    
-    //   [...] Furthermore, the two type-names in a pseudo-destructor-name of 
+
+    //   [...] Furthermore, the two type-names in a pseudo-destructor-name of
     //   the form
     //
-    //       ::[opt] nested-name-specifier[opt] type-name ::  ̃ type-name 
-    //   
+    //       ::[opt] nested-name-specifier[opt] type-name ::  ̃ type-name
+    //
     //   shall designate the same scalar type.
     //
     // FIXME: DPG can't see any way to trigger this particular clause, so it
     // isn't checked here.
-    
+
     // FIXME: We've lost the precise spelling of the type by going through
     // DeclarationName. Can we do better?
     return Owned(new (Context) CXXPseudoDestructorExpr(Context, BaseExpr,
-                                                       OpKind == tok::arrow, 
+                                                       OpKind == tok::arrow,
                                                        OpLoc,
-                            (NestedNameSpecifier *)(SS? SS->getScopeRep() : 0), 
+                            (NestedNameSpecifier *)(SS? SS->getScopeRep() : 0),
                                             SS? SS->getRange() : SourceRange(),
                                                    MemberName.getCXXNameType(),
                                                        MemberLoc));
   }
-      
+
   // Handle properties on ObjC 'Class' types.
   if (OpKind == tok::period && BaseType->isObjCClassType()) {
     // Also must look for a getter name which uses property syntax.
@@ -2293,8 +2292,8 @@
       }
       // If we found a getter then this may be a valid dot-reference, we
       // will look for the matching setter, in case it is needed.
-      Selector SetterSel = 
-        SelectorTable::constructSetterName(PP.getIdentifierTable(), 
+      Selector SetterSel =
+        SelectorTable::constructSetterName(PP.getIdentifierTable(),
                                            PP.getSelectorTable(), Member);
       ObjCMethodDecl *Setter = IFace->lookupClassMethod(SetterSel);
       if (!Setter) {
@@ -2330,7 +2329,7 @@
   if ((OpKind == tok::arrow && BaseType->isObjCObjectPointerType()) ||
       (OpKind == tok::period && BaseType->isObjCInterfaceType())) {
     const ObjCObjectPointerType *OPT = BaseType->getAsObjCObjectPointerType();
-    const ObjCInterfaceType *IFaceT = 
+    const ObjCInterfaceType *IFaceT =
       OPT ? OPT->getInterfaceType() : BaseType->getAsObjCInterfaceType();
     if (IFaceT) {
       IdentifierInfo *Member = MemberName.getAsIdentifierInfo();
@@ -2338,7 +2337,7 @@
       ObjCInterfaceDecl *IDecl = IFaceT->getDecl();
       ObjCInterfaceDecl *ClassDeclared;
       ObjCIvarDecl *IV = IDecl->lookupInstanceVariable(Member, ClassDeclared);
-      
+
       if (IV) {
         // If the decl being referenced had an error, return an error for this
         // sub-expr without emitting another error, in order to avoid cascading
@@ -2362,22 +2361,22 @@
             // need be passed down in the AST node and somehow calculated from the
             // AST for a function decl.
             Decl *ImplDecl = ObjCImpDecl.getAs<Decl>();
-            if (ObjCImplementationDecl *IMPD = 
+            if (ObjCImplementationDecl *IMPD =
                 dyn_cast<ObjCImplementationDecl>(ImplDecl))
               ClassOfMethodDecl = IMPD->getClassInterface();
             else if (ObjCCategoryImplDecl* CatImplClass =
                         dyn_cast<ObjCCategoryImplDecl>(ImplDecl))
               ClassOfMethodDecl = CatImplClass->getClassInterface();
           }
-          
-          if (IV->getAccessControl() == ObjCIvarDecl::Private) { 
-            if (ClassDeclared != IDecl || 
+
+          if (IV->getAccessControl() == ObjCIvarDecl::Private) {
+            if (ClassDeclared != IDecl ||
                 ClassOfMethodDecl != ClassDeclared)
-              Diag(MemberLoc, diag::error_private_ivar_access) 
+              Diag(MemberLoc, diag::error_private_ivar_access)
                 << IV->getDeclName();
           } else if (!IDecl->isSuperClassOf(ClassOfMethodDecl))
             // @protected
-            Diag(MemberLoc, diag::error_protected_ivar_access) 
+            Diag(MemberLoc, diag::error_protected_ivar_access)
               << IV->getDeclName();
         }
 
@@ -2391,11 +2390,11 @@
     }
   }
   // Handle properties on 'id' and qualified "id".
-  if (OpKind == tok::period && (BaseType->isObjCIdType() || 
+  if (OpKind == tok::period && (BaseType->isObjCIdType() ||
                                 BaseType->isObjCQualifiedIdType())) {
     const ObjCObjectPointerType *QIdTy = BaseType->getAsObjCObjectPointerType();
     IdentifierInfo *Member = MemberName.getAsIdentifierInfo();
-    
+
     // Check protocols on qualified interfaces.
     Selector Sel = PP.getSelectorTable().getNullarySelector(Member);
     if (Decl *PMDecl = FindGetterNameDecl(QIdTy, Member, Sel, Context)) {
@@ -2403,7 +2402,7 @@
         // Check the use of this declaration
         if (DiagnoseUseOfDecl(PD, MemberLoc))
           return ExprError();
-        
+
         return Owned(new (Context) ObjCPropertyRefExpr(PD, PD->getType(),
                                                        MemberLoc, BaseExpr));
       }
@@ -2411,10 +2410,10 @@
         // Check the use of this method.
         if (DiagnoseUseOfDecl(OMD, MemberLoc))
           return ExprError();
-        
+
         return Owned(new (Context) ObjCMessageExpr(BaseExpr, Sel,
-                                                   OMD->getResultType(), 
-                                                   OMD, OpLoc, MemberLoc, 
+                                                   OMD->getResultType(),
+                                                   OMD, OpLoc, MemberLoc,
                                                    NULL, 0));
       }
     }
@@ -2425,12 +2424,12 @@
   // Handle Objective-C property access, which is "Obj.property" where Obj is a
   // pointer to a (potentially qualified) interface type.
   const ObjCObjectPointerType *OPT;
-  if (OpKind == tok::period && 
+  if (OpKind == tok::period &&
       (OPT = BaseType->getAsObjCInterfacePointerType())) {
     const ObjCInterfaceType *IFaceT = OPT->getInterfaceType();
     ObjCInterfaceDecl *IFace = IFaceT->getDecl();
     IdentifierInfo *Member = MemberName.getAsIdentifierInfo();
-    
+
     // Search for a declared property first.
     if (ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(Member)) {
       // Check whether we can reference this property.
@@ -2488,8 +2487,8 @@
     }
     // If we found a getter then this may be a valid dot-reference, we
     // will look for the matching setter, in case it is needed.
-    Selector SetterSel = 
-      SelectorTable::constructSetterName(PP.getIdentifierTable(), 
+    Selector SetterSel =
+      SelectorTable::constructSetterName(PP.getIdentifierTable(),
                                          PP.getSelectorTable(), Member);
     ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel);
     if (!Setter) {
@@ -2519,9 +2518,9 @@
     return ExprError(Diag(MemberLoc, diag::err_property_not_found)
       << MemberName << BaseType);
   }
-  
+
   // Handle the following exceptional case (*Obj).isa.
-  if (OpKind == tok::period && 
+  if (OpKind == tok::period &&
       BaseType->isSpecificBuiltinType(BuiltinType::ObjCId) &&
       MemberName.getAsIdentifierInfo()->isStr("isa"))
     return Owned(new (Context) ObjCIsaExpr(BaseExpr, false, MemberLoc,
@@ -2543,9 +2542,9 @@
   // If the user is trying to apply -> or . to a function or function
   // pointer, it's probably because they forgot parentheses to call
   // the function. Suggest the addition of those parentheses.
-  if (BaseType == Context.OverloadTy || 
+  if (BaseType == Context.OverloadTy ||
       BaseType->isFunctionType() ||
-      (BaseType->isPointerType() && 
+      (BaseType->isPointerType() &&
        BaseType->getAs<PointerType>()->isFunctionType())) {
     SourceLocation Loc = PP.getLocForEndOfToken(BaseExpr->getLocEnd());
     Diag(Loc, diag::note_member_reference_needs_call)
@@ -2560,7 +2559,7 @@
                                tok::TokenKind OpKind, SourceLocation MemberLoc,
                                IdentifierInfo &Member,
                                DeclPtrTy ObjCImpDecl, const CXXScopeSpec *SS) {
-  return BuildMemberReferenceExpr(S, move(Base), OpLoc, OpKind, MemberLoc, 
+  return BuildMemberReferenceExpr(S, move(Base), OpLoc, OpKind, MemberLoc,
                                   DeclarationName(&Member), ObjCImpDecl, SS);
 }
 
@@ -2571,7 +2570,7 @@
     Diag (CallLoc,
           diag::err_use_of_default_argument_to_function_declared_later) <<
       FD << cast<CXXRecordDecl>(FD->getDeclContext())->getDeclName();
-    Diag(UnparsedDefaultArgLocs[Param], 
+    Diag(UnparsedDefaultArgLocs[Param],
           diag::note_default_argument_declared_here);
   } else {
     if (Param->hasUninstantiatedDefaultArg()) {
@@ -2580,28 +2579,28 @@
       // Instantiate the expression.
       MultiLevelTemplateArgumentList ArgList = getTemplateInstantiationArgs(FD);
 
-      InstantiatingTemplate Inst(*this, CallLoc, Param, 
-                                 ArgList.getInnermost().getFlatArgumentList(), 
+      InstantiatingTemplate Inst(*this, CallLoc, Param,
+                                 ArgList.getInnermost().getFlatArgumentList(),
                                  ArgList.getInnermost().flat_size());
 
       OwningExprResult Result = SubstExpr(UninstExpr, ArgList);
-      if (Result.isInvalid()) 
+      if (Result.isInvalid())
         return ExprError();
-      
-      if (SetParamDefaultArgument(Param, move(Result), 
+
+      if (SetParamDefaultArgument(Param, move(Result),
                                   /*FIXME:EqualLoc*/
                                   UninstExpr->getSourceRange().getBegin()))
         return ExprError();
     }
-    
+
     Expr *DefaultExpr = Param->getDefaultArg();
-    
+
     // If the default expression creates temporaries, we need to
     // push them to the current stack of expression temporaries so they'll
     // be properly destroyed.
-    if (CXXExprWithTemporaries *E 
+    if (CXXExprWithTemporaries *E
           = dyn_cast_or_null<CXXExprWithTemporaries>(DefaultExpr)) {
-      assert(!E->shouldDestroyTemporaries() && 
+      assert(!E->shouldDestroyTemporaries() &&
              "Can't destroy temporaries in a default argument expr!");
       for (unsigned I = 0, N = E->getNumTemporaries(); I != N; ++I)
         ExprTemporaries.push_back(E->getTemporary(I));
@@ -2676,16 +2675,16 @@
         return true;
     } else {
       ParmVarDecl *Param = FDecl->getParamDecl(i);
-     
-      OwningExprResult ArgExpr = 
+
+      OwningExprResult ArgExpr =
         BuildCXXDefaultArgExpr(Call->getSourceRange().getBegin(),
                                FDecl, Param);
       if (ArgExpr.isInvalid())
         return true;
-      
+
       Arg = ArgExpr.takeAs<Expr>();
     }
-    
+
     Call->setArg(i, Arg);
   }
 
@@ -2719,14 +2718,14 @@
 
   // Since this might be a postfix expression, get rid of ParenListExprs.
   fn = MaybeConvertParenListExprToParenExpr(S, move(fn));
-  
+
   Expr *Fn = fn.takeAs<Expr>();
   Expr **Args = reinterpret_cast<Expr**>(args.release());
   assert(Fn && "no function call expression");
   FunctionDecl *FDecl = NULL;
   NamedDecl *NDecl = NULL;
   DeclarationName UnqualifiedName;
-  
+
   if (getLangOptions().CPlusPlus) {
     // If this is a pseudo-destructor expression, build the call immediately.
     if (isa<CXXPseudoDestructorExpr>(Fn)) {
@@ -2736,17 +2735,17 @@
           << CodeModificationHint::CreateRemoval(
                                     SourceRange(Args[0]->getLocStart(),
                                                 Args[NumArgs-1]->getLocEnd()));
-        
+
         for (unsigned I = 0; I != NumArgs; ++I)
           Args[I]->Destroy(Context);
-        
+
         NumArgs = 0;
       }
-      
+
       return Owned(new (Context) CallExpr(Context, Fn, 0, 0, Context.VoidTy,
                                           RParenLoc));
     }
-    
+
     // Determine whether this is a dependent call inside a C++ template,
     // in which case we won't do any semantic analysis now.
     // FIXME: Will need to cache the results of name lookup (including ADL) in
@@ -2780,7 +2779,7 @@
   }
 
   // If we're directly calling a function, get the appropriate declaration.
-  // Also, in C++, keep track of whether we should perform argument-dependent 
+  // Also, in C++, keep track of whether we should perform argument-dependent
   // lookup and whether there were any explicitly-specified template arguments.
   Expr *FnExpr = Fn;
   bool ADL = true;
@@ -2808,7 +2807,7 @@
                  = dyn_cast<UnresolvedFunctionNameExpr>(FnExpr)) {
       UnqualifiedName = DepName->getName();
       break;
-    } else if (TemplateIdRefExpr *TemplateIdRef 
+    } else if (TemplateIdRefExpr *TemplateIdRef
                  = dyn_cast<TemplateIdRefExpr>(FnExpr)) {
       NDecl = TemplateIdRef->getTemplateName().getAsTemplateDecl();
       if (!NDecl)
@@ -2816,17 +2815,17 @@
       HasExplicitTemplateArgs = true;
       ExplicitTemplateArgs = TemplateIdRef->getTemplateArgs();
       NumExplicitTemplateArgs = TemplateIdRef->getNumTemplateArgs();
-      
+
       // C++ [temp.arg.explicit]p6:
       //   [Note: For simple function names, argument dependent lookup (3.4.2)
-      //   applies even when the function name is not visible within the 
+      //   applies even when the function name is not visible within the
       //   scope of the call. This is because the call still has the syntactic
       //   form of a function call (3.4.1). But when a function template with
       //   explicit template arguments is used, the call does not have the
-      //   correct syntactic form unless there is a function template with 
-      //   that name visible at the point of the call. If no such name is 
-      //   visible, the call is not syntactically well-formed and 
-      //   argument-dependent lookup does not apply. If some such name is 
+      //   correct syntactic form unless there is a function template with
+      //   that name visible at the point of the call. If no such name is
+      //   visible, the call is not syntactically well-formed and
+      //   argument-dependent lookup does not apply. If some such name is
       //   visible, argument dependent lookup applies and additional function
       //   templates may be found in other namespaces.
       //
@@ -2855,7 +2854,7 @@
     Ovl = dyn_cast<OverloadedFunctionDecl>(NDecl);
   }
 
-  if (Ovl || FunctionTemplate || 
+  if (Ovl || FunctionTemplate ||
       (getLangOptions().CPlusPlus && (FDecl || UnqualifiedName))) {
     // We don't perform ADL for implicit declarations of builtins.
     if (FDecl && FDecl->getBuiltinID(Context) && FDecl->isImplicit())
@@ -2866,11 +2865,11 @@
       ADL = false;
 
     if (Ovl || FunctionTemplate || ADL) {
-      FDecl = ResolveOverloadedCallFn(Fn, NDecl, UnqualifiedName, 
+      FDecl = ResolveOverloadedCallFn(Fn, NDecl, UnqualifiedName,
                                       HasExplicitTemplateArgs,
                                       ExplicitTemplateArgs,
                                       NumExplicitTemplateArgs,
-                                      LParenLoc, Args, NumArgs, CommaLocs, 
+                                      LParenLoc, Args, NumArgs, CommaLocs,
                                       RParenLoc, ADL);
       if (!FDecl)
         return ExprError();
@@ -2972,13 +2971,13 @@
   // Check for sentinels
   if (NDecl)
     DiagnoseSentinelCalls(NDecl, LParenLoc, Args, NumArgs);
-  
+
   // Do special checking on direct calls to functions.
   if (FDecl) {
     if (CheckFunctionCall(FDecl, TheCall.get()))
       return ExprError();
-    
-    if (unsigned BuiltinID = FDecl->getBuiltinID(Context)) 
+
+    if (unsigned BuiltinID = FDecl->getBuiltinID(Context))
       return CheckBuiltinFunctionCall(BuiltinID, TheCall.take());
   } else if (NDecl) {
     if (CheckBlockCall(NDecl, TheCall.get()))
@@ -3005,7 +3004,7 @@
   } else if (!literalType->isDependentType() &&
              RequireCompleteType(LParenLoc, literalType,
                       PDiag(diag::err_typecheck_decl_incomplete_type)
-                        << SourceRange(LParenLoc, 
+                        << SourceRange(LParenLoc,
                                        literalExpr->getSourceRange().getEnd())))
     return ExprError();
 
@@ -3040,7 +3039,7 @@
 
 /// CheckCastTypes - Check type constraints for casting between types.
 bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr,
-                          CastExpr::CastKind& Kind, 
+                          CastExpr::CastKind& Kind,
                           CXXMethodDecl *& ConversionDecl,
                           bool FunctionalStyle) {
   if (getLangOptions().CPlusPlus)
@@ -3137,7 +3136,7 @@
 
 bool Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, QualType SrcTy) {
   assert(DestTy->isExtVectorType() && "Not an extended vector type!");
-  
+
   // If SrcTy is a VectorType, the total size must match to explicitly cast to
   // an ExtVectorType.
   if (SrcTy->isVectorType()) {
@@ -3161,27 +3160,27 @@
 Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, TypeTy *Ty,
                     SourceLocation RParenLoc, ExprArg Op) {
   CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-  
+
   assert((Ty != 0) && (Op.get() != 0) &&
          "ActOnCastExpr(): missing type or expr");
 
   Expr *castExpr = (Expr *)Op.get();
   //FIXME: Preserve type source info.
   QualType castType = GetTypeFromParser(Ty);
-  
+
   // If the Expr being casted is a ParenListExpr, handle it specially.
   if (isa<ParenListExpr>(castExpr))
     return ActOnCastOfParenListExpr(S, LParenLoc, RParenLoc, move(Op),castType);
   CXXMethodDecl *ConversionDecl = 0;
-  if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), castType, castExpr, 
+  if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), castType, castExpr,
                      Kind, ConversionDecl))
     return ExprError();
   if (ConversionDecl) {
     // encounterred a c-style cast requiring a conversion function.
     if (CXXConversionDecl *CD = dyn_cast<CXXConversionDecl>(ConversionDecl)) {
-      castExpr = 
+      castExpr =
         new (Context) CXXFunctionalCastExpr(castType.getNonReferenceType(),
-                                            castType, LParenLoc, 
+                                            castType, LParenLoc,
                                             CastExpr::CK_UserDefinedConversion,
                                             castExpr, CD,
                                             RParenLoc);
@@ -3189,10 +3188,10 @@
     }
     // FIXME. AST for when dealing with conversion functions (FunctionDecl).
   }
-  
+
   Op.release();
   return Owned(new (Context) CStyleCastExpr(castType.getNonReferenceType(),
-                                            Kind, castExpr, castType, 
+                                            Kind, castExpr, castType,
                                             LParenLoc, RParenLoc));
 }
 
@@ -3204,13 +3203,13 @@
   ParenListExpr *E = dyn_cast<ParenListExpr>(expr);
   if (!E)
     return Owned(expr);
-  
+
   OwningExprResult Result(*this, E->getExpr(0));
-  
+
   for (unsigned i = 1, e = E->getNumExprs(); i != e && !Result.isInvalid(); ++i)
     Result = ActOnBinOp(S, E->getExprLoc(), tok::comma, move(Result),
                         Owned(E->getExpr(i)));
-  
+
   return ActOnParenExpr(E->getLParenLoc(), E->getRParenLoc(), move(Result));
 }
 
@@ -3219,8 +3218,8 @@
                                SourceLocation RParenLoc, ExprArg Op,
                                QualType Ty) {
   ParenListExpr *PE = (ParenListExpr *)Op.get();
-  
-  // If this is an altivec initializer, '(' type ')' '(' init, ..., init ')' 
+
+  // If this is an altivec initializer, '(' type ')' '(' init, ..., init ')'
   // then handle it as such.
   if (getLangOptions().AltiVec && Ty->isVectorType()) {
     if (PE->getNumExprs() == 0) {
@@ -3235,13 +3234,13 @@
     // FIXME: This means that pretty-printing the final AST will produce curly
     // braces instead of the original commas.
     Op.release();
-    InitListExpr *E = new (Context) InitListExpr(LParenLoc, &initExprs[0], 
+    InitListExpr *E = new (Context) InitListExpr(LParenLoc, &initExprs[0],
                                                  initExprs.size(), RParenLoc);
     E->setType(Ty);
-    return ActOnCompoundLiteral(LParenLoc, Ty.getAsOpaquePtr(), RParenLoc, 
+    return ActOnCompoundLiteral(LParenLoc, Ty.getAsOpaquePtr(), RParenLoc,
                                 Owned(E));
   } else {
-    // This is not an AltiVec-style cast, so turn the ParenListExpr into a 
+    // This is not an AltiVec-style cast, so turn the ParenListExpr into a
     // sequence of BinOp comma operators.
     Op = MaybeConvertParenListExprToParenExpr(S, move(Op));
     return ActOnCastExpr(S, LParenLoc, Ty.getAsOpaquePtr(), RParenLoc,move(Op));
@@ -3357,7 +3356,7 @@
     if (!LHSTy->isBlockPointerType() || !RHSTy->isBlockPointerType()) {
       if (LHSTy->isVoidPointerType() || RHSTy->isVoidPointerType()) {
         QualType destType = Context.getPointerType(Context.VoidTy);
-        ImpCastExprToType(LHS, destType); 
+        ImpCastExprToType(LHS, destType);
         ImpCastExprToType(RHS, destType);
         return destType;
       }
@@ -3393,7 +3392,7 @@
   }
   // Check constraints for Objective-C object pointers types.
   if (LHSTy->isObjCObjectPointerType() && RHSTy->isObjCObjectPointerType()) {
-    
+
     if (Context.getCanonicalType(LHSTy) == Context.getCanonicalType(RHSTy)) {
       // Two identical object pointer types are always compatible.
       return LHSTy;
@@ -3401,7 +3400,7 @@
     const ObjCObjectPointerType *LHSOPT = LHSTy->getAsObjCObjectPointerType();
     const ObjCObjectPointerType *RHSOPT = RHSTy->getAsObjCObjectPointerType();
     QualType compositeType = LHSTy;
-    
+
     // If both operands are interfaces and either operand can be
     // assigned to the other, use that type as the composite
     // type. This allows
@@ -3419,10 +3418,10 @@
       compositeType = RHSOPT->isObjCBuiltinType() ? RHSTy : LHSTy;
     } else if (Context.canAssignObjCInterfaces(RHSOPT, LHSOPT)) {
       compositeType = LHSOPT->isObjCBuiltinType() ? LHSTy : RHSTy;
-    } else if ((LHSTy->isObjCQualifiedIdType() || 
+    } else if ((LHSTy->isObjCQualifiedIdType() ||
                 RHSTy->isObjCQualifiedIdType()) &&
                 Context.ObjCQualifiedIdTypesAreCompatible(LHSTy, RHSTy, true)) {
-      // Need to handle "id<xx>" explicitly. 
+      // Need to handle "id<xx>" explicitly.
       // GCC allows qualified id and any Objective-C type to devolve to
       // id. Currently localizing to here until clear this should be
       // part of ObjCQualifiedIdTypesAreCompatible.
@@ -3512,7 +3511,7 @@
     ImpCastExprToType(RHS, LHSTy);
     return LHSTy;
   }
-  
+
   // GCC compatibility: soften pointer/integer mismatch.
   if (RHSTy->isPointerType() && LHSTy->isIntegerType()) {
     Diag(QuestionLoc, diag::warn_typecheck_cond_pointer_integer_mismatch)
@@ -3641,7 +3640,7 @@
       return IncompatiblePointerSign;
     }
     // General pointer incompatibility takes priority over qualifiers.
-    return IncompatiblePointer; 
+    return IncompatiblePointer;
   }
   return ConvTy;
 }
@@ -3727,7 +3726,7 @@
     if (!rhsType->isVectorType() && rhsType->isArithmeticType())
       return Compatible;
   }
-  
+
   if (lhsType->isVectorType() || rhsType->isVectorType()) {
     // If we are allowing lax vector conversions, and LHS and RHS are both
     // vectors, the total size only needs to be the same. This is a bitcast;
@@ -3788,7 +3787,7 @@
   if (isa<ObjCObjectPointerType>(lhsType)) {
     if (rhsType->isIntegerType())
       return IntToPointer;
-      
+
     // In general, C pointers are not compatible with ObjC object pointers.
     if (isa<PointerType>(rhsType)) {
       if (rhsType->isVoidPointerType()) // an exception to the rule.
@@ -3858,7 +3857,7 @@
 
 /// \brief Constructs a transparent union from an expression that is
 /// used to initialize the transparent union.
-static void ConstructTransparentUnion(ASTContext &C, Expr *&E, 
+static void ConstructTransparentUnion(ASTContext &C, Expr *&E,
                                       QualType UnionType, FieldDecl *Field) {
   // Build an initializer list that designates the appropriate member
   // of the transparent union.
@@ -3878,7 +3877,7 @@
 Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType, Expr *&rExpr) {
   QualType FromType = rExpr->getType();
 
-  // If the ArgType is a Union type, we want to handle a potential 
+  // If the ArgType is a Union type, we want to handle a potential
   // transparent_union GCC extension.
   const RecordType *UT = ArgType->getAsUnionType();
   if (!UT || !UT->getDecl()->hasAttr<TransparentUnionAttr>())
@@ -3901,7 +3900,7 @@
           InitField = *it;
           break;
         }
-      
+
       if (rExpr->isNullPointerConstant(Context)) {
         ImpCastExprToType(rExpr, it->getType());
         InitField = *it;
@@ -3942,8 +3941,8 @@
 
   // C99 6.5.16.1p1: the left operand is a pointer and the right is
   // a null pointer constant.
-  if ((lhsType->isPointerType() || 
-       lhsType->isObjCObjectPointerType() || 
+  if ((lhsType->isPointerType() ||
+       lhsType->isObjCObjectPointerType() ||
        lhsType->isBlockPointerType())
       && rExpr->isNullPointerConstant(Context)) {
     ImpCastExprToType(rExpr, lhsType);
@@ -4014,7 +4013,7 @@
     std::swap(rex, lex);
     std::swap(rhsType, lhsType);
   }
-  
+
   // Handle the case of an ext vector and scalar.
   if (const ExtVectorType *LV = lhsType->getAsExtVectorType()) {
     QualType EltTy = LV->getElementType();
@@ -4034,7 +4033,7 @@
       }
     }
   }
-  
+
   // Vectors of different size or scalar and non-ext-vector are errors.
   Diag(Loc, diag::err_typecheck_vector_not_convertable)
     << lex->getType() << rex->getType()
@@ -4043,8 +4042,7 @@
 }
 
 inline QualType Sema::CheckMultiplyDivideOperands(
-  Expr *&lex, Expr *&rex, SourceLocation Loc, bool isCompAssign)
-{
+  Expr *&lex, Expr *&rex, SourceLocation Loc, bool isCompAssign) {
   if (lex->getType()->isVectorType() || rex->getType()->isVectorType())
     return CheckVectorOperands(Loc, lex, rex);
 
@@ -4056,8 +4054,7 @@
 }
 
 inline QualType Sema::CheckRemainderOperands(
-  Expr *&lex, Expr *&rex, SourceLocation Loc, bool isCompAssign)
-{
+  Expr *&lex, Expr *&rex, SourceLocation Loc, bool isCompAssign) {
   if (lex->getType()->isVectorType() || rex->getType()->isVectorType()) {
     if (lex->getType()->isIntegerType() && rex->getType()->isIntegerType())
       return CheckVectorOperands(Loc, lex, rex);
@@ -4072,8 +4069,7 @@
 }
 
 inline QualType Sema::CheckAdditionOperands( // C99 6.5.6
-  Expr *&lex, Expr *&rex, SourceLocation Loc, QualType* CompLHSTy)
-{
+  Expr *&lex, Expr *&rex, SourceLocation Loc, QualType* CompLHSTy) {
   if (lex->getType()->isVectorType() || rex->getType()->isVectorType()) {
     QualType compType = CheckVectorOperands(Loc, lex, rex);
     if (CompLHSTy) *CompLHSTy = compType;
@@ -4095,10 +4091,10 @@
     std::swap(PExp, IExp);
 
   if (PExp->getType()->isAnyPointerType()) {
-    
+
     if (IExp->getType()->isIntegerType()) {
       QualType PointeeTy = PExp->getType()->getPointeeType();
-      
+
       // Check for arithmetic on pointers to incomplete types.
       if (PointeeTy->isVoidType()) {
         if (getLangOptions().CPlusPlus) {
@@ -4122,12 +4118,12 @@
           << lex->getType() << lex->getSourceRange();
       } else {
         // Check if we require a complete type.
-        if (((PExp->getType()->isPointerType() && 
+        if (((PExp->getType()->isPointerType() &&
               !PExp->getType()->isDependentType()) ||
               PExp->getType()->isObjCObjectPointerType()) &&
              RequireCompleteType(Loc, PointeeTy,
-                           PDiag(diag::err_typecheck_arithmetic_incomplete_type) 
-                             << PExp->getSourceRange() 
+                           PDiag(diag::err_typecheck_arithmetic_incomplete_type)
+                             << PExp->getSourceRange()
                              << PExp->getType()))
           return QualType();
       }
@@ -4137,7 +4133,7 @@
           << PointeeTy << PExp->getSourceRange();
         return QualType();
       }
-      
+
       if (CompLHSTy) {
         QualType LHSTy = Context.isPromotableBitField(lex);
         if (LHSTy.isNull()) {
@@ -4173,7 +4169,7 @@
     if (CompLHSTy) *CompLHSTy = compType;
     return compType;
   }
-    
+
   // Either ptr - int   or   ptr - ptr.
   if (lex->getType()->isAnyPointerType()) {
     QualType lpointee = lex->getType()->getPointeeType();
@@ -4201,9 +4197,9 @@
       // GNU C extension: arithmetic on pointer to function
       ComplainAboutFunc = lex;
     } else if (!lpointee->isDependentType() &&
-               RequireCompleteType(Loc, lpointee, 
+               RequireCompleteType(Loc, lpointee,
                                    PDiag(diag::err_typecheck_sub_ptr_object)
-                                     << lex->getSourceRange() 
+                                     << lex->getSourceRange()
                                      << lex->getType()))
       return QualType();
 
@@ -4213,7 +4209,7 @@
         << lpointee << lex->getSourceRange();
       return QualType();
     }
-    
+
     // The result type of a pointer-int computation is the pointer type.
     if (rex->getType()->isIntegerType()) {
       if (ComplainAboutVoid)
@@ -4221,7 +4217,7 @@
           << lex->getSourceRange() << rex->getSourceRange();
       if (ComplainAboutFunc)
         Diag(Loc, diag::ext_gnu_ptr_func_arith)
-          << ComplainAboutFunc->getType() 
+          << ComplainAboutFunc->getType()
           << ComplainAboutFunc->getSourceRange();
 
       if (CompLHSTy) *CompLHSTy = lex->getType();
@@ -4284,7 +4280,7 @@
           << lex->getSourceRange() << rex->getSourceRange();
       if (ComplainAboutFunc)
         Diag(Loc, diag::ext_gnu_ptr_func_arith)
-          << ComplainAboutFunc->getType() 
+          << ComplainAboutFunc->getType()
           << ComplainAboutFunc->getSourceRange();
 
       if (CompLHSTy) *CompLHSTy = lex->getType();
@@ -4356,7 +4352,7 @@
     // For non-floating point types, check for self-comparisons of the form
     // x == x, x != x, x < x, etc.  These always evaluate to a constant, and
     // often indicate logic errors in the program.
-    // NOTE: Don't warn about comparisons of enum constants. These can arise 
+    // NOTE: Don't warn about comparisons of enum constants. These can arise
     //  from macro expansions, and are usually quite deliberate.
     Expr *LHSStripped = lex->IgnoreParens();
     Expr *RHSStripped = rex->IgnoreParens();
@@ -4365,12 +4361,12 @@
         if (DRL->getDecl() == DRR->getDecl() &&
             !isa<EnumConstantDecl>(DRL->getDecl()))
           Diag(Loc, diag::warn_selfcomparison);
-    
+
     if (isa<CastExpr>(LHSStripped))
       LHSStripped = LHSStripped->IgnoreParenCasts();
     if (isa<CastExpr>(RHSStripped))
       RHSStripped = RHSStripped->IgnoreParenCasts();
-    
+
     // Warn about comparisons against a string constant (unless the other
     // operand is null), the user probably wants strcmp.
     Expr *literalString = 0;
@@ -4486,11 +4482,11 @@
       ImpCastExprToType(rex, lType); // promote the pointer to pointer
     return ResultTy;
   }
-  
+
   if (getLangOptions().CPlusPlus) {
-    // Comparison of pointers with null pointer constants and equality 
+    // Comparison of pointers with null pointer constants and equality
     // comparisons of member pointers to null pointer constants.
-    if (RHSIsNull && 
+    if (RHSIsNull &&
         (lType->isPointerType() ||
          (!isRelational && lType->isMemberPointerType()))) {
       ImpCastExprToType(rex, lType, CastExpr::CK_NullToMemberPointer);
@@ -4504,17 +4500,17 @@
     }
 
     // Comparison of member pointers.
-    if (!isRelational && 
+    if (!isRelational &&
         lType->isMemberPointerType() && rType->isMemberPointerType()) {
       // C++ [expr.eq]p2:
-      //   In addition, pointers to members can be compared, or a pointer to 
-      //   member and a null pointer constant. Pointer to member conversions 
-      //   (4.11) and qualification conversions (4.4) are performed to bring 
-      //   them to a common type. If one operand is a null pointer constant, 
-      //   the common type is the type of the other operand. Otherwise, the 
-      //   common type is a pointer to member type similar (4.4) to the type 
-      //   of one of the operands, with a cv-qualification signature (4.4) 
-      //   that is the union of the cv-qualification signatures of the operand 
+      //   In addition, pointers to members can be compared, or a pointer to
+      //   member and a null pointer constant. Pointer to member conversions
+      //   (4.11) and qualification conversions (4.4) are performed to bring
+      //   them to a common type. If one operand is a null pointer constant,
+      //   the common type is the type of the other operand. Otherwise, the
+      //   common type is a pointer to member type similar (4.4) to the type
+      //   of one of the operands, with a cv-qualification signature (4.4)
+      //   that is the union of the cv-qualification signatures of the operand
       //   types.
       QualType T = FindCompositePointerType(lex, rex);
       if (T.isNull()) {
@@ -4522,17 +4518,17 @@
         << lType << rType << lex->getSourceRange() << rex->getSourceRange();
         return QualType();
       }
-      
+
       ImpCastExprToType(lex, T);
       ImpCastExprToType(rex, T);
       return ResultTy;
     }
-    
+
     // Comparison of nullptr_t with itself.
     if (lType->isNullPtrType() && rType->isNullPtrType())
       return ResultTy;
   }
-  
+
   // Handle block pointer types.
   if (!isRelational && lType->isBlockPointerType() && rType->isBlockPointerType()) {
     QualType lpointee = lType->getAs<BlockPointerType>()->getPointeeType();
@@ -4596,7 +4592,7 @@
       DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_integer;
     else
       DiagID = diag::ext_typecheck_comparison_of_pointer_integer;
-    
+
     if (DiagID) {
       Diag(Loc, DiagID)
         << lType << rType << lex->getSourceRange() << rex->getSourceRange();
@@ -4613,7 +4609,7 @@
       DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_integer;
     else
       DiagID = diag::ext_typecheck_comparison_of_pointer_integer;
-      
+
     if (DiagID) {
       Diag(Loc, DiagID)
         << lType << rType << lex->getSourceRange() << rex->getSourceRange();
@@ -4686,8 +4682,7 @@
 }
 
 inline QualType Sema::CheckBitwiseOperands(
-  Expr *&lex, Expr *&rex, SourceLocation Loc, bool isCompAssign)
-{
+  Expr *&lex, Expr *&rex, SourceLocation Loc, bool isCompAssign) {
   if (lex->getType()->isVectorType() || rex->getType()->isVectorType())
     return CheckVectorOperands(Loc, lex, rex);
 
@@ -4699,8 +4694,7 @@
 }
 
 inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14]
-  Expr *&lex, Expr *&rex, SourceLocation Loc)
-{
+  Expr *&lex, Expr *&rex, SourceLocation Loc) {
   UsualUnaryConversions(lex);
   UsualUnaryConversions(rex);
 
@@ -4713,13 +4707,12 @@
 /// is a read-only property; return true if so. A readonly property expression
 /// depends on various declarations and thus must be treated specially.
 ///
-static bool IsReadonlyProperty(Expr *E, Sema &S)
-{
+static bool IsReadonlyProperty(Expr *E, Sema &S) {
   if (E->getStmtClass() == Expr::ObjCPropertyRefExprClass) {
     const ObjCPropertyRefExpr* PropExpr = cast<ObjCPropertyRefExpr>(E);
     if (ObjCPropertyDecl *PDecl = PropExpr->getProperty()) {
       QualType BaseType = PropExpr->getBase()->getType();
-      if (const ObjCObjectPointerType *OPT = 
+      if (const ObjCObjectPointerType *OPT =
             BaseType->getAsObjCInterfacePointerType())
         if (ObjCInterfaceDecl *IFace = OPT->getInterfaceDecl())
           if (S.isPropertyReadonly(PDecl, IFace))
@@ -4733,7 +4726,7 @@
 /// emit an error and return true.  If so, return false.
 static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
   SourceLocation OrigLoc = Loc;
-  Expr::isModifiableLvalueResult IsLV = E->isModifiableLvalue(S.Context, 
+  Expr::isModifiableLvalueResult IsLV = E->isModifiableLvalue(S.Context,
                                                               &Loc);
   if (IsLV == Expr::MLV_Valid && IsReadonlyProperty(E, S))
     IsLV = Expr::MLV_ReadonlyProperty;
@@ -4784,7 +4777,7 @@
   if (NeedType)
     S.Diag(Loc, Diag) << E->getType() << E->getSourceRange() << Assign;
   else
-    S.Diag(Loc, Diag) << E->getSourceRange() << Assign; 
+    S.Diag(Loc, Diag) << E->getSourceRange() << Assign;
   return true;
 }
 
@@ -4886,7 +4879,7 @@
     // OK!
   } else if (ResType->isAnyPointerType()) {
     QualType PointeeTy = ResType->getPointeeType();
-    
+
     // C99 6.5.2.4p2, 6.5.6p2
     if (PointeeTy->isVoidType()) {
       if (getLangOptions().CPlusPlus) {
@@ -4908,7 +4901,7 @@
         << ResType << Op->getSourceRange();
     } else if (RequireCompleteType(OpLoc, PointeeTy,
                            PDiag(diag::err_typecheck_arithmetic_incomplete_type)
-                             << Op->getSourceRange() 
+                             << Op->getSourceRange()
                              << ResType))
       return QualType();
     // Diagnose bad cases where we step over interface counts.
@@ -5064,12 +5057,12 @@
         DeclContext *Ctx = dcl->getDeclContext();
         if (Ctx && Ctx->isRecord()) {
           if (FD->getType()->isReferenceType()) {
-            Diag(OpLoc, 
+            Diag(OpLoc,
                  diag::err_cannot_form_pointer_to_member_of_reference_type)
               << FD->getDeclName() << FD->getType();
             return QualType();
           }
-          
+
           return Context.getMemberPointerType(op->getType(),
                 Context.getTypeDeclType(cast<RecordDecl>(Ctx)).getTypePtr());
         }
@@ -5298,7 +5291,7 @@
   assert((rhs != 0) && "ActOnBinOp(): missing right expression");
 
   if (getLangOptions().CPlusPlus &&
-      (lhs->getType()->isOverloadableType() || 
+      (lhs->getType()->isOverloadableType() ||
        rhs->getType()->isOverloadableType())) {
     // Find all of the overloaded operators visible from this
     // point. We perform both an operator-name lookup from the local
@@ -5310,7 +5303,7 @@
       LookupOverloadedOperatorName(OverOp, S, lhs->getType(), rhs->getType(),
                                    Functions);
       Expr *Args[2] = { lhs, rhs };
-      DeclarationName OpName 
+      DeclarationName OpName
         = Context.DeclarationNames.getCXXOperatorName(OverOp);
       ArgumentDependentLookup(OpName, Args, 2, Functions);
     }
@@ -5325,7 +5318,7 @@
 }
 
 Action::OwningExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
-                                                    unsigned OpcIn, 
+                                                    unsigned OpcIn,
                                                     ExprArg InputArg) {
   UnaryOperator::Opcode Opc = static_cast<UnaryOperator::Opcode>(OpcIn);
 
@@ -5428,7 +5421,7 @@
     if (OverOp != OO_None) {
       LookupOverloadedOperatorName(OverOp, S, Input->getType(), QualType(),
                                    Functions);
-      DeclarationName OpName 
+      DeclarationName OpName
         = Context.DeclarationNames.getCXXOperatorName(OverOp);
       ArgumentDependentLookup(OpName, &Input, 1, Functions);
     }
@@ -5533,7 +5526,7 @@
 
   if (!Dependent) {
     bool DidWarnAboutNonPOD = false;
-    
+
     // FIXME: Dependent case loses a lot of information here. And probably
     // leaks like a sieve.
     for (unsigned i = 0; i != NumComponents; ++i) {
@@ -5583,7 +5576,7 @@
           DidWarnAboutNonPOD = true;
         }
       }
-      
+
       FieldDecl *MemberDecl
         = dyn_cast_or_null<FieldDecl>(LookupQualifiedName(RD, OC.U.IdentInfo,
                                                           LookupMemberName)
@@ -5708,12 +5701,12 @@
     CurBlock->isVariadic = false;
     // Check for a valid sentinel attribute on this block.
     if (CurBlock->TheDecl->getAttr<SentinelAttr>()) {
-      Diag(ParamInfo.getAttributes()->getLoc(), 
+      Diag(ParamInfo.getAttributes()->getLoc(),
            diag::warn_attribute_sentinel_not_variadic) << 1;
       // FIXME: remove the attribute.
     }
     QualType RetTy = T.getTypePtr()->getAsFunctionType()->getResultType();
-    
+
     // Do not allow returning a objc interface by-value.
     if (RetTy->isObjCInterfaceType()) {
       Diag(ParamInfo.getSourceRange().getBegin(),
@@ -5755,17 +5748,17 @@
       PushOnScopeChains(*AI, CurBlock->TheScope);
 
   // Check for a valid sentinel attribute on this block.
-  if (!CurBlock->isVariadic && 
+  if (!CurBlock->isVariadic &&
       CurBlock->TheDecl->getAttr<SentinelAttr>()) {
-    Diag(ParamInfo.getAttributes()->getLoc(), 
+    Diag(ParamInfo.getAttributes()->getLoc(),
          diag::warn_attribute_sentinel_not_variadic) << 1;
     // FIXME: remove the attribute.
   }
-  
+
   // Analyze the return type.
   QualType T = GetTypeForDeclarator(ParamInfo, CurScope);
   QualType RetTy = T->getAsFunctionType()->getResultType();
-  
+
   // Do not allow returning a objc interface by-value.
   if (RetTy->isObjCInterfaceType()) {
     Diag(ParamInfo.getSourceRange().getBegin(),
@@ -5795,7 +5788,7 @@
   // If blocks are disabled, emit an error.
   if (!LangOpts.Blocks)
     Diag(CaretLoc, diag::err_blocks_disable);
-  
+
   // Ensure that CurBlock is deleted.
   llvm::OwningPtr<BlockSemaInfo> BSI(CurBlock);
 
@@ -5830,7 +5823,7 @@
   if (CurFunctionNeedsScopeChecking)
     DiagnoseInvalidJumps(static_cast<CompoundStmt*>(body.get()));
   CurFunctionNeedsScopeChecking = BSI->SavedFunctionNeedsScopeChecking;
-  
+
   BSI->TheDecl->setBody(body.takeAs<CompoundStmt>());
   CheckFallThroughForBlock(BlockTy, BSI->TheDecl->getBody());
   return Owned(new (Context) BlockExpr(BSI->TheDecl, BlockTy,
@@ -5843,7 +5836,7 @@
   QualType T = GetTypeFromParser(type);
   Expr *E = static_cast<Expr*>(expr.get());
   Expr *OrigExpr = E;
-  
+
   InitBuiltinVaListType();
 
   // Get the va_list type
@@ -5858,7 +5851,7 @@
   } else {
     // Otherwise, the va_list argument must be an l-value because
     // it is modified by va_arg.
-    if (!E->isTypeDependent() && 
+    if (!E->isTypeDependent() &&
         CheckForModifiableLvalue(E, BuiltinLoc, *this))
       return ExprError();
   }
@@ -5992,17 +5985,17 @@
   return false;
 }
 
-Sema::ExpressionEvaluationContext 
-Sema::PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext) { 
+Sema::ExpressionEvaluationContext
+Sema::PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext) {
   // Introduce a new set of potentially referenced declarations to the stack.
   if (NewContext == PotentiallyPotentiallyEvaluated)
     PotentiallyReferencedDeclStack.push_back(PotentiallyReferencedDecls());
-  
+
   std::swap(ExprEvalContext, NewContext);
   return NewContext;
 }
 
-void 
+void
 Sema::PopExpressionEvaluationContext(ExpressionEvaluationContext OldContext,
                                      ExpressionEvaluationContext NewContext) {
   ExprEvalContext = NewContext;
@@ -6014,7 +6007,7 @@
     PotentiallyReferencedDecls RemainingDecls;
     RemainingDecls.swap(PotentiallyReferencedDeclStack.back());
     PotentiallyReferencedDeclStack.pop_back();
-    
+
     for (PotentiallyReferencedDecls::iterator I = RemainingDecls.begin(),
                                            IEnd = RemainingDecls.end();
          I != IEnd; ++I)
@@ -6034,30 +6027,30 @@
 /// \param D the declaration that has been referenced by the source code.
 void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) {
   assert(D && "No declaration?");
-  
+
   if (D->isUsed())
     return;
-  
+
   // Mark a parameter declaration "used", regardless of whether we're in a
   // template or not.
   if (isa<ParmVarDecl>(D))
     D->setUsed(true);
-  
+
   // Do not mark anything as "used" within a dependent context; wait for
   // an instantiation.
   if (CurContext->isDependentContext())
     return;
-  
+
   switch (ExprEvalContext) {
     case Unevaluated:
       // We are in an expression that is not potentially evaluated; do nothing.
       return;
-      
+
     case PotentiallyEvaluated:
       // We are in a potentially-evaluated expression, so this declaration is
       // "used"; handle this below.
       break;
-      
+
     case PotentiallyPotentiallyEvaluated:
       // We are in an expression that may be potentially evaluated; queue this
       // declaration reference until we know whether the expression is
@@ -6065,14 +6058,14 @@
       PotentiallyReferencedDeclStack.back().push_back(std::make_pair(Loc, D));
       return;
   }
-      
+
   // Note that this declaration has been used.
   if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
     unsigned TypeQuals;
     if (Constructor->isImplicit() && Constructor->isDefaultConstructor()) {
         if (!Constructor->isUsed())
           DefineImplicitDefaultConstructor(Loc, Constructor);
-    } else if (Constructor->isImplicit() && 
+    } else if (Constructor->isImplicit() &&
                Constructor->isCopyConstructor(Context, TypeQuals)) {
       if (!Constructor->isUsed())
         DefineImplicitCopyConstructor(Loc, Constructor, TypeQuals);
@@ -6080,7 +6073,7 @@
   } else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) {
     if (Destructor->isImplicit() && !Destructor->isUsed())
       DefineImplicitDestructor(Loc, Destructor);
-    
+
   } else if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(D)) {
     if (MethodDecl->isImplicit() && MethodDecl->isOverloadedOperator() &&
         MethodDecl->getOverloadedOperator() == OO_Equal) {
@@ -6089,7 +6082,7 @@
     }
   }
   if (FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
-    // Implicit instantiation of function templates and member functions of 
+    // Implicit instantiation of function templates and member functions of
     // class templates.
     if (!Function->getBody()) {
       // FIXME: distinguish between implicit instantiations of function
@@ -6099,21 +6092,21 @@
           Function->getPrimaryTemplate())
         PendingImplicitInstantiations.push_back(std::make_pair(Function, Loc));
     }
-    
-    
+
+
     // FIXME: keep track of references to static functions
     Function->setUsed(true);
     return;
   }
-  
+
   if (VarDecl *Var = dyn_cast<VarDecl>(D)) {
     // Implicit instantiation of static data members of class templates.
     // FIXME: distinguish between implicit instantiations (which we need to
     // actually instantiate) and explicit specializations.
-    if (Var->isStaticDataMember() && 
+    if (Var->isStaticDataMember() &&
         Var->getInstantiatedFromStaticDataMember())
       PendingImplicitInstantiations.push_back(std::make_pair(Var, Loc));
-    
+
     // FIXME: keep track of references to static data?
 
     D->setUsed(true);

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Sep  9 10:08:12 2009
@@ -35,7 +35,7 @@
   //FIXME: Preserve type source info.
   QualType ConvType = GetTypeFromParser(Ty);
   CanQualType ConvTypeCanon = Context.getCanonicalType(ConvType);
-  DeclarationName ConvName 
+  DeclarationName ConvName
     = Context.DeclarationNames.getCXXConversionFunctionName(ConvTypeCanon);
   return ActOnDeclarationNameExpr(S, OperatorLoc, ConvName, HasTrailingLParen,
                                   &SS, isAddressOfOperand);
@@ -79,10 +79,10 @@
 
   if (!isType) {
     // C++0x [expr.typeid]p3:
-    //   When typeid is applied to an expression other than an lvalue of a 
-    //   polymorphic class type [...] [the] expression is an unevaluated 
+    //   When typeid is applied to an expression other than an lvalue of a
+    //   polymorphic class type [...] [the] expression is an unevaluated
     //   operand.
-    
+
     // FIXME: if the type of the expression is a class type, the class
     // shall be completely defined.
     bool isUnevaluatedOperand = true;
@@ -95,13 +95,13 @@
           isUnevaluatedOperand = false;
       }
     }
-    
+
     // If this is an unevaluated operand, clear out the set of declaration
     // references we have been computing.
     if (isUnevaluatedOperand)
       PotentiallyReferencedDeclStack.back().clear();
   }
-  
+
   return Owned(new (Context) CXXTypeidExpr(isType, TyOrExpr,
                                            TypeInfoType.withConst(),
                                            SourceRange(OpLoc, RParenLoc)));
@@ -195,9 +195,9 @@
   if (Ty->isDependentType() ||
       CallExpr::hasAnyTypeDependentArguments(Exprs, NumExprs)) {
     exprs.release();
-    
-    return Owned(CXXUnresolvedConstructExpr::Create(Context, 
-                                                    TypeRange.getBegin(), Ty, 
+
+    return Owned(CXXUnresolvedConstructExpr::Create(Context,
+                                                    TypeRange.getBegin(), Ty,
                                                     LParenLoc,
                                                     Exprs, NumExprs,
                                                     RParenLoc));
@@ -211,12 +211,12 @@
                           PDiag(diag::err_invalid_incomplete_type_use)
                             << FullRange))
     return ExprError();
-  
+
   if (RequireNonAbstractType(TyBeginLoc, Ty,
                              diag::err_allocation_of_abstract_type))
     return ExprError();
-  
-  
+
+
   // C++ [expr.type.conv]p1:
   // If the expression list is a single expression, the type conversion
   // expression is equivalent (in definedness, and if defined in meaning) to the
@@ -232,9 +232,9 @@
     if (!ConversionDecl || !isa<CXXConstructorDecl>(ConversionDecl)) {
       exprs.release();
       return Owned(new (Context) CXXFunctionalCastExpr(Ty.getNonReferenceType(),
-                                          Ty, TyBeginLoc, 
+                                          Ty, TyBeginLoc,
                                           CastExpr::CK_UserDefinedConversion,
-                                          Exprs[0], ConversionDecl, 
+                                          Exprs[0], ConversionDecl,
                                           RParenLoc));
     }
   }
@@ -242,7 +242,7 @@
   if (const RecordType *RT = Ty->getAs<RecordType>()) {
     CXXRecordDecl *Record = cast<CXXRecordDecl>(RT->getDecl());
 
-    if (NumExprs > 1 || !Record->hasTrivialConstructor() || 
+    if (NumExprs > 1 || !Record->hasTrivialConstructor() ||
         !Record->hasTrivialDestructor()) {
       CXXConstructorDecl *Constructor
         = PerformInitializationByConstructor(Ty, Exprs, NumExprs,
@@ -255,12 +255,12 @@
       if (!Constructor)
         return ExprError();
 
-      OwningExprResult Result = 
-        BuildCXXTemporaryObjectExpr(Constructor, Ty, TyBeginLoc, 
+      OwningExprResult Result =
+        BuildCXXTemporaryObjectExpr(Constructor, Ty, TyBeginLoc,
                                     move(exprs), RParenLoc);
       if (Result.isInvalid())
         return ExprError();
-      
+
       return MaybeBindToTemporary(Result.takeAs<Expr>());
     }
 
@@ -300,8 +300,7 @@
                   SourceLocation PlacementRParen, bool ParenTypeId,
                   Declarator &D, SourceLocation ConstructorLParen,
                   MultiExprArg ConstructorArgs,
-                  SourceLocation ConstructorRParen)
-{
+                  SourceLocation ConstructorRParen) {
   Expr *ArraySize = 0;
   unsigned Skip = 0;
   // If the specified type is an array, unwrap it and save the expression.
@@ -337,12 +336,12 @@
     ++i;
   }
 
-  return BuildCXXNew(StartLoc, UseGlobal, 
+  return BuildCXXNew(StartLoc, UseGlobal,
                      PlacementLParen,
-                     move(PlacementArgs), 
+                     move(PlacementArgs),
                      PlacementRParen,
                      ParenTypeId,
-                     AllocType, 
+                     AllocType,
                      D.getSourceRange().getBegin(),
                      D.getSourceRange(),
                      Owned(ArraySize),
@@ -351,12 +350,12 @@
                      ConstructorRParen);
 }
 
-Sema::OwningExprResult 
+Sema::OwningExprResult
 Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
                   SourceLocation PlacementLParen,
                   MultiExprArg PlacementArgs,
                   SourceLocation PlacementRParen,
-                  bool ParenTypeId, 
+                  bool ParenTypeId,
                   QualType AllocType,
                   SourceLocation TypeLoc,
                   SourceRange TypeRange,
@@ -472,15 +471,14 @@
   return Owned(new (Context) CXXNewExpr(UseGlobal, OperatorNew, PlaceArgs,
                         NumPlaceArgs, ParenTypeId, ArraySize, Constructor, Init,
                         ConsArgs, NumConsArgs, OperatorDelete, ResultType,
-                        StartLoc, Init ? ConstructorRParen : SourceLocation()));  
+                        StartLoc, Init ? ConstructorRParen : SourceLocation()));
 }
 
 /// CheckAllocatedType - Checks that a type is suitable as the allocated type
 /// in a new-expression.
 /// dimension off and stores the size expression in ArraySize.
 bool Sema::CheckAllocatedType(QualType AllocType, SourceLocation Loc,
-                              SourceRange R)
-{
+                              SourceRange R) {
   // C++ 5.3.4p1: "[The] type shall be a complete object type, but not an
   //   abstract class type or array thereof.
   if (AllocType->isFunctionType())
@@ -508,8 +506,7 @@
                                    bool IsArray, Expr **PlaceArgs,
                                    unsigned NumPlaceArgs,
                                    FunctionDecl *&OperatorNew,
-                                   FunctionDecl *&OperatorDelete)
-{
+                                   FunctionDecl *&OperatorDelete) {
   // --- Choosing an allocation function ---
   // C++ 5.3.4p8 - 14 & 18
   // 1) If UseGlobal is true, only look in the global scope. Else, also look
@@ -534,7 +531,7 @@
   DeclarationName NewName = Context.DeclarationNames.getCXXOperatorName(
                                         IsArray ? OO_Array_New : OO_New);
   if (AllocType->isRecordType() && !UseGlobal) {
-    CXXRecordDecl *Record 
+    CXXRecordDecl *Record
       = cast<CXXRecordDecl>(AllocType->getAs<RecordType>()->getDecl());
     // FIXME: We fail to find inherited overloads.
     if (FindAllocationOverload(StartLoc, Range, NewName, &AllocArgs[0],
@@ -556,7 +553,7 @@
   // copy them back.
   if (NumPlaceArgs > 0)
     std::copy(&AllocArgs[1], AllocArgs.end(), PlaceArgs);
-  
+
   return false;
 }
 
@@ -565,8 +562,7 @@
 bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
                                   DeclarationName Name, Expr** Args,
                                   unsigned NumArgs, DeclContext *Ctx,
-                                  bool AllowMissing, FunctionDecl *&Operator)
-{
+                                  bool AllowMissing, FunctionDecl *&Operator) {
   DeclContext::lookup_iterator Alloc, AllocEnd;
   llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Name);
   if (Alloc == AllocEnd) {
@@ -639,8 +635,7 @@
 /// @endcode
 /// Note that the placement and nothrow forms of new are *not* implicitly
 /// declared. Their use requires including \<new\>.
-void Sema::DeclareGlobalNewDelete()
-{
+void Sema::DeclareGlobalNewDelete() {
   if (GlobalNewDeleteDeclared)
     return;
   GlobalNewDeleteDeclared = true;
@@ -666,8 +661,7 @@
 /// DeclareGlobalAllocationFunction - Declares a single implicit global
 /// allocation function if it doesn't already exist.
 void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
-                                           QualType Return, QualType Argument)
-{
+                                           QualType Return, QualType Argument) {
   DeclContext *GlobalCtx = Context.getTranslationUnitDecl();
 
   // Check if this function is already declared.
@@ -705,15 +699,14 @@
 /// @code delete [] ptr; @endcode
 Action::OwningExprResult
 Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
-                     bool ArrayForm, ExprArg Operand)
-{
+                     bool ArrayForm, ExprArg Operand) {
   // C++ 5.3.5p1: "The operand shall have a pointer type, or a class type
   //   having a single conversion function to a pointer type. The result has
   //   type void."
   // DR599 amends "pointer type" to "pointer to object type" in both cases.
 
   FunctionDecl *OperatorDelete = 0;
-  
+
   Expr *Ex = (Expr *)Operand.get();
   if (!Ex->isTypeDependent()) {
     QualType Type = Ex->getType();
@@ -731,12 +724,12 @@
       return ExprError(Diag(StartLoc, diag::err_delete_operand)
         << Type << Ex->getSourceRange());
     else if (!Pointee->isDependentType() &&
-             RequireCompleteType(StartLoc, Pointee, 
+             RequireCompleteType(StartLoc, Pointee,
                                  PDiag(diag::warn_delete_incomplete)
                                    << Ex->getSourceRange()))
       return ExprError();
 
-    // FIXME: This should be shared with the code for finding the delete 
+    // FIXME: This should be shared with the code for finding the delete
     // operator in ActOnCXXNew.
     IntegerLiteral Size(llvm::APInt::getNullValue(
                         Context.Target.getPointerWidth(0)),
@@ -745,12 +738,12 @@
     ImplicitCastExpr Cast(Context.getPointerType(Context.VoidTy),
                           CastExpr::CK_Unknown, &Size, false);
     Expr *DeleteArg = &Cast;
-    
+
     DeclarationName DeleteName = Context.DeclarationNames.getCXXOperatorName(
                                       ArrayForm ? OO_Array_Delete : OO_Delete);
 
     if (Pointee->isRecordType() && !UseGlobal) {
-      CXXRecordDecl *Record 
+      CXXRecordDecl *Record
         = cast<CXXRecordDecl>(Pointee->getAs<RecordType>()->getDecl());
       // FIXME: We fail to find inherited overloads.
       if (FindAllocationOverload(StartLoc, SourceRange(), DeleteName,
@@ -759,20 +752,20 @@
         return ExprError();
       if (!Record->hasTrivialDestructor())
         if (const CXXDestructorDecl *Dtor = Record->getDestructor(Context))
-          MarkDeclarationReferenced(StartLoc, 
+          MarkDeclarationReferenced(StartLoc,
                                     const_cast<CXXDestructorDecl*>(Dtor));
     }
-    
+
     if (!OperatorDelete) {
       // Didn't find a member overload. Look for a global one.
       DeclareGlobalNewDelete();
       DeclContext *TUDecl = Context.getTranslationUnitDecl();
-      if (FindAllocationOverload(StartLoc, SourceRange(), DeleteName, 
+      if (FindAllocationOverload(StartLoc, SourceRange(), DeleteName,
                                  &DeleteArg, 1, TUDecl, /*AllowMissing=*/false,
                                  OperatorDelete))
         return ExprError();
     }
-    
+
     // FIXME: Check access and ambiguity of operator delete and destructor.
   }
 
@@ -804,7 +797,7 @@
   DeclaratorInfo *DInfo = 0;
   TagDecl *OwnedTag = 0;
   QualType Ty = GetTypeForDeclarator(D, S, &DInfo, /*Skip=*/0, &OwnedTag);
-  
+
   if (Ty->isFunctionType()) { // The declarator shall not specify a function...
     // We exit without creating a CXXConditionDeclExpr because a FunctionDecl
     // would be created and CXXConditionDeclExpr wants a VarDecl.
@@ -848,7 +841,7 @@
 /// conversion from a string literal to a pointer to non-const char or
 /// non-const wchar_t (for narrow and wide string literals,
 /// respectively).
-bool 
+bool
 Sema::IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType) {
   // Look inside the implicit cast, if it exists.
   if (ImplicitCastExpr *Cast = dyn_cast<ImplicitCastExpr>(From))
@@ -860,7 +853,7 @@
   // to wchar_t" (C++ 4.2p2).
   if (StringLiteral *StrLit = dyn_cast<StringLiteral>(From))
     if (const PointerType *ToPtrType = ToType->getAs<PointerType>())
-      if (const BuiltinType *ToPointeeType 
+      if (const BuiltinType *ToPointeeType
           = ToPtrType->getPointeeType()->getAsBuiltinType()) {
         // This conversion is considered only when there is an
         // explicit appropriate pointer target type (C++ 4.2p2).
@@ -886,19 +879,18 @@
 bool
 Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
                                 const char *Flavor, bool AllowExplicit,
-                                bool Elidable)
-{
+                                bool Elidable) {
   ImplicitConversionSequence ICS;
   ICS.ConversionKind = ImplicitConversionSequence::BadConversion;
   if (Elidable && getLangOptions().CPlusPlus0x) {
-    ICS = TryImplicitConversion(From, ToType, 
+    ICS = TryImplicitConversion(From, ToType,
                                 /*SuppressUserConversions=*/false,
-                                AllowExplicit, 
+                                AllowExplicit,
                                 /*ForceRValue=*/true,
                                 /*InOverloadResolution=*/false);
   }
   if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
-    ICS = TryImplicitConversion(From, ToType, 
+    ICS = TryImplicitConversion(From, ToType,
                                 /*SuppressUserConversions=*/false,
                                 AllowExplicit,
                                 /*ForceRValue=*/false,
@@ -929,9 +921,9 @@
       CastExpr::CastKind CastKind = CastExpr::CK_Unknown;
       if (CXXConversionDecl *CV = dyn_cast<CXXConversionDecl>(FD)) {
         // FIXME. Get actual Source Location.
-        From = 
+        From =
           new (Context) CXXFunctionalCastExpr(ToType.getNonReferenceType(),
-                                            ToType, SourceLocation(), 
+                                            ToType, SourceLocation(),
                                             CastExpr::CK_UserDefinedConversion,
                                             From, CV,
                                             SourceLocation());
@@ -940,9 +932,9 @@
       else if (CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD)) {
         // FIXME. Do we need to check for isLValueReferenceType?
         DefaultFunctionArrayConversion(From);
-        OwningExprResult InitResult = 
+        OwningExprResult InitResult =
           BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
-                                ToType.getNonReferenceType(), CD, 
+                                ToType.getNonReferenceType(), CD,
                                 MultiExprArg(*this, (void**)&From, 1));
         // Take ownership of this expression.
         From = InitResult.takeAs<Expr>();
@@ -972,7 +964,7 @@
 /// otherwise. The expression From is replaced with the converted
 /// expression. Flavor is the context in which we're performing this
 /// conversion, for use in error messages.
-bool 
+bool
 Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
                                 const StandardConversionSequence& SCS,
                                 const char *Flavor) {
@@ -985,15 +977,15 @@
   if (SCS.CopyConstructor) {
     // FIXME: When can ToType be a reference type?
     assert(!ToType->isReferenceType());
-    
-    OwningExprResult FromResult = 
-      BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(), 
-                            ToType, SCS.CopyConstructor, 
+
+    OwningExprResult FromResult =
+      BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
+                            ToType, SCS.CopyConstructor,
                             MultiExprArg(*this, (void**)&From, 1));
-    
+
     if (FromResult.isInvalid())
       return true;
-    
+
     From = FromResult.takeAs<Expr>();
     return false;
   }
@@ -1054,7 +1046,7 @@
   case ICK_Pointer_Conversion:
     if (SCS.IncompatibleObjC) {
       // Diagnose incompatible Objective-C conversions
-      Diag(From->getSourceRange().getBegin(), 
+      Diag(From->getSourceRange().getBegin(),
            diag::ext_typecheck_convert_incompatible_pointer)
         << From->getType() << ToType << Flavor
         << From->getSourceRange();
@@ -1090,7 +1082,7 @@
   case ICK_Qualification:
     // FIXME: Not sure about lvalue vs rvalue here in the presence of rvalue
     // references.
-    ImpCastExprToType(From, ToType.getNonReferenceType(), 
+    ImpCastExprToType(From, ToType.getNonReferenceType(),
                       CastExpr::CK_Unknown,
                       ToType->isLValueReferenceType());
     break;
@@ -1109,12 +1101,12 @@
                                                  TypeTy *Ty,
                                                  SourceLocation RParen) {
   QualType T = GetTypeFromParser(Ty);
-  
+
   // According to http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html
   // all traits except __is_class, __is_enum and __is_union require a the type
   // to be complete.
   if (OTT != UTT_IsClass && OTT != UTT_IsEnum && OTT != UTT_IsUnion) {
-    if (RequireCompleteType(KWLoc, T, 
+    if (RequireCompleteType(KWLoc, T,
                             diag::err_incomplete_type_used_in_type_trait_expr))
       return ExprError();
   }
@@ -1127,8 +1119,7 @@
 }
 
 QualType Sema::CheckPointerToMemberOperands(
-  Expr *&lex, Expr *&rex, SourceLocation Loc, bool isIndirect)
-{
+  Expr *&lex, Expr *&rex, SourceLocation Loc, bool isIndirect) {
   const char *OpSpelling = isIndirect ? "->*" : ".*";
   // C++ 5.5p2
   //   The binary operator .* [p3: ->*] binds its second operand, which shall
@@ -1140,7 +1131,7 @@
     Diag(Loc, diag::err_bad_memptr_rhs)
       << OpSpelling << RType << rex->getSourceRange();
     return QualType();
-  } 
+  }
 
   QualType Class(MemPtr->getClass(), 0);
 
@@ -1214,8 +1205,7 @@
 /// conversion.
 static bool TryClassUnification(Sema &Self, Expr *From, Expr *To,
                                 SourceLocation QuestionLoc,
-                                ImplicitConversionSequence &ICS)
-{
+                                ImplicitConversionSequence &ICS) {
   // C++0x 5.16p3
   //   The process for determining whether an operand expression E1 of type T1
   //   can be converted to match an operand expression E2 of type T2 is defined
@@ -1262,7 +1252,7 @@
       // Could still fail if there's no copy constructor.
       // FIXME: Is this a hard error then, or just a conversion failure? The
       // standard doesn't say.
-      ICS = Self.TryCopyInitialization(From, TTy, 
+      ICS = Self.TryCopyInitialization(From, TTy,
                                        /*SuppressUserConversions=*/false,
                                        /*ForceRValue=*/false,
                                        /*InOverloadResolution=*/false);
@@ -1274,7 +1264,7 @@
     // First find the decayed type.
     if (TTy->isFunctionType())
       TTy = Self.Context.getPointerType(TTy);
-    else if(TTy->isArrayType())
+    else if (TTy->isArrayType())
       TTy = Self.Context.getArrayDecayedType(TTy);
 
     // Now try the implicit conversion.
@@ -1339,8 +1329,7 @@
 /// second part of a standard conversion is ICK_DerivedToBase. This function
 /// handles the reference binding specially.
 static bool ConvertForConditional(Sema &Self, Expr *&E,
-                                  const ImplicitConversionSequence &ICS)
-{
+                                  const ImplicitConversionSequence &ICS) {
   if (ICS.ConversionKind == ImplicitConversionSequence::StandardConversion &&
       ICS.Standard.ReferenceBinding) {
     assert(ICS.Standard.DirectBinding &&
@@ -1583,13 +1572,13 @@
 QualType Sema::FindCompositePointerType(Expr *&E1, Expr *&E2) {
   assert(getLangOptions().CPlusPlus && "This function assumes C++");
   QualType T1 = E1->getType(), T2 = E2->getType();
-  
+
   if (!T1->isPointerType() && !T1->isMemberPointerType() &&
       !T2->isPointerType() && !T2->isMemberPointerType())
    return QualType();
 
   // FIXME: Do we need to work on the canonical types?
-  
+
   // C++0x 5.9p2
   //   Pointer conversions and qualification conversions are performed on
   //   pointer operands to bring them to their composite pointer type. If
@@ -1603,7 +1592,7 @@
     ImpCastExprToType(E2, T1);
     return T1;
   }
-  
+
   // Now both have to be pointers or member pointers.
   if (!T1->isPointerType() && !T1->isMemberPointerType() &&
       !T2->isPointerType() && !T2->isMemberPointerType())
@@ -1633,7 +1622,7 @@
       MemberOfClass.push_back(std::make_pair((const Type *)0, (const Type *)0));
       continue;
     }
-    
+
     const MemberPointerType *MemPtr1, *MemPtr2;
     if ((MemPtr1 = Composite1->getAs<MemberPointerType>()) &&
         (MemPtr2 = Composite2->getAs<MemberPointerType>())) {
@@ -1645,19 +1634,19 @@
                                              MemPtr2->getClass()));
       continue;
     }
-    
+
     // FIXME: block pointer types?
-    
+
     // Cannot unwrap any more types.
     break;
   } while (true);
-  
+
   // Rewrap the composites as pointers or member pointers with the union CVRs.
   llvm::SmallVector<std::pair<const Type *, const Type *>, 4>::iterator MOC
     = MemberOfClass.begin();
-  for (llvm::SmallVector<unsigned, 4>::iterator 
+  for (llvm::SmallVector<unsigned, 4>::iterator
          I = QualifierUnion.begin(),
-         E = QualifierUnion.end(); 
+         E = QualifierUnion.end();
        I != E; (void)++I, ++MOC) {
     if (MOC->first && MOC->second) {
       // Rebuild member pointer type
@@ -1672,19 +1661,19 @@
     }
   }
 
-  ImplicitConversionSequence E1ToC1 = 
+  ImplicitConversionSequence E1ToC1 =
     TryImplicitConversion(E1, Composite1,
                           /*SuppressUserConversions=*/false,
                           /*AllowExplicit=*/false,
                           /*ForceRValue=*/false,
                           /*InOverloadResolution=*/false);
-  ImplicitConversionSequence E2ToC1 = 
+  ImplicitConversionSequence E2ToC1 =
     TryImplicitConversion(E2, Composite1,
                           /*SuppressUserConversions=*/false,
                           /*AllowExplicit=*/false,
                           /*ForceRValue=*/false,
                           /*InOverloadResolution=*/false);
-  
+
   ImplicitConversionSequence E1ToC2, E2ToC2;
   E1ToC2.ConversionKind = ImplicitConversionSequence::BadConversion;
   E2ToC2.ConversionKind = ImplicitConversionSequence::BadConversion;
@@ -1726,16 +1715,16 @@
 Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
   if (!Context.getLangOptions().CPlusPlus)
     return Owned(E);
-  
+
   const RecordType *RT = E->getType()->getAs<RecordType>();
   if (!RT)
     return Owned(E);
-  
+
   CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
   if (RD->hasTrivialDestructor())
     return Owned(E);
-  
-  CXXTemporary *Temp = CXXTemporary::Create(Context, 
+
+  CXXTemporary *Temp = CXXTemporary::Create(Context,
                                             RD->getDestructor(Context));
   ExprTemporaries.push_back(Temp);
   if (CXXDestructorDecl *Destructor =
@@ -1745,40 +1734,40 @@
   return Owned(CXXBindTemporaryExpr::Create(Context, Temp, E));
 }
 
-Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr, 
+Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr,
                                               bool ShouldDestroyTemps) {
   assert(SubExpr && "sub expression can't be null!");
-  
+
   if (ExprTemporaries.empty())
     return SubExpr;
-  
+
   Expr *E = CXXExprWithTemporaries::Create(Context, SubExpr,
-                                           &ExprTemporaries[0], 
+                                           &ExprTemporaries[0],
                                            ExprTemporaries.size(),
                                            ShouldDestroyTemps);
   ExprTemporaries.clear();
-  
+
   return E;
 }
 
-Sema::OwningExprResult 
+Sema::OwningExprResult
 Sema::ActOnStartCXXMemberReference(Scope *S, ExprArg Base, SourceLocation OpLoc,
                                    tok::TokenKind OpKind, TypeTy *&ObjectType) {
   // Since this might be a postfix expression, get rid of ParenListExprs.
   Base = MaybeConvertParenListExprToParenExpr(S, move(Base));
-  
+
   Expr *BaseExpr = (Expr*)Base.get();
   assert(BaseExpr && "no record expansion");
-  
+
   QualType BaseType = BaseExpr->getType();
   if (BaseType->isDependentType()) {
     // FIXME: member of the current instantiation
     ObjectType = BaseType.getAsOpaquePtr();
     return move(Base);
   }
-  
+
   // C++ [over.match.oper]p8:
-  //   [...] When operator->returns, the operator-> is applied  to the value 
+  //   [...] When operator->returns, the operator-> is applied  to the value
   //   returned, with the original second operand.
   if (OpKind == tok::arrow) {
     while (BaseType->isRecordType()) {
@@ -1789,11 +1778,11 @@
       BaseType = BaseExpr->getType();
     }
   }
-  
+
   if (BaseType->isPointerType())
     BaseType = BaseType->getPointeeType();
-  
-  // We could end up with various non-record types here, such as extended 
+
+  // We could end up with various non-record types here, such as extended
   // vector types or Objective-C interfaces. Just return early and let
   // ActOnMemberReferenceExpr do the work.
   if (!BaseType->isRecordType()) {
@@ -1804,14 +1793,14 @@
     ObjectType = 0;
     return move(Base);
   }
-    
+
   // C++ [basic.lookup.classref]p2:
-  //   If the id-expression in a class member access (5.2.5) is an 
+  //   If the id-expression in a class member access (5.2.5) is an
   //   unqualified-id, and the type of the object expres- sion is of a class
   //   type C (or of pointer to a class type C), the unqualified-id is looked
   //   up in the scope of class C. [...]
   ObjectType = BaseType.getAsOpaquePtr();
-  return move(Base);  
+  return move(Base);
 }
 
 Sema::OwningExprResult
@@ -1832,16 +1821,16 @@
   else {
     TypeTy *BaseTy = getTypeName(*ClassName, ClassNameLoc, S, &SS);
     if (!BaseTy) {
-      Diag(ClassNameLoc, diag::err_ident_in_pseudo_dtor_not_a_type) 
+      Diag(ClassNameLoc, diag::err_ident_in_pseudo_dtor_not_a_type)
         << ClassName;
       return ExprError();
     }
-  
+
     BaseType = GetTypeFromParser(BaseTy);
   }
-  
+
   CanQualType CanBaseType = Context.getCanonicalType(BaseType);
-  DeclarationName DtorName = 
+  DeclarationName DtorName =
     Context.DeclarationNames.getCXXDestructorName(CanBaseType);
 
   OwningExprResult Result
@@ -1849,8 +1838,8 @@
                                DtorName, DeclPtrTy(), &SS);
   if (Result.isInvalid() || HasTrailingLParen)
     return move(Result);
-  
-  // The only way a reference to a destructor can be used is to 
+
+  // The only way a reference to a destructor can be used is to
   // immediately call them. Since the next token is not a '(', produce a
   // diagnostic and build the call now.
   Expr *E = (Expr *)Result.get();
@@ -1858,8 +1847,8 @@
   Diag(E->getLocStart(), diag::err_dtor_expr_without_call)
     << isa<CXXPseudoDestructorExpr>(E)
     << CodeModificationHint::CreateInsertion(ExpectedLParenLoc, "()");
-  
-  return ActOnCallExpr(0, move(Result), ExpectedLParenLoc, 
+
+  return ActOnCallExpr(0, move(Result), ExpectedLParenLoc,
                        MultiExprArg(*this, 0, 0), 0, ExpectedLParenLoc);
 }
 
@@ -1903,7 +1892,7 @@
 Sema::OwningExprResult Sema::ActOnFinishFullExpr(ExprArg Arg) {
   Expr *FullExpr = Arg.takeAs<Expr>();
   if (FullExpr)
-    FullExpr = MaybeCreateCXXExprWithTemporaries(FullExpr, 
+    FullExpr = MaybeCreateCXXExprWithTemporaries(FullExpr,
                                                  /*ShouldDestroyTemps=*/true);
 
 

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Sep  9 10:08:12 2009
@@ -20,7 +20,7 @@
 
 using namespace clang;
 
-Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs, 
+Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs,
                                               ExprTy **strings,
                                               unsigned NumStrings) {
   StringLiteral **Strings = reinterpret_cast<StringLiteral**>(strings);
@@ -30,40 +30,40 @@
   // each one, e.g. @"foo" "bar" @"baz" "qux"   which need to be turned into one
   // StringLiteral for ObjCStringLiteral to hold onto.
   StringLiteral *S = Strings[0];
-  
+
   // If we have a multi-part string, merge it all together.
   if (NumStrings != 1) {
     // Concatenate objc strings.
     llvm::SmallString<128> StrBuf;
     llvm::SmallVector<SourceLocation, 8> StrLocs;
-    
+
     for (unsigned i = 0; i != NumStrings; ++i) {
       S = Strings[i];
-      
+
       // ObjC strings can't be wide.
       if (S->isWide()) {
         Diag(S->getLocStart(), diag::err_cfstring_literal_not_string_constant)
           << S->getSourceRange();
         return true;
       }
-      
+
       // Get the string data.
       StrBuf.append(S->getStrData(), S->getStrData()+S->getByteLength());
-      
+
       // Get the locations of the string tokens.
       StrLocs.append(S->tokloc_begin(), S->tokloc_end());
-      
+
       // Free the temporary string.
       S->Destroy(Context);
     }
-    
+
     // Create the aggregate string with the appropriate content and location
     // information.
     S = StringLiteral::Create(Context, &StrBuf[0], StrBuf.size(), false,
                               Context.getPointerType(Context.CharTy),
                               &StrLocs[0], StrLocs.size());
   }
-  
+
   // Verify that this composite string is acceptable for ObjC strings.
   if (CheckObjCString(S))
     return true;
@@ -88,15 +88,15 @@
       Ty = Context.getObjCIdType();
     }
   }
-  
+
   return new (Context) ObjCStringLiteral(S, Ty, AtLocs[0]);
 }
 
-Expr *Sema::BuildObjCEncodeExpression(SourceLocation AtLoc, 
+Expr *Sema::BuildObjCEncodeExpression(SourceLocation AtLoc,
                                       QualType EncodedType,
                                       SourceLocation RParenLoc) {
   QualType StrTy;
-  if (EncodedType->isDependentType()) 
+  if (EncodedType->isDependentType())
     StrTy = Context.DependentTy;
   else {
     std::string Str;
@@ -111,7 +111,7 @@
     StrTy = Context.getConstantArrayType(StrTy, llvm::APInt(32, Str.size()+1),
                                          ArrayType::Normal, 0);
   }
-  
+
   return new (Context) ObjCEncodeExpr(StrTy, EncodedType, AtLoc, RParenLoc);
 }
 
@@ -131,7 +131,7 @@
                                                    SourceLocation SelLoc,
                                                    SourceLocation LParenLoc,
                                                    SourceLocation RParenLoc) {
-  ObjCMethodDecl *Method = LookupInstanceMethodInGlobalPool(Sel, 
+  ObjCMethodDecl *Method = LookupInstanceMethodInGlobalPool(Sel,
                              SourceRange(LParenLoc, RParenLoc), false);
   if (!Method)
     Method = LookupFactoryMethodInGlobalPool(Sel,
@@ -153,7 +153,7 @@
     Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId;
     return true;
   }
-  
+
   QualType Ty = Context.getObjCProtoType();
   if (Ty.isNull())
     return true;
@@ -161,11 +161,11 @@
   return new (Context) ObjCProtocolExpr(Ty, PDecl, AtLoc, RParenLoc);
 }
 
-bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, 
-                                     Selector Sel, ObjCMethodDecl *Method, 
+bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs,
+                                     Selector Sel, ObjCMethodDecl *Method,
                                      bool isClassMessage,
                                      SourceLocation lbrac, SourceLocation rbrac,
-                                     QualType &ReturnType) {  
+                                     QualType &ReturnType) {
   if (!Method) {
     // Apply default argument promotion as for (C99 6.5.2.2p6).
     for (unsigned i = 0; i != NumArgs; i++)
@@ -178,9 +178,9 @@
     ReturnType = Context.getObjCIdType();
     return false;
   }
-  
+
   ReturnType = Method->getResultType();
-   
+
   unsigned NumNamedArgs = Sel.getNumArgs();
   assert(NumArgs >= NumNamedArgs && "Too few arguments for selector!");
 
@@ -188,22 +188,22 @@
   for (unsigned i = 0; i < NumNamedArgs; i++) {
     Expr *argExpr = Args[i];
     assert(argExpr && "CheckMessageArgumentTypes(): missing expression");
-    
+
     QualType lhsType = Method->param_begin()[i]->getType();
     QualType rhsType = argExpr->getType();
 
-    // If necessary, apply function/array conversion. C99 6.7.5.3p[7,8]. 
+    // If necessary, apply function/array conversion. C99 6.7.5.3p[7,8].
     if (lhsType->isArrayType())
       lhsType = Context.getArrayDecayedType(lhsType);
     else if (lhsType->isFunctionType())
       lhsType = Context.getPointerType(lhsType);
 
-    AssignConvertType Result = 
+    AssignConvertType Result =
       CheckSingleAssignmentConstraints(lhsType, argExpr);
     if (Args[i] != argExpr) // The expression was converted.
       Args[i] = argExpr; // Make sure we store the converted expression.
-    
-    IsError |= 
+
+    IsError |=
       DiagnoseAssignmentResult(Result, argExpr->getLocStart(), lhsType, rhsType,
                                argExpr, "sending");
   }
@@ -215,7 +215,7 @@
   } else {
     // Check for extra arguments to non-variadic methods.
     if (NumArgs != NumNamedArgs) {
-      Diag(Args[NumNamedArgs]->getLocStart(), 
+      Diag(Args[NumNamedArgs]->getLocStart(),
            diag::err_typecheck_call_too_many_args)
         << 2 /*method*/ << Method->getSourceRange()
         << SourceRange(Args[NumNamedArgs]->getLocStart(),
@@ -244,22 +244,22 @@
   while (ClassDecl && !Method) {
     if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
       Method = ImpDecl->getClassMethod(Sel);
-    
+
     // Look through local category implementations associated with the class.
     if (!Method)
       Method = ClassDecl->getCategoryClassMethod(Sel);
-    
+
     // Before we give up, check if the selector is an instance method.
     // But only in the root. This matches gcc's behaviour and what the
     // runtime expects.
     if (!Method && !ClassDecl->getSuperClass()) {
       Method = ClassDecl->lookupInstanceMethod(Sel);
-      // Look through local category implementations associated 
+      // Look through local category implementations associated
       // with the root class.
-      if (!Method) 
+      if (!Method)
         Method = LookupPrivateInstanceMethod(Sel, ClassDecl);
     }
-    
+
     ClassDecl = ClassDecl->getSuperClass();
   }
   return Method;
@@ -272,7 +272,7 @@
     // If we have implementations in scope, check "private" methods.
     if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
       Method = ImpDecl->getInstanceMethod(Sel);
-    
+
     // Look through local category implementations associated with the class.
     if (!Method)
       Method = ClassDecl->getCategoryInstanceMethod(Sel);
@@ -286,11 +286,11 @@
   IdentifierInfo &propertyName,
   SourceLocation &receiverNameLoc,
   SourceLocation &propertyNameLoc) {
-  
+
   ObjCInterfaceDecl *IFace = getObjCInterfaceDecl(&receiverName);
-  
+
   // Search for a declared property first.
-  
+
   Selector Sel = PP.getSelectorTable().getNullarySelector(&propertyName);
   ObjCMethodDecl *Getter = IFace->lookupClassMethod(Sel);
 
@@ -307,12 +307,12 @@
     if (DiagnoseUseOfDecl(Getter, propertyNameLoc))
       return ExprError();
   }
-  
+
   // Look for the matching setter, in case it is needed.
-  Selector SetterSel = 
-    SelectorTable::constructSetterName(PP.getIdentifierTable(), 
+  Selector SetterSel =
+    SelectorTable::constructSetterName(PP.getIdentifierTable(),
                                        PP.getSelectorTable(), &propertyName);
-    
+
   ObjCMethodDecl *Setter = IFace->lookupClassMethod(SetterSel);
   if (!Setter) {
     // If this reference is in an @implementation, also check for 'private'
@@ -340,7 +340,7 @@
         PType = (*PI)->getType();
     }
     return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(
-                                  Getter, PType, Setter, 
+                                  Getter, PType, Setter,
                                   propertyNameLoc, IFace, receiverNameLoc));
   }
   return ExprError(Diag(propertyNameLoc, diag::err_property_not_found)
@@ -355,21 +355,20 @@
   Scope *S,
   IdentifierInfo *receiverName, Selector Sel,
   SourceLocation lbrac, SourceLocation receiverLoc,
-  SourceLocation selectorLoc, SourceLocation rbrac, 
-  ExprTy **Args, unsigned NumArgs)
-{
+  SourceLocation selectorLoc, SourceLocation rbrac,
+  ExprTy **Args, unsigned NumArgs) {
   assert(receiverName && "missing receiver class name");
 
   Expr **ArgExprs = reinterpret_cast<Expr **>(Args);
   ObjCInterfaceDecl* ClassDecl = 0;
   bool isSuper = false;
-  
+
   if (receiverName->isStr("super")) {
     if (getCurMethodDecl()) {
       isSuper = true;
       ObjCInterfaceDecl *OID = getCurMethodDecl()->getClassInterface();
       if (!OID)
-        return Diag(lbrac, diag::error_no_super_class_message) 
+        return Diag(lbrac, diag::error_no_super_class_message)
                       << getCurMethodDecl()->getDeclName();
       ClassDecl = OID->getSuperClass();
       if (!ClassDecl)
@@ -380,7 +379,7 @@
         ExprResult ReceiverExpr = new (Context) ObjCSuperExpr(SourceLocation(),
                                                               superTy);
         // We are really in an instance method, redirect.
-        return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, 
+        return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac,
                                     selectorLoc, rbrac, Args, NumArgs);
       }
       // We are sending a message to 'super' within a class method. Do nothing,
@@ -391,17 +390,17 @@
       NamedDecl *SuperDecl = LookupName(S, receiverName, LookupOrdinaryName);
       ValueDecl *VD = dyn_cast_or_null<ValueDecl>(SuperDecl);
       if (VD) {
-        ExprResult ReceiverExpr = new (Context) DeclRefExpr(VD, VD->getType(), 
+        ExprResult ReceiverExpr = new (Context) DeclRefExpr(VD, VD->getType(),
                                                             receiverLoc);
         // We are really in an instance method, redirect.
-        return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, 
+        return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac,
                                     selectorLoc, rbrac, Args, NumArgs);
       }
       return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName;
-    }      
+    }
   } else
     ClassDecl = getObjCInterfaceDecl(receiverName);
-  
+
   // The following code allows for the following GCC-ism:
   //
   //  typedef XCElementDisplayRect XCElementGraphicsRect;
@@ -432,25 +431,25 @@
     Diag(lbrac, diag::warn_receiver_forward_class) << ClassDecl->getDeclName();
     Method = LookupFactoryMethodInGlobalPool(Sel, SourceRange(lbrac,rbrac));
     if (Method)
-      Diag(Method->getLocation(), diag::note_method_sent_forward_class) 
+      Diag(Method->getLocation(), diag::note_method_sent_forward_class)
         << Method->getDeclName();
   }
   if (!Method)
     Method = ClassDecl->lookupClassMethod(Sel);
-  
+
   // If we have an implementation in scope, check "private" methods.
   if (!Method)
     Method = LookupPrivateClassMethod(Sel, ClassDecl);
 
   if (Method && DiagnoseUseOfDecl(Method, receiverLoc))
     return true;
-  
-  if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, true, 
+
+  if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, true,
                                 lbrac, rbrac, returnType))
     return true;
 
   returnType = returnType.getNonReferenceType();
-  
+
   // If we have the ObjCInterfaceDecl* for the class that is receiving the
   // message, use that to construct the ObjCMessageExpr.  Otherwise pass on the
   // IdentifierInfo* for the class.
@@ -469,19 +468,19 @@
 // ArgExprs is optional - if it is present, the number of expressions
 // is obtained from Sel.getNumArgs().
 Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
-                                            SourceLocation lbrac, 
+                                            SourceLocation lbrac,
                                             SourceLocation receiverLoc,
                                             SourceLocation rbrac,
                                             ExprTy **Args, unsigned NumArgs) {
   assert(receiver && "missing receiver expression");
-  
+
   Expr **ArgExprs = reinterpret_cast<Expr **>(Args);
   Expr *RExpr = static_cast<Expr *>(receiver);
-  
+
   // If necessary, apply function/array conversion to the receiver.
   // C99 6.7.5.3p[7,8].
   DefaultFunctionArrayConversion(RExpr);
-  
+
   QualType returnType;
   QualType ReceiverCType =
     Context.getCanonicalType(RExpr->getType()).getUnqualifiedType();
@@ -494,8 +493,8 @@
       if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface())
         if (ObjCInterfaceDecl *SuperDecl = ClassDecl->getSuperClass()) {
           Method = SuperDecl->lookupInstanceMethod(Sel);
-          
-          if (!Method) 
+
+          if (!Method)
             // If we have implementations in scope, check "private" methods.
             Method = LookupPrivateInstanceMethod(Sel, SuperDecl);
         }
@@ -507,41 +506,41 @@
     if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false,
                                   lbrac, rbrac, returnType))
       return true;
-    
+
     returnType = returnType.getNonReferenceType();
     return new (Context) ObjCMessageExpr(RExpr, Sel, returnType, Method, lbrac,
                                          rbrac, ArgExprs, NumArgs);
   }
 
-  // Handle messages to id.  
+  // Handle messages to id.
   if (ReceiverCType->isObjCIdType() || ReceiverCType->isBlockPointerType() ||
       Context.isObjCNSObjectType(RExpr->getType())) {
     ObjCMethodDecl *Method = LookupInstanceMethodInGlobalPool(
                                Sel, SourceRange(lbrac,rbrac));
     if (!Method)
       Method = LookupFactoryMethodInGlobalPool(Sel, SourceRange(lbrac, rbrac));
-    if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false, 
+    if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false,
                                   lbrac, rbrac, returnType))
       return true;
     returnType = returnType.getNonReferenceType();
     return new (Context) ObjCMessageExpr(RExpr, Sel, returnType, Method, lbrac,
                                          rbrac, ArgExprs, NumArgs);
   }
-  
+
   // Handle messages to Class.
-  if (ReceiverCType->isObjCClassType() || 
+  if (ReceiverCType->isObjCClassType() ||
       ReceiverCType->isObjCQualifiedClassType()) {
     ObjCMethodDecl *Method = 0;
-    
+
     if (ObjCMethodDecl *CurMeth = getCurMethodDecl()) {
       if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) {
         // First check the public methods in the class interface.
         Method = ClassDecl->lookupClassMethod(Sel);
-        
+
         if (!Method)
           Method = LookupPrivateClassMethod(Sel, ClassDecl);
-          
-        // FIXME: if we still haven't found a method, we need to look in 
+
+        // FIXME: if we still haven't found a method, we need to look in
         // protocols (if we have qualifiers).
       }
       if (Method && DiagnoseUseOfDecl(Method, receiverLoc))
@@ -573,13 +572,13 @@
     return new (Context) ObjCMessageExpr(RExpr, Sel, returnType, Method, lbrac,
                                          rbrac, ArgExprs, NumArgs);
   }
-  
+
   ObjCMethodDecl *Method = 0;
   ObjCInterfaceDecl* ClassDecl = 0;
-  
-  // We allow sending a message to a qualified ID ("id<foo>"), which is ok as 
+
+  // We allow sending a message to a qualified ID ("id<foo>"), which is ok as
   // long as one of the protocols implements the selector (if not, warn).
-  if (const ObjCObjectPointerType *QIdTy = 
+  if (const ObjCObjectPointerType *QIdTy =
         ReceiverCType->getAsObjCQualifiedIdType()) {
     // Search protocols for instance methods.
     for (ObjCObjectPointerType::qual_iterator I = QIdTy->qual_begin(),
@@ -591,16 +590,16 @@
       if (PDecl && (Method = PDecl->lookupClassMethod(Sel)))
         break;
     }
-  } else if (const ObjCObjectPointerType *OCIType = 
+  } else if (const ObjCObjectPointerType *OCIType =
                 ReceiverCType->getAsObjCInterfacePointerType()) {
     // We allow sending a message to a pointer to an interface (an object).
-    
+
     ClassDecl = OCIType->getInterfaceDecl();
     // FIXME: consider using LookupInstanceMethodInGlobalPool, since it will be
     // faster than the following method (which can do *many* linear searches).
     // The idea is to add class info to InstanceMethodPool.
     Method = ClassDecl->lookupInstanceMethod(Sel);
-    
+
     if (!Method) {
       // Search protocol qualifiers.
       for (ObjCObjectPointerType::qual_iterator QI = OCIType->qual_begin(),
@@ -612,7 +611,7 @@
     if (!Method) {
       // If we have implementations in scope, check "private" methods.
       Method = LookupPrivateInstanceMethod(Sel, ClassDecl);
-      
+
       if (!Method && !isSelfExpr(RExpr)) {
         // If we still haven't found a method, look in the global pool. This
         // behavior isn't very desirable, however we need it for GCC
@@ -621,7 +620,7 @@
           Method = LookupInstanceMethodInGlobalPool(
                                Sel, SourceRange(lbrac,rbrac));
           if (Method && !OCIType->getInterfaceDecl()->isForwardDecl())
-            Diag(lbrac, diag::warn_maynot_respond) 
+            Diag(lbrac, diag::warn_maynot_respond)
               << OCIType->getInterfaceDecl()->getIdentifier()->getName() << Sel;
         }
       }
@@ -630,7 +629,7 @@
       return true;
   } else if (!Context.getObjCIdType().isNull() &&
              (ReceiverCType->isPointerType() ||
-              (ReceiverCType->isIntegerType() && 
+              (ReceiverCType->isIntegerType() &&
                ReceiverCType->isScalarType()))) {
     // Implicitly convert integers and pointers to 'id' but emit a warning.
     Diag(lbrac, diag::warn_bad_receiver_type)
@@ -642,7 +641,7 @@
       << RExpr->getType() << RExpr->getSourceRange();
     return true;
   }
-  
+
   if (Method)
     DiagnoseSentinelCalls(Method, receiverLoc, ArgExprs, NumArgs);
   if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false,

Modified: cfe/trunk/lib/Sema/SemaInherit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInherit.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInherit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInherit.cpp Wed Sep  9 10:08:12 2009
@@ -28,9 +28,9 @@
 /// \brief Computes the set of declarations referenced by these base
 /// paths.
 void BasePaths::ComputeDeclsFound() {
-  assert(NumDeclsFound == 0 && !DeclsFound && 
+  assert(NumDeclsFound == 0 && !DeclsFound &&
          "Already computed the set of declarations");
-  
+
   std::set<NamedDecl *> Decls;
   for (BasePaths::paths_iterator Path = begin(), PathEnd = end();
        Path != PathEnd; ++Path)
@@ -127,24 +127,24 @@
 /// behavior of this lookup, e.g., whether it finds ambiguities,
 /// records paths, or attempts to detect the use of virtual base
 /// classes.
-bool Sema::LookupInBases(CXXRecordDecl *Class, 
+bool Sema::LookupInBases(CXXRecordDecl *Class,
                          const MemberLookupCriteria& Criteria,
                          BasePaths &Paths) {
   bool FoundPath = false;
 
   for (CXXRecordDecl::base_class_const_iterator BaseSpec = Class->bases_begin(),
-                                             BaseSpecEnd = Class->bases_end(); 
+                                             BaseSpecEnd = Class->bases_end();
        BaseSpec != BaseSpecEnd; ++BaseSpec) {
     // Find the record of the base class subobjects for this type.
     QualType BaseType = Context.getCanonicalType(BaseSpec->getType());
     BaseType = BaseType.getUnqualifiedType();
 
-    // If a base class of the class template depends on a template-parameter, 
+    // If a base class of the class template depends on a template-parameter,
     // the base class scope is not examined during unqualified name lookup.
     // [temp.dep]p3.
     if (BaseType->isDependentType())
       continue;
-    
+
     // Determine whether we need to visit this base class at all,
     // updating the count of subobjects appropriately.
     std::pair<bool, unsigned>& Subobjects = Paths.ClassSubobjects[BaseType];
@@ -174,7 +174,7 @@
       Paths.ScratchPath.push_back(Element);
     }
 
-    CXXRecordDecl *BaseRecord 
+    CXXRecordDecl *BaseRecord
       = cast<CXXRecordDecl>(BaseSpec->getType()->getAs<RecordType>()->getDecl());
 
     // Either look at the base class type or look into the base class
@@ -183,7 +183,7 @@
     bool FoundPathToThisBase = false;
     switch (Criteria.Kind) {
     case MemberLookupCriteria::LK_Base:
-      FoundPathToThisBase 
+      FoundPathToThisBase
         = (Context.getCanonicalType(BaseSpec->getType()) == Criteria.Base);
       break;
     case MemberLookupCriteria::LK_NamedMember:
@@ -198,19 +198,19 @@
       }
       break;
     case MemberLookupCriteria::LK_OverriddenMember:
-      Paths.ScratchPath.Decls = 
+      Paths.ScratchPath.Decls =
         BaseRecord->lookup(Criteria.Method->getDeclName());
       while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) {
-        if (CXXMethodDecl *MD = 
+        if (CXXMethodDecl *MD =
               dyn_cast<CXXMethodDecl>(*Paths.ScratchPath.Decls.first)) {
           OverloadedFunctionDecl::function_iterator MatchedDecl;
-          if (MD->isVirtual() && 
+          if (MD->isVirtual() &&
               !IsOverload(Criteria.Method, MD, MatchedDecl)) {
             FoundPathToThisBase = true;
             break;
           }
         }
-        
+
         ++Paths.ScratchPath.Decls.first;
       }
       break;
@@ -296,27 +296,27 @@
   bool StillOkay = IsDerivedFrom(Derived, Base, Paths);
   assert(StillOkay && "Can only be used with a derived-to-base conversion");
   (void)StillOkay;
-  
+
   // Build up a textual representation of the ambiguous paths, e.g.,
   // D -> B -> A, that will be used to illustrate the ambiguous
   // conversions in the diagnostic. We only print one of the paths
   // to each base class subobject.
   std::string PathDisplayStr = getAmbiguousPathsDisplayString(Paths);
-  
+
   Diag(Loc, AmbigiousBaseConvID)
     << Derived << Base << PathDisplayStr << Range << Name;
   return true;
 }
 
-bool 
+bool
 Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
                                    SourceLocation Loc, SourceRange Range) {
-  return CheckDerivedToBaseConversion(Derived, Base, 
+  return CheckDerivedToBaseConversion(Derived, Base,
                                       diag::err_conv_to_inaccessible_base,
                                       diag::err_ambiguous_derived_to_base_conv,
                                       Loc, Range, DeclarationName());
 }
-                                      
+
 
 /// @brief Builds a string representing ambiguous paths from a
 /// specific derived class to different subobjects of the same base
@@ -333,16 +333,16 @@
 std::string Sema::getAmbiguousPathsDisplayString(BasePaths &Paths) {
   std::string PathDisplayStr;
   std::set<unsigned> DisplayedPaths;
-  for (BasePaths::paths_iterator Path = Paths.begin(); 
+  for (BasePaths::paths_iterator Path = Paths.begin();
        Path != Paths.end(); ++Path) {
     if (DisplayedPaths.insert(Path->back().SubobjectNumber).second) {
       // We haven't displayed a path to this particular base
       // class subobject yet.
       PathDisplayStr += "\n    ";
       PathDisplayStr += Paths.getOrigin().getAsString();
-      for (BasePath::const_iterator Element = Path->begin(); 
+      for (BasePath::const_iterator Element = Path->begin();
            Element != Path->end(); ++Element)
-        PathDisplayStr += " -> " + Element->Base->getType().getAsString(); 
+        PathDisplayStr += " -> " + Element->Base->getType().getAsString();
     }
   }
 

Modified: cfe/trunk/lib/Sema/SemaInherit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInherit.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInherit.h (original)
+++ cfe/trunk/lib/Sema/SemaInherit.h Wed Sep  9 10:08:12 2009
@@ -41,11 +41,11 @@
 
     /// Class - The record decl of the class that the base is a base of.
     const CXXRecordDecl *Class;
-    
+
     /// SubobjectNumber - Identifies which base class subobject (of type
-    /// @c Base->getType()) this base path element refers to. This 
+    /// @c Base->getType()) this base path element refers to. This
     /// value is only valid if @c !Base->isVirtual(), because there
-    /// is no base numbering for the zero or one virtual bases of a 
+    /// is no base numbering for the zero or one virtual bases of a
     /// given type.
     int SubobjectNumber;
   };
@@ -107,7 +107,7 @@
     /// while the element contains the number of non-virtual base
     /// class subobjects for that class type. The key of the map is
     /// the cv-unqualified canonical type of the base class subobject.
-    std::map<QualType, std::pair<bool, unsigned>, QualTypeOrdering> 
+    std::map<QualType, std::pair<bool, unsigned>, QualTypeOrdering>
       ClassSubobjects;
 
     /// FindAmbiguities - Whether Sema::IsDerivedFrom should try find
@@ -145,7 +145,7 @@
   public:
     typedef std::list<BasePath>::const_iterator paths_iterator;
     typedef NamedDecl **decl_iterator;
-    
+
     /// BasePaths - Construct a new BasePaths structure to record the
     /// paths for a derived-to-base search.
     explicit BasePaths(bool FindAmbiguities = true,
@@ -153,8 +153,7 @@
                        bool DetectVirtual = true)
       : FindAmbiguities(FindAmbiguities), RecordPaths(RecordPaths),
         DetectVirtual(DetectVirtual), DetectedVirtual(0), DeclsFound(0),
-        NumDeclsFound(0)
-    {}
+        NumDeclsFound(0) { }
 
     ~BasePaths() { delete [] DeclsFound; }
 
@@ -208,22 +207,22 @@
       LK_NamedMember,
       LK_OverriddenMember
     };
-    
+
     /// MemberLookupCriteria - Constructs member lookup criteria to
     /// search for a base class of type Base.
-    explicit MemberLookupCriteria(QualType Base) 
+    explicit MemberLookupCriteria(QualType Base)
       : Kind(LK_Base), Base(Base) { }
 
     /// MemberLookupCriteria - Constructs member lookup criteria to
     /// search for a class member with the given Name.
-    explicit MemberLookupCriteria(DeclarationName Name, 
+    explicit MemberLookupCriteria(DeclarationName Name,
                                   Sema::LookupNameKind NameKind,
-                                  unsigned IDNS) 
+                                  unsigned IDNS)
       : Kind(LK_NamedMember), Name(Name), NameKind(NameKind), IDNS(IDNS) { }
 
     explicit MemberLookupCriteria(CXXMethodDecl *MD)
       : Kind(LK_OverriddenMember), Method(MD) { }
-    
+
     /// Kind - The kind of lookup we're doing.
     /// LK_Base if we are looking for a base class (whose
     /// type is Base). LK_NamedMember if we are looking for a named member of
@@ -240,7 +239,7 @@
 
     Sema::LookupNameKind NameKind;
     unsigned IDNS;
-    
+
     CXXMethodDecl *Method;
   };
 }

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Wed Sep  9 10:08:12 2009
@@ -36,7 +36,7 @@
 
   // See if this is a string literal or @encode.
   Init = Init->IgnoreParens();
-  
+
   // Handle @encode, which is a narrow string.
   if (isa<ObjCEncodeExpr>(Init) && AT->getElementType()->isCharType())
     return Init;
@@ -58,26 +58,26 @@
   if (Context.typesAreCompatible(Context.getWCharType(),
                                  ElemTy.getUnqualifiedType()))
     return Init;
-  
+
   return 0;
 }
 
-static bool CheckSingleInitializer(Expr *&Init, QualType DeclType, 
+static bool CheckSingleInitializer(Expr *&Init, QualType DeclType,
                                    bool DirectInit, Sema &S) {
   // Get the type before calling CheckSingleAssignmentConstraints(), since
   // it can promote the expression.
-  QualType InitType = Init->getType(); 
-  
+  QualType InitType = Init->getType();
+
   if (S.getLangOptions().CPlusPlus) {
     // FIXME: I dislike this error message. A lot.
     if (S.PerformImplicitConversion(Init, DeclType, "initializing", DirectInit))
       return S.Diag(Init->getSourceRange().getBegin(),
                     diag::err_typecheck_convert_incompatible)
-        << DeclType << Init->getType() << "initializing" 
+        << DeclType << Init->getType() << "initializing"
         << Init->getSourceRange();
     return false;
   }
-  
+
   Sema::AssignConvertType ConvTy =
     S.CheckSingleAssignmentConstraints(DeclType, Init);
   return S.DiagnoseAssignmentResult(ConvTy, Init->getLocStart(), DeclType,
@@ -89,10 +89,10 @@
   uint64_t StrLength =
     cast<ConstantArrayType>(Str->getType())->getSize().getZExtValue();
 
-  
+
   const ArrayType *AT = S.Context.getAsArrayType(DeclT);
   if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(AT)) {
-    // C99 6.7.8p14. We have an array of character type with unknown size 
+    // C99 6.7.8p14. We have an array of character type with unknown size
     // being initialized to a string literal.
     llvm::APSInt ConstVal(32);
     ConstVal = StrLength;
@@ -102,9 +102,9 @@
                                                       ArrayType::Normal, 0);
     return;
   }
-  
+
   const ConstantArrayType *CAT = cast<ConstantArrayType>(AT);
-  
+
   // C99 6.7.8p14. We have an array of character type with known size.  However,
   // the size may be smaller or larger than the string we are initializing.
   // FIXME: Avoid truncation for 64-bit length strings.
@@ -112,7 +112,7 @@
     S.Diag(Str->getSourceRange().getBegin(),
            diag::warn_initializer_string_for_char_array_too_long)
       << Str->getSourceRange();
-  
+
   // Set the type to the actual size that we are initializing.  If we have
   // something like:
   //   char x[1] = "foo";
@@ -123,26 +123,26 @@
 bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
                                  SourceLocation InitLoc,
                                  DeclarationName InitEntity, bool DirectInit) {
-  if (DeclType->isDependentType() || 
+  if (DeclType->isDependentType() ||
       Init->isTypeDependent() || Init->isValueDependent())
     return false;
-  
+
   // C++ [dcl.init.ref]p1:
   //   A variable declared to be a T& or T&&, that is "reference to type T"
   //   (8.3.2), shall be initialized by an object, or function, of
   //   type T or by an object that can be converted into a T.
   if (DeclType->isReferenceType())
-    return CheckReferenceInit(Init, DeclType, 
+    return CheckReferenceInit(Init, DeclType,
                               /*SuppressUserConversions=*/false,
                               /*AllowExplicit=*/DirectInit,
                               /*ForceRValue=*/false);
-  
+
   // C99 6.7.8p3: The type of the entity to be initialized shall be an array
   // of unknown size ("[]") or an object type that is not a variable array type.
   if (const VariableArrayType *VAT = Context.getAsVariableArrayType(DeclType))
     return Diag(InitLoc,  diag::err_variable_object_no_init)
     << VAT->getSizeExpr()->getSourceRange();
-  
+
   InitListExpr *InitList = dyn_cast<InitListExpr>(Init);
   if (!InitList) {
     // FIXME: Handle wide strings
@@ -150,47 +150,47 @@
       CheckStringInit(Str, DeclType, *this);
       return false;
     }
-    
+
     // C++ [dcl.init]p14:
     //   -- If the destination type is a (possibly cv-qualified) class
     //      type:
     if (getLangOptions().CPlusPlus && DeclType->isRecordType()) {
       QualType DeclTypeC = Context.getCanonicalType(DeclType);
       QualType InitTypeC = Context.getCanonicalType(Init->getType());
-      
+
       //   -- If the initialization is direct-initialization, or if it is
       //      copy-initialization where the cv-unqualified version of the
       //      source type is the same class as, or a derived class of, the
       //      class of the destination, constructors are considered.
       if ((DeclTypeC.getUnqualifiedType() == InitTypeC.getUnqualifiedType()) ||
           IsDerivedFrom(InitTypeC, DeclTypeC)) {
-        const CXXRecordDecl *RD = 
+        const CXXRecordDecl *RD =
           cast<CXXRecordDecl>(DeclType->getAs<RecordType>()->getDecl());
-        
+
         // No need to make a CXXConstructExpr if both the ctor and dtor are
         // trivial.
         if (RD->hasTrivialConstructor() && RD->hasTrivialDestructor())
           return false;
-        
-        CXXConstructorDecl *Constructor 
+
+        CXXConstructorDecl *Constructor
         = PerformInitializationByConstructor(DeclType, &Init, 1,
                                              InitLoc, Init->getSourceRange(),
-                                             InitEntity, 
+                                             InitEntity,
                                              DirectInit? IK_Direct : IK_Copy);
         if (!Constructor)
           return true;
-        
-        OwningExprResult InitResult = 
+
+        OwningExprResult InitResult =
           BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
-                                DeclType, Constructor, 
+                                DeclType, Constructor,
                                 MultiExprArg(*this, (void**)&Init, 1));
         if (InitResult.isInvalid())
           return true;
-        
+
         Init = InitResult.takeAs<Expr>();
         return false;
       }
-      
+
       //   -- Otherwise (i.e., for the remaining copy-initialization
       //      cases), user-defined conversion sequences that can
       //      convert from the source type to the destination type or
@@ -207,7 +207,7 @@
       // have ASTs for such things.
       if (!PerformImplicitConversion(Init, DeclType, "initializing"))
         return false;
-      
+
       if (InitEntity)
         return Diag(InitLoc, diag::err_cannot_initialize_decl)
           << InitEntity << (int)(Init->isLvalue(Context) == Expr::LV_Valid)
@@ -216,15 +216,15 @@
         << DeclType << (int)(Init->isLvalue(Context) == Expr::LV_Valid)
         << Init->getType() << Init->getSourceRange();
     }
-    
+
     // C99 6.7.8p16.
     if (DeclType->isArrayType())
       return Diag(Init->getLocStart(), diag::err_array_init_list_required)
         << Init->getSourceRange();
-    
+
     return CheckSingleInitializer(Init, DeclType, DirectInit, *this);
-  } 
-  
+  }
+
   bool hadError = CheckInitList(InitList, DeclType);
   Init = InitList;
   return hadError;
@@ -267,8 +267,8 @@
   bool hadError;
   std::map<InitListExpr *, InitListExpr *> SyntacticToSemantic;
   InitListExpr *FullyStructuredList;
-  
-  void CheckImplicitInitList(InitListExpr *ParentIList, QualType T, 
+
+  void CheckImplicitInitList(InitListExpr *ParentIList, QualType T,
                              unsigned &Index, InitListExpr *StructuredList,
                              unsigned &StructuredIndex,
                              bool TopLevelObject = false);
@@ -276,41 +276,41 @@
                              unsigned &Index, InitListExpr *StructuredList,
                              unsigned &StructuredIndex,
                              bool TopLevelObject = false);
-  void CheckListElementTypes(InitListExpr *IList, QualType &DeclType, 
-                             bool SubobjectIsDesignatorContext, 
+  void CheckListElementTypes(InitListExpr *IList, QualType &DeclType,
+                             bool SubobjectIsDesignatorContext,
                              unsigned &Index,
                              InitListExpr *StructuredList,
                              unsigned &StructuredIndex,
                              bool TopLevelObject = false);
-  void CheckSubElementType(InitListExpr *IList, QualType ElemType, 
+  void CheckSubElementType(InitListExpr *IList, QualType ElemType,
                            unsigned &Index,
                            InitListExpr *StructuredList,
                            unsigned &StructuredIndex);
-  void CheckScalarType(InitListExpr *IList, QualType DeclType, 
+  void CheckScalarType(InitListExpr *IList, QualType DeclType,
                        unsigned &Index,
                        InitListExpr *StructuredList,
                        unsigned &StructuredIndex);
-  void CheckReferenceType(InitListExpr *IList, QualType DeclType, 
+  void CheckReferenceType(InitListExpr *IList, QualType DeclType,
                           unsigned &Index,
                           InitListExpr *StructuredList,
                           unsigned &StructuredIndex);
   void CheckVectorType(InitListExpr *IList, QualType DeclType, unsigned &Index,
                        InitListExpr *StructuredList,
                        unsigned &StructuredIndex);
-  void CheckStructUnionTypes(InitListExpr *IList, QualType DeclType, 
-                             RecordDecl::field_iterator Field, 
+  void CheckStructUnionTypes(InitListExpr *IList, QualType DeclType,
+                             RecordDecl::field_iterator Field,
                              bool SubobjectIsDesignatorContext, unsigned &Index,
                              InitListExpr *StructuredList,
                              unsigned &StructuredIndex,
                              bool TopLevelObject = false);
-  void CheckArrayType(InitListExpr *IList, QualType &DeclType, 
-                      llvm::APSInt elementIndex, 
+  void CheckArrayType(InitListExpr *IList, QualType &DeclType,
+                      llvm::APSInt elementIndex,
                       bool SubobjectIsDesignatorContext, unsigned &Index,
                       InitListExpr *StructuredList,
                       unsigned &StructuredIndex);
-  bool CheckDesignatedInitializer(InitListExpr *IList, DesignatedInitExpr *DIE, 
+  bool CheckDesignatedInitializer(InitListExpr *IList, DesignatedInitExpr *DIE,
                                   unsigned DesigIdx,
-                                  QualType &CurrentObjectType, 
+                                  QualType &CurrentObjectType,
                                   RecordDecl::field_iterator *NextField,
                                   llvm::APSInt *NextElementIndex,
                                   unsigned &Index,
@@ -344,15 +344,15 @@
 /// with expressions that perform value-initialization of the
 /// appropriate type.
 void InitListChecker::FillInValueInitializations(InitListExpr *ILE) {
-  assert((ILE->getType() != SemaRef.Context.VoidTy) && 
+  assert((ILE->getType() != SemaRef.Context.VoidTy) &&
          "Should not have void type");
   SourceLocation Loc = ILE->getSourceRange().getBegin();
   if (ILE->getSyntacticForm())
     Loc = ILE->getSyntacticForm()->getSourceRange().getBegin();
-  
+
   if (const RecordType *RType = ILE->getType()->getAs<RecordType>()) {
     unsigned Init = 0, NumInits = ILE->getNumInits();
-    for (RecordDecl::field_iterator 
+    for (RecordDecl::field_iterator
            Field = RType->getDecl()->field_begin(),
            FieldEnd = RType->getDecl()->field_end();
          Field != FieldEnd; ++Field) {
@@ -364,11 +364,11 @@
           // C++ [dcl.init.aggr]p9:
           //   If an incomplete or empty initializer-list leaves a
           //   member of reference type uninitialized, the program is
-          //   ill-formed. 
+          //   ill-formed.
           SemaRef.Diag(Loc, diag::err_init_reference_member_uninitialized)
             << Field->getType()
             << ILE->getSyntacticForm()->getSourceRange();
-          SemaRef.Diag(Field->getLocation(), 
+          SemaRef.Diag(Field->getLocation(),
                         diag::note_uninit_reference_member);
           hadError = true;
           return;
@@ -381,9 +381,9 @@
         // we make that call explicit in the representation (even when it means
         // extending the initializer list)?
         if (Init < NumInits && !hadError)
-          ILE->setInit(Init, 
+          ILE->setInit(Init,
               new (SemaRef.Context) ImplicitValueInitExpr(Field->getType()));
-      } else if (InitListExpr *InnerILE 
+      } else if (InitListExpr *InnerILE
                  = dyn_cast<InitListExpr>(ILE->getInit(Init)))
         FillInValueInitializations(InnerILE);
       ++Init;
@@ -394,10 +394,10 @@
     }
 
     return;
-  } 
+  }
 
   QualType ElementType;
-  
+
   unsigned NumInits = ILE->getNumInits();
   unsigned NumElements = NumInits;
   if (const ArrayType *AType = SemaRef.Context.getAsArrayType(ILE->getType())) {
@@ -407,9 +407,9 @@
   } else if (const VectorType *VType = ILE->getType()->getAsVectorType()) {
     ElementType = VType->getElementType();
     NumElements = VType->getNumElements();
-  } else 
+  } else
     ElementType = ILE->getType();
-  
+
   for (unsigned Init = 0; Init != NumElements; ++Init) {
     if (Init >= NumInits || !ILE->getInit(Init)) {
       if (SemaRef.CheckValueInitialization(ElementType, Loc)) {
@@ -421,7 +421,7 @@
       // we make that call explicit in the representation (even when it means
       // extending the initializer list)?
       if (Init < NumInits && !hadError)
-        ILE->setInit(Init, 
+        ILE->setInit(Init,
                      new (SemaRef.Context) ImplicitValueInitExpr(ElementType));
     } else if (InitListExpr *InnerILE
                = dyn_cast<InitListExpr>(ILE->getInit(Init)))
@@ -436,7 +436,7 @@
 
   unsigned newIndex = 0;
   unsigned newStructuredIndex = 0;
-  FullyStructuredList 
+  FullyStructuredList
     = getStructuredSubobjectInit(IL, newIndex, T, 0, 0, IL->getSourceRange());
   CheckExplicitInitList(IL, T, newIndex, FullyStructuredList, newStructuredIndex,
                         /*TopLevelObject=*/true);
@@ -458,7 +458,7 @@
 int InitListChecker::numStructUnionElements(QualType DeclType) {
   RecordDecl *structDecl = DeclType->getAs<RecordType>()->getDecl();
   int InitializableMembers = 0;
-  for (RecordDecl::field_iterator 
+  for (RecordDecl::field_iterator
          Field = structDecl->field_begin(),
          FieldEnd = structDecl->field_end();
        Field != FieldEnd; ++Field) {
@@ -470,13 +470,13 @@
   return InitializableMembers - structDecl->hasFlexibleArrayMember();
 }
 
-void InitListChecker::CheckImplicitInitList(InitListExpr *ParentIList, 
+void InitListChecker::CheckImplicitInitList(InitListExpr *ParentIList,
                                             QualType T, unsigned &Index,
                                             InitListExpr *StructuredList,
                                             unsigned &StructuredIndex,
                                             bool TopLevelObject) {
   int maxElements = 0;
-  
+
   if (T->isArrayType())
     maxElements = numArrayElements(T);
   else if (T->isStructureType() || T->isUnionType())
@@ -496,8 +496,8 @@
 
   // Build a structured initializer list corresponding to this subobject.
   InitListExpr *StructuredSubobjectInitList
-    = getStructuredSubobjectInit(ParentIList, Index, T, StructuredList, 
-                                 StructuredIndex, 
+    = getStructuredSubobjectInit(ParentIList, Index, T, StructuredList,
+                                 StructuredIndex,
           SourceRange(ParentIList->getInit(Index)->getSourceRange().getBegin(),
                       ParentIList->getSourceRange().getEnd()));
   unsigned StructuredSubobjectInitIndex = 0;
@@ -505,7 +505,7 @@
   // Check the element types and build the structural subobject.
   unsigned StartIndex = Index;
   CheckListElementTypes(ParentIList, T, false, Index,
-                        StructuredSubobjectInitList, 
+                        StructuredSubobjectInitList,
                         StructuredSubobjectInitIndex,
                         TopLevelObject);
   unsigned EndIndex = (Index == StartIndex? StartIndex : Index - 1);
@@ -514,7 +514,7 @@
   // Update the structured sub-object initializer so that it's ending
   // range corresponds with the end of the last initializer it used.
   if (EndIndex < ParentIList->getNumInits()) {
-    SourceLocation EndLoc 
+    SourceLocation EndLoc
       = ParentIList->getInit(EndIndex)->getSourceRange().getEnd();
     StructuredSubobjectInitList->setRBraceLoc(EndLoc);
   }
@@ -528,7 +528,7 @@
   assert(IList->isExplicit() && "Illegal Implicit InitListExpr");
   SyntacticToSemantic[IList] = StructuredList;
   StructuredList->setSyntacticForm(IList);
-  CheckListElementTypes(IList, T, true, Index, StructuredList, 
+  CheckListElementTypes(IList, T, true, Index, StructuredList,
                         StructuredIndex, TopLevelObject);
   IList->setType(T);
   StructuredList->setType(T);
@@ -551,7 +551,7 @@
       // Don't complain for incomplete types, since we'll get an error
       // elsewhere
       QualType CurrentObjectType = StructuredList->getType();
-      int initKind = 
+      int initKind =
         CurrentObjectType->isArrayType()? 0 :
         CurrentObjectType->isVectorType()? 1 :
         CurrentObjectType->isScalarType()? 2 :
@@ -581,7 +581,7 @@
 }
 
 void InitListChecker::CheckListElementTypes(InitListExpr *IList,
-                                            QualType &DeclType, 
+                                            QualType &DeclType,
                                             bool SubobjectIsDesignatorContext,
                                             unsigned &Index,
                                             InitListExpr *StructuredList,
@@ -594,7 +594,7 @@
   } else if (DeclType->isAggregateType()) {
     if (DeclType->isRecordType()) {
       RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
-      CheckStructUnionTypes(IList, DeclType, RD->field_begin(), 
+      CheckStructUnionTypes(IList, DeclType, RD->field_begin(),
                             SubobjectIsDesignatorContext, Index,
                             StructuredList, StructuredIndex,
                             TopLevelObject);
@@ -628,13 +628,13 @@
     CheckReferenceType(IList, DeclType, Index, StructuredList, StructuredIndex);
   } else {
     // In C, all types are either scalars or aggregates, but
-    // additional handling is needed here for C++ (and possibly others?). 
+    // additional handling is needed here for C++ (and possibly others?).
     assert(0 && "Unsupported initializer type");
   }
 }
 
 void InitListChecker::CheckSubElementType(InitListExpr *IList,
-                                          QualType ElemType, 
+                                          QualType ElemType,
                                           unsigned &Index,
                                           InitListExpr *StructuredList,
                                           unsigned &StructuredIndex) {
@@ -642,11 +642,11 @@
   if (InitListExpr *SubInitList = dyn_cast<InitListExpr>(expr)) {
     unsigned newIndex = 0;
     unsigned newStructuredIndex = 0;
-    InitListExpr *newStructuredList 
+    InitListExpr *newStructuredList
       = getStructuredSubobjectInit(IList, Index, ElemType,
                                    StructuredList, StructuredIndex,
                                    SubInitList->getSourceRange());
-    CheckExplicitInitList(SubInitList, ElemType, newIndex, 
+    CheckExplicitInitList(SubInitList, ElemType, newIndex,
                           newStructuredList, newStructuredIndex);
     ++StructuredIndex;
     ++Index;
@@ -665,14 +665,14 @@
       //   initializing the aggregate member with an ini- tializer from
       //   an initializer-list. If the initializer can initialize a
       //   member, the member is initialized. [...]
-      ImplicitConversionSequence ICS 
+      ImplicitConversionSequence ICS
         = SemaRef.TryCopyInitialization(expr, ElemType,
                                         /*SuppressUserConversions=*/false,
                                         /*ForceRValue=*/false,
                                         /*InOverloadResolution=*/false);
 
       if (ICS.ConversionKind != ImplicitConversionSequence::BadConversion) {
-        if (SemaRef.PerformImplicitConversion(expr, ElemType, ICS, 
+        if (SemaRef.PerformImplicitConversion(expr, ElemType, ICS,
                                                "initializing"))
           hadError = true;
         UpdateStructuredListElement(StructuredList, StructuredIndex, expr);
@@ -682,7 +682,7 @@
 
       // Fall through for subaggregate initialization
     } else {
-      // C99 6.7.8p13: 
+      // C99 6.7.8p13:
       //
       //   The initializer for a structure or union object that has
       //   automatic storage duration shall be either an initializer
@@ -701,13 +701,13 @@
     }
 
     // C++ [dcl.init.aggr]p12:
-    // 
+    //
     //   [...] Otherwise, if the member is itself a non-empty
     //   subaggregate, brace elision is assumed and the initializer is
     //   considered for the initialization of the first member of
     //   the subaggregate.
     if (ElemType->isAggregateType() || ElemType->isVectorType()) {
-      CheckImplicitInitList(IList, ElemType, Index, StructuredList, 
+      CheckImplicitInitList(IList, ElemType, Index, StructuredList,
                             StructuredIndex);
       ++StructuredIndex;
     } else {
@@ -736,7 +736,7 @@
       ++StructuredIndex;
       return;
     } else if (isa<DesignatedInitExpr>(expr)) {
-      SemaRef.Diag(expr->getSourceRange().getBegin(), 
+      SemaRef.Diag(expr->getSourceRange().getBegin(),
                     diag::err_designator_for_scalar_init)
         << DeclType << expr->getSourceRange();
       hadError = true;
@@ -780,13 +780,13 @@
       ++Index;
       ++StructuredIndex;
       return;
-    } 
+    }
 
     Expr *savExpr = expr; // Might be promoted by CheckSingleInitializer.
     if (SemaRef.CheckReferenceInit(expr, DeclType,
                                    /*SuppressUserConversions=*/false,
                                    /*AllowExplicit=*/false,
-                                   /*ForceRValue=*/false))                                   
+                                   /*ForceRValue=*/false))
       hadError = true;
     else if (savExpr != expr) {
       // The type was promoted, update initializer list.
@@ -802,7 +802,7 @@
     // general, it would be useful to pass location information down the stack,
     // so that we know the location (or decl) of the "current object" being
     // initialized.
-    SemaRef.Diag(IList->getLocStart(), 
+    SemaRef.Diag(IList->getLocStart(),
                   diag::err_init_reference_member_uninitialized)
       << DeclType
       << IList->getSourceRange();
@@ -813,7 +813,7 @@
   }
 }
 
-void InitListChecker::CheckVectorType(InitListExpr *IList, QualType DeclType, 
+void InitListChecker::CheckVectorType(InitListExpr *IList, QualType DeclType,
                                       unsigned &Index,
                                       InitListExpr *StructuredList,
                                       unsigned &StructuredIndex) {
@@ -822,7 +822,7 @@
     unsigned maxElements = VT->getNumElements();
     unsigned numEltsInit = 0;
     QualType elementType = VT->getElementType();
-    
+
     if (!SemaRef.getLangOptions().OpenCL) {
       for (unsigned i = 0; i < maxElements; ++i, ++numEltsInit) {
         // Don't attempt to go past the end of the init list
@@ -853,7 +853,7 @@
         }
       }
     }
-    
+
     // OpenCL & AltiVec require all elements to be initialized.
     if (numEltsInit != maxElements)
       if (SemaRef.getLangOptions().OpenCL || SemaRef.getLangOptions().AltiVec)
@@ -863,9 +863,9 @@
   }
 }
 
-void InitListChecker::CheckArrayType(InitListExpr *IList, QualType &DeclType, 
+void InitListChecker::CheckArrayType(InitListExpr *IList, QualType &DeclType,
                                      llvm::APSInt elementIndex,
-                                     bool SubobjectIsDesignatorContext, 
+                                     bool SubobjectIsDesignatorContext,
                                      unsigned &Index,
                                      InitListExpr *StructuredList,
                                      unsigned &StructuredIndex) {
@@ -924,7 +924,7 @@
 
       // Handle this designated initializer. elementIndex will be
       // updated to be the next array element we'll initialize.
-      if (CheckDesignatedInitializer(IList, DIE, 0, 
+      if (CheckDesignatedInitializer(IList, DIE, 0,
                                      DeclType, 0, &elementIndex, Index,
                                      StructuredList, StructuredIndex, true,
                                      false)) {
@@ -972,27 +972,27 @@
                     diag::ext_typecheck_zero_array_size);
     }
 
-    DeclType = SemaRef.Context.getConstantArrayType(elementType, maxElements, 
+    DeclType = SemaRef.Context.getConstantArrayType(elementType, maxElements,
                                                      ArrayType::Normal, 0);
   }
 }
 
-void InitListChecker::CheckStructUnionTypes(InitListExpr *IList, 
-                                            QualType DeclType, 
+void InitListChecker::CheckStructUnionTypes(InitListExpr *IList,
+                                            QualType DeclType,
                                             RecordDecl::field_iterator Field,
-                                            bool SubobjectIsDesignatorContext, 
+                                            bool SubobjectIsDesignatorContext,
                                             unsigned &Index,
                                             InitListExpr *StructuredList,
                                             unsigned &StructuredIndex,
                                             bool TopLevelObject) {
   RecordDecl* structDecl = DeclType->getAs<RecordType>()->getDecl();
-    
+
   // If the record is invalid, some of it's members are invalid. To avoid
   // confusion, we forgo checking the intializer for the entire record.
   if (structDecl->isInvalidDecl()) {
     hadError = true;
     return;
-  }    
+  }
 
   if (DeclType->isUnionType() && IList->getNumInits() == 0) {
     // Value-initialize the first named member of the union.
@@ -1026,7 +1026,7 @@
 
       // Handle this designated initializer. Field will be updated to
       // the next field that we'll be initializing.
-      if (CheckDesignatedInitializer(IList, DIE, 0, 
+      if (CheckDesignatedInitializer(IList, DIE, 0,
                                      DeclType, &Field, 0, Index,
                                      StructuredList, StructuredIndex,
                                      true, TopLevelObject))
@@ -1067,15 +1067,15 @@
     ++Field;
   }
 
-  if (Field == FieldEnd || !Field->getType()->isIncompleteArrayType() || 
+  if (Field == FieldEnd || !Field->getType()->isIncompleteArrayType() ||
       Index >= IList->getNumInits())
     return;
 
   // Handle GNU flexible array initializers.
-  if (!TopLevelObject && 
+  if (!TopLevelObject &&
       (!isa<InitListExpr>(IList->getInit(Index)) ||
        cast<InitListExpr>(IList->getInit(Index))->getNumInits() > 0)) {
-    SemaRef.Diag(IList->getInit(Index)->getSourceRange().getBegin(), 
+    SemaRef.Diag(IList->getInit(Index)->getSourceRange().getBegin(),
                   diag::err_flexible_array_init_nonempty)
       << IList->getInit(Index)->getSourceRange().getBegin();
     SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
@@ -1084,7 +1084,7 @@
     ++Index;
     return;
   } else {
-    SemaRef.Diag(IList->getInit(Index)->getSourceRange().getBegin(), 
+    SemaRef.Diag(IList->getInit(Index)->getSourceRange().getBegin(),
                  diag::ext_flexible_array_init)
       << IList->getInit(Index)->getSourceRange().getBegin();
     SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
@@ -1106,8 +1106,8 @@
 /// Field/FieldIndex will be updated to point to the (new)
 /// currently-designated field.
 static void ExpandAnonymousFieldDesignator(Sema &SemaRef,
-                                           DesignatedInitExpr *DIE, 
-                                           unsigned DesigIdx, 
+                                           DesignatedInitExpr *DIE,
+                                           unsigned DesigIdx,
                                            FieldDecl *Field,
                                         RecordDecl::field_iterator &FieldIter,
                                            unsigned &FieldIndex) {
@@ -1117,14 +1117,14 @@
   // anonymous struct/union (backwards).
   llvm::SmallVector<FieldDecl *, 4> Path;
   SemaRef.BuildAnonymousStructUnionMemberPath(Field, Path);
-  
+
   // Build the replacement designators.
   llvm::SmallVector<Designator, 4> Replacements;
   for (llvm::SmallVector<FieldDecl *, 4>::reverse_iterator
          FI = Path.rbegin(), FIEnd = Path.rend();
        FI != FIEnd; ++FI) {
     if (FI + 1 == FIEnd)
-      Replacements.push_back(Designator((IdentifierInfo *)0, 
+      Replacements.push_back(Designator((IdentifierInfo *)0,
                                     DIE->getDesignator(DesigIdx)->getDotLoc(),
                                 DIE->getDesignator(DesigIdx)->getFieldLoc()));
     else
@@ -1136,9 +1136,9 @@
   // Expand the current designator into the set of replacement
   // designators, so we have a full subobject path down to where the
   // member of the anonymous struct/union is actually stored.
-  DIE->ExpandDesignator(DesigIdx, &Replacements[0], 
+  DIE->ExpandDesignator(DesigIdx, &Replacements[0],
                         &Replacements[0] + Replacements.size());
-  
+
   // Update FieldIter/FieldIndex;
   RecordDecl *Record = cast<RecordDecl>(Path.back()->getDeclContext());
   FieldIter = Record->field_begin();
@@ -1163,7 +1163,7 @@
 /// resides at the given @p Index within the initializer list @p
 /// IList, is well-formed for a current object of type @p DeclType
 /// (C99 6.7.8). The actual subobject that this designator refers to
-/// within the current subobject is returned in either 
+/// within the current subobject is returned in either
 /// @p NextField or @p NextElementIndex (whichever is appropriate).
 ///
 /// @param IList  The initializer list in which this designated
@@ -1192,9 +1192,9 @@
 /// actually be initialized.
 ///
 /// @returns true if there was an error, false otherwise.
-bool 
+bool
 InitListChecker::CheckDesignatedInitializer(InitListExpr *IList,
-                                      DesignatedInitExpr *DIE, 
+                                      DesignatedInitExpr *DIE,
                                       unsigned DesigIdx,
                                       QualType &CurrentObjectType,
                                       RecordDecl::field_iterator *NextField,
@@ -1227,14 +1227,14 @@
   }
 
   bool IsFirstDesignator = (DesigIdx == 0);
-  assert((IsFirstDesignator || StructuredList) && 
+  assert((IsFirstDesignator || StructuredList) &&
          "Need a non-designated initializer list to start from");
 
   DesignatedInitExpr::Designator *D = DIE->getDesignator(DesigIdx);
   // Determine the structural initializer list that corresponds to the
   // current subobject.
   StructuredList = IsFirstDesignator? SyntacticToSemantic[IList]
-    : getStructuredSubobjectInit(IList, Index, CurrentObjectType, 
+    : getStructuredSubobjectInit(IList, Index, CurrentObjectType,
                                  StructuredList, StructuredIndex,
                                  SourceRange(D->getStartLocation(),
                                              DIE->getSourceRange().getEnd()));
@@ -1249,7 +1249,7 @@
     //
     //   then the current object (defined below) shall have
     //   structure or union type and the identifier shall be the
-    //   name of a member of that type. 
+    //   name of a member of that type.
     const RecordType *RT = CurrentObjectType->getAs<RecordType>();
     if (!RT) {
       SourceLocation Loc = D->getDotLoc();
@@ -1267,7 +1267,7 @@
     FieldDecl *KnownField = D->getField();
     IdentifierInfo *FieldName = D->getFieldName();
     unsigned FieldIndex = 0;
-    RecordDecl::field_iterator 
+    RecordDecl::field_iterator
       Field = RT->getDecl()->field_begin(),
       FieldEnd = RT->getDecl()->field_end();
     for (; Field != FieldEnd; ++Field) {
@@ -1285,7 +1285,7 @@
       // name. Perform another lookup for this name, which may find
       // something that we can't designate (e.g., a member function),
       // may find nothing, or may find a member of an anonymous
-      // struct/union. 
+      // struct/union.
       DeclContext::lookup_result Lookup = RT->getDecl()->lookup(FieldName);
       if (Lookup.first == Lookup.second) {
         // Name lookup didn't find anything.
@@ -1298,7 +1298,7 @@
                    ->isAnonymousStructOrUnion()) {
         // Handle an field designator that refers to a member of an
         // anonymous struct or union.
-        ExpandAnonymousFieldDesignator(SemaRef, DIE, DesigIdx, 
+        ExpandAnonymousFieldDesignator(SemaRef, DIE, DesigIdx,
                                        cast<FieldDecl>(*Lookup.first),
                                        Field, FieldIndex);
         D = DIE->getDesignator(DesigIdx);
@@ -1306,7 +1306,7 @@
         // Name lookup found something, but it wasn't a field.
         SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_nonfield)
           << FieldName;
-        SemaRef.Diag((*Lookup.first)->getLocation(), 
+        SemaRef.Diag((*Lookup.first)->getLocation(),
                       diag::note_field_designator_found);
         ++Index;
         return true;
@@ -1328,7 +1328,7 @@
 
     // Update the designator with the field declaration.
     D->setField(*Field);
-      
+
     // Make sure that our non-designated initializer list has space
     // for a subobject corresponding to this field.
     if (FieldIndex >= StructuredList->getNumInits())
@@ -1340,11 +1340,11 @@
       if ((DesigIdx + 1) != DIE->size()) {
         // We can't designate an object within the flexible array
         // member (because GCC doesn't allow it).
-        DesignatedInitExpr::Designator *NextD 
+        DesignatedInitExpr::Designator *NextD
           = DIE->getDesignator(DesigIdx + 1);
-        SemaRef.Diag(NextD->getStartLocation(), 
+        SemaRef.Diag(NextD->getStartLocation(),
                       diag::err_designator_into_flexible_array_member)
-          << SourceRange(NextD->getStartLocation(), 
+          << SourceRange(NextD->getStartLocation(),
                          DIE->getSourceRange().getEnd());
         SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
           << *Field;
@@ -1362,9 +1362,9 @@
       }
 
       // Handle GNU flexible array initializers.
-      if (!Invalid && !TopLevelObject && 
+      if (!Invalid && !TopLevelObject &&
           cast<InitListExpr>(DIE->getInit())->getNumInits() > 0) {
-        SemaRef.Diag(DIE->getSourceRange().getBegin(), 
+        SemaRef.Diag(DIE->getSourceRange().getBegin(),
                       diag::err_flexible_array_init_nonempty)
           << DIE->getSourceRange().getBegin();
         SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
@@ -1382,7 +1382,7 @@
       unsigned newStructuredIndex = FieldIndex;
       unsigned OldIndex = Index;
       IList->setInit(Index, DIE->getInit());
-      CheckSubElementType(IList, Field->getType(), Index, 
+      CheckSubElementType(IList, Field->getType(), Index,
                           StructuredList, newStructuredIndex);
       IList->setInit(OldIndex, DIE);
       if (hadError && !prevHadError) {
@@ -1463,10 +1463,10 @@
   } else {
     assert(D->isArrayRangeDesignator() && "Need array-range designator");
 
-    
-    DesignatedStartIndex = 
+
+    DesignatedStartIndex =
       DIE->getArrayRangeStart(*D)->EvaluateAsInt(SemaRef.Context);
-    DesignatedEndIndex = 
+    DesignatedEndIndex =
       DIE->getArrayRangeEnd(*D)->EvaluateAsInt(SemaRef.Context);
     IndexExpr = DIE->getArrayRangeEnd(*D);
 
@@ -1498,11 +1498,11 @@
     DesignatedStartIndex.setIsUnsigned(true);
     DesignatedEndIndex.setIsUnsigned(true);
   }
-  
+
   // Make sure that our non-designated initializer list has space
   // for a subobject corresponding to this array element.
   if (DesignatedEndIndex.getZExtValue() >= StructuredList->getNumInits())
-    StructuredList->resizeInits(SemaRef.Context, 
+    StructuredList->resizeInits(SemaRef.Context,
                                 DesignatedEndIndex.getZExtValue() + 1);
 
   // Repeatedly perform subobject initializations in the range
@@ -1534,7 +1534,7 @@
     StructuredIndex = ElementIndex;
     return false;
   }
-  
+
   if (!FinishSubobjectInit)
     return false;
 
@@ -1542,7 +1542,7 @@
   bool prevHadError = hadError;
   CheckArrayType(IList, CurrentObjectType, DesignatedStartIndex, false, Index,
                  StructuredList, ElementIndex);
-  return hadError && !prevHadError;  
+  return hadError && !prevHadError;
 }
 
 // Get the structured initializer list for a subobject of type
@@ -1558,7 +1558,7 @@
     ExistingInit = SyntacticToSemantic[IList];
   else if (StructuredIndex < StructuredList->getNumInits())
     ExistingInit = StructuredList->getInit(StructuredIndex);
-  
+
   if (InitListExpr *Result = dyn_cast_or_null<InitListExpr>(ExistingInit))
     return Result;
 
@@ -1567,24 +1567,24 @@
     // subobjects of the current object, but there was already an
     // initialization that completely initialized the current
     // subobject, e.g., by a compound literal:
-    // 
+    //
     // struct X { int a, b; };
     // struct X xs[] = { [0] = (struct X) { 1, 2 }, [0].b = 3 };
-    // 
+    //
     // Here, xs[0].a == 0 and xs[0].b == 3, since the second,
     // designated initializer re-initializes the whole
     // subobject [0], overwriting previous initializers.
-    SemaRef.Diag(InitRange.getBegin(), 
+    SemaRef.Diag(InitRange.getBegin(),
                  diag::warn_subobject_initializer_overrides)
       << InitRange;
-    SemaRef.Diag(ExistingInit->getSourceRange().getBegin(), 
+    SemaRef.Diag(ExistingInit->getSourceRange().getBegin(),
                   diag::note_previous_initializer)
       << /*FIXME:has side effects=*/0
       << ExistingInit->getSourceRange();
   }
 
-  InitListExpr *Result 
-    = new (SemaRef.Context) InitListExpr(InitRange.getBegin(), 0, 0, 
+  InitListExpr *Result
+    = new (SemaRef.Context) InitListExpr(InitRange.getBegin(), 0, 0,
                                          InitRange.getEnd());
 
   Result->setType(CurrentObjectType);
@@ -1599,7 +1599,7 @@
       NumInits = SubList->getNumInits();
   }
 
-  if (const ArrayType *AType 
+  if (const ArrayType *AType
       = SemaRef.Context.getAsArrayType(CurrentObjectType)) {
     if (const ConstantArrayType *CAType = dyn_cast<ConstantArrayType>(AType)) {
       NumElements = CAType->getSize().getZExtValue();
@@ -1615,7 +1615,7 @@
     if (RDecl->isUnion())
       NumElements = 1;
     else
-      NumElements = std::distance(RDecl->field_begin(), 
+      NumElements = std::distance(RDecl->field_begin(),
                                   RDecl->field_end());
   }
 
@@ -1647,15 +1647,15 @@
 
   if (Expr *PrevInit = StructuredList->updateInit(StructuredIndex, expr)) {
     // This initializer overwrites a previous initializer. Warn.
-    SemaRef.Diag(expr->getSourceRange().getBegin(), 
+    SemaRef.Diag(expr->getSourceRange().getBegin(),
                   diag::warn_initializer_overrides)
       << expr->getSourceRange();
-    SemaRef.Diag(PrevInit->getSourceRange().getBegin(), 
+    SemaRef.Diag(PrevInit->getSourceRange().getBegin(),
                   diag::note_previous_initializer)
       << /*FIXME:has side effects=*/0
       << PrevInit->getSourceRange();
   }
-  
+
   ++StructuredIndex;
 }
 
@@ -1666,7 +1666,7 @@
 /// failure. Returns true if there was an error, false otherwise.  If
 /// everything went okay, Value will receive the value of the constant
 /// expression.
-static bool 
+static bool
 CheckArrayDesignatorExpr(Sema &S, Expr *Index, llvm::APSInt &Value) {
   SourceLocation Loc = Index->getSourceRange().getBegin();
 
@@ -1697,7 +1697,7 @@
     const Designator &D = Desig.getDesignator(Idx);
     switch (D.getKind()) {
     case Designator::FieldDesignator:
-      Designators.push_back(ASTDesignator(D.getField(), D.getDotLoc(), 
+      Designators.push_back(ASTDesignator(D.getField(), D.getDotLoc(),
                                           D.getFieldLoc()));
       break;
 
@@ -1710,7 +1710,7 @@
         Invalid = true;
       else {
         Designators.push_back(ASTDesignator(InitExpressions.size(),
-                                            D.getLBracketLoc(), 
+                                            D.getLBracketLoc(),
                                             D.getRBracketLoc()));
         InitExpressions.push_back(Index);
       }
@@ -1742,12 +1742,12 @@
 
         if (!StartDependent && !EndDependent && EndValue < StartValue) {
           Diag(D.getEllipsisLoc(), diag::err_array_designator_empty_range)
-            << StartValue.toString(10) << EndValue.toString(10) 
+            << StartValue.toString(10) << EndValue.toString(10)
             << StartIndex->getSourceRange() << EndIndex->getSourceRange();
           Invalid = true;
         } else {
           Designators.push_back(ASTDesignator(InitExpressions.size(),
-                                              D.getLBracketLoc(), 
+                                              D.getLBracketLoc(),
                                               D.getEllipsisLoc(),
                                               D.getRBracketLoc()));
           InitExpressions.push_back(StartIndex);
@@ -1792,7 +1792,7 @@
 /// accessible, non-deleted default constructor. In C, everything can
 /// be value-initialized, which corresponds to C's notion of
 /// initializing objects with static storage duration when no
-/// initializer is provided for that object. 
+/// initializer is provided for that object.
 ///
 /// \returns true if there was an error, false otherwise.
 bool Sema::CheckValueInitialization(QualType Type, SourceLocation Loc) {
@@ -1814,7 +1814,7 @@
         // FIXME: Eventually, we'll need to put the constructor decl into the
         // AST.
         return PerformInitializationByConstructor(Type, 0, 0, Loc,
-                                                  SourceRange(Loc), 
+                                                  SourceRange(Loc),
                                                   DeclarationName(),
                                                   IK_Direct);
     }

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Sep  9 10:08:12 2009
@@ -60,7 +60,7 @@
 /// AddNamespaceUsingDirectives - Adds all UsingDirectiveDecl's to heap UDirs
 /// (ordered by common ancestors), found in namespace NS,
 /// including all found (recursively) in their nominated namespaces.
-void AddNamespaceUsingDirectives(ASTContext &Context, 
+void AddNamespaceUsingDirectives(ASTContext &Context,
                                  DeclContext *NS,
                                  UsingDirectivesTy &UDirs,
                                  NamespaceSet &Visited) {
@@ -77,7 +77,7 @@
 
 /// AddScopeUsingDirectives - Adds all UsingDirectiveDecl's found in Scope S,
 /// including all found in the namespaces they nominate.
-static void AddScopeUsingDirectives(ASTContext &Context, Scope *S, 
+static void AddScopeUsingDirectives(ASTContext &Context, Scope *S,
                                     UsingDirectivesTy &UDirs) {
   NamespaceSet VisitedNS;
 
@@ -100,7 +100,7 @@
       NamespaceDecl *Nominated = UD->getNominatedNamespace();
       if (!VisitedNS.count(Nominated)) {
         VisitedNS.insert(Nominated);
-        AddNamespaceUsingDirectives(Context, Nominated, UDirs, 
+        AddNamespaceUsingDirectives(Context, Nominated, UDirs,
                                     /*ref*/ VisitedNS);
       }
     }
@@ -112,7 +112,7 @@
 /// *I is a match for the namespace. This routine returns an
 /// appropriate Decl for name lookup, which may either be *I or an
 /// OverloadedFunctionDecl that represents the overloaded functions in
-/// [I, IEnd). 
+/// [I, IEnd).
 ///
 /// The existance of this routine is temporary; users of LookupResult
 /// should be able to handle multiple results, to deal with cases of
@@ -120,10 +120,10 @@
 /// Decl node.
 template<typename DeclIterator>
 static NamedDecl *
-MaybeConstructOverloadSet(ASTContext &Context, 
+MaybeConstructOverloadSet(ASTContext &Context,
                           DeclIterator I, DeclIterator IEnd) {
   assert(I != IEnd && "Iterator range cannot be empty");
-  assert(!isa<OverloadedFunctionDecl>(*I) && 
+  assert(!isa<OverloadedFunctionDecl>(*I) &&
          "Cannot have an overloaded function");
 
   if ((*I)->isFunctionOrFunctionTemplate()) {
@@ -131,8 +131,8 @@
     // so, collect them into an overload set.
     DeclIterator Last = I;
     OverloadedFunctionDecl *Ovl = 0;
-    for (++Last; 
-         Last != IEnd && (*Last)->isFunctionOrFunctionTemplate(); 
+    for (++Last;
+         Last != IEnd && (*Last)->isFunctionOrFunctionTemplate();
          ++Last) {
       if (!Ovl) {
         // FIXME: We leak this overload set. Eventually, we want to stop
@@ -153,13 +153,13 @@
       else
         Ovl->addOverload(cast<FunctionTemplateDecl>(ND));
     }
-    
+
     // If we had more than one function, we built an overload
     // set. Return it.
     if (Ovl)
       return Ovl;
   }
-  
+
   return *I;
 }
 
@@ -215,7 +215,7 @@
 
     case LResult::Found: {
       NamedDecl *ND = I->getAsDecl()->getUnderlyingDecl();
-        
+
       if (TagDecl *TD = dyn_cast<TagDecl>(ND)) {
         TagFound = TD->getCanonicalDecl();
         TagNames += FoundDecls.insert(TagFound)?  1 : 0;
@@ -234,7 +234,7 @@
   }
   OrdinaryNonFunc = FoundDecls.size() - TagNames - Functions;
   bool Ambiguous = false, NameHidesTags = false;
-  
+
   if (FoundDecls.size() == 1) {
     // 1) Exactly one result.
   } else if (TagNames > 1) {
@@ -264,7 +264,7 @@
   }
 
   if (Ambiguous)
-    return LResult::CreateLookupResult(Context, 
+    return LResult::CreateLookupResult(Context,
                                        FoundDecls.begin(), FoundDecls.size());
   if (NameHidesTags) {
     // There's only one tag, TagFound. Remove it.
@@ -281,8 +281,8 @@
 
 // Retrieve the set of identifier namespaces that correspond to a
 // specific kind of name lookup.
-inline unsigned 
-getIdentifierNamespacesFromLookupNameKind(Sema::LookupNameKind NameKind, 
+inline unsigned
+getIdentifierNamespacesFromLookupNameKind(Sema::LookupNameKind NameKind,
                                           bool CPlusPlus) {
   unsigned IDNS = 0;
   switch (NameKind) {
@@ -301,7 +301,7 @@
   case Sema::LookupMemberName:
     IDNS = Decl::IDNS_Member;
     if (CPlusPlus)
-      IDNS |= Decl::IDNS_Tag | Decl::IDNS_Ordinary;    
+      IDNS |= Decl::IDNS_Tag | Decl::IDNS_Ordinary;
     break;
 
   case Sema::LookupNestedNameSpecifierName:
@@ -328,7 +328,7 @@
 Sema::LookupResult::CreateLookupResult(ASTContext &Context, NamedDecl *D) {
   if (D)
     D = D->getUnderlyingDecl();
-  
+
   LookupResult Result;
   Result.StoredKind = (D && isa<OverloadedFunctionDecl>(D))?
     OverloadedDeclSingleDecl : SingleDecl;
@@ -340,8 +340,8 @@
 
 /// @brief Moves the name-lookup results from Other to this LookupResult.
 Sema::LookupResult
-Sema::LookupResult::CreateLookupResult(ASTContext &Context, 
-                                       IdentifierResolver::iterator F, 
+Sema::LookupResult::CreateLookupResult(ASTContext &Context,
+                                       IdentifierResolver::iterator F,
                                        IdentifierResolver::iterator L) {
   LookupResult Result;
   Result.Context = &Context;
@@ -355,7 +355,7 @@
       Result.Last = L.getAsOpaqueValue();
       return Result;
     }
-  } 
+  }
 
   NamedDecl *D = *F;
   if (D)
@@ -368,8 +368,8 @@
 }
 
 Sema::LookupResult
-Sema::LookupResult::CreateLookupResult(ASTContext &Context, 
-                                       DeclContext::lookup_iterator F, 
+Sema::LookupResult::CreateLookupResult(ASTContext &Context,
+                                       DeclContext::lookup_iterator F,
                                        DeclContext::lookup_iterator L) {
   LookupResult Result;
   Result.Context = &Context;
@@ -388,7 +388,7 @@
   NamedDecl *D = *F;
   if (D)
     D = D->getUnderlyingDecl();
-  
+
   Result.StoredKind = SingleDecl;
   Result.First = reinterpret_cast<uintptr_t>(D);
   Result.Last = 0;
@@ -424,7 +424,7 @@
 /// (if only a single declaration was found), an
 /// OverloadedFunctionDecl (if an overloaded function was found), or
 /// NULL (if no declaration was found). This conversion must not be
-/// used anywhere where name lookup could result in an ambiguity. 
+/// used anywhere where name lookup could result in an ambiguity.
 ///
 /// The OverloadedFunctionDecl conversion is meant as a stop-gap
 /// solution, since it causes the OverloadedFunctionDecl to be
@@ -441,7 +441,7 @@
                          IdentifierResolver::iterator::getFromOpaqueValue(Last));
 
   case OverloadedDeclFromDeclContext:
-    return MaybeConstructOverloadSet(*Context, 
+    return MaybeConstructOverloadSet(*Context,
                            reinterpret_cast<DeclContext::lookup_iterator>(First),
                            reinterpret_cast<DeclContext::lookup_iterator>(Last));
 
@@ -450,7 +450,7 @@
 
   case AmbiguousLookupStoresDecls:
   case AmbiguousLookupStoresBasePaths:
-    assert(false && 
+    assert(false &&
            "Name lookup returned an ambiguity that could not be handled");
     break;
   }
@@ -466,7 +466,7 @@
   return 0;
 }
 
-Sema::LookupResult::iterator::reference 
+Sema::LookupResult::iterator::reference
 Sema::LookupResult::iterator::operator*() const {
   switch (Result->StoredKind) {
   case SingleDecl:
@@ -507,14 +507,14 @@
   }
 
   case OverloadedDeclFromIdResolver: {
-    IdentifierResolver::iterator I 
+    IdentifierResolver::iterator I
       = IdentifierResolver::iterator::getFromOpaqueValue(Current);
     ++I;
     Current = I.getAsOpaqueValue();
     break;
   }
 
-  case AmbiguousLookupStoresBasePaths: 
+  case AmbiguousLookupStoresBasePaths:
     if (Result->Last) {
       NamedDecl ** I = reinterpret_cast<NamedDecl**>(Current);
       ++I;
@@ -526,7 +526,7 @@
 
   case OverloadedDeclFromDeclContext:
   case AmbiguousLookupStoresDecls: {
-    DeclContext::lookup_iterator I 
+    DeclContext::lookup_iterator I
       = reinterpret_cast<DeclContext::lookup_iterator>(Current);
     ++I;
     Current = reinterpret_cast<uintptr_t>(I);
@@ -548,13 +548,13 @@
   case OverloadedDeclSingleDecl: {
     OverloadedFunctionDecl * Ovl =
       reinterpret_cast<OverloadedFunctionDecl*>(First);
-    return iterator(this, 
+    return iterator(this,
                     reinterpret_cast<uintptr_t>(&(*Ovl->function_begin())));
   }
 
   case AmbiguousLookupStoresBasePaths:
     if (Last)
-      return iterator(this, 
+      return iterator(this,
               reinterpret_cast<uintptr_t>(getBasePaths()->found_decls_begin()));
     else
       return iterator(this,
@@ -576,13 +576,13 @@
   case OverloadedDeclSingleDecl: {
     OverloadedFunctionDecl * Ovl =
       reinterpret_cast<OverloadedFunctionDecl*>(First);
-    return iterator(this, 
+    return iterator(this,
                     reinterpret_cast<uintptr_t>(&(*Ovl->function_end())));
   }
 
   case AmbiguousLookupStoresBasePaths:
     if (Last)
-      return iterator(this, 
+      return iterator(this,
                reinterpret_cast<uintptr_t>(getBasePaths()->found_decls_end()));
     else
       return iterator(this, reinterpret_cast<uintptr_t>(
@@ -623,7 +623,7 @@
     llvm::tie(UI, UEnd) =
       std::equal_range(UDirs->begin(), UDirs->end(), NS,
                        UsingDirAncestorCompare());
- 
+
     for (; UI != UEnd; ++UI)
       CppNamespaceLookup(Context, (*UI)->getNominatedNamespace(),
                          Name, NameKind, IDNS, Results);
@@ -641,7 +641,7 @@
                     LookupNameKind NameKind, bool RedeclarationOnly) {
   assert(getLangOptions().CPlusPlus &&
          "Can perform only C++ lookup");
-  unsigned IDNS 
+  unsigned IDNS
     = getIdentifierNamespacesFromLookupNameKind(NameKind, /*CPlusPlus*/ true);
 
   // If we're testing for redeclarations, also look in the friend namespaces.
@@ -652,7 +652,7 @@
 
   Scope *Initial = S;
   DeclContext *OutOfLineCtx = 0;
-  IdentifierResolver::iterator 
+  IdentifierResolver::iterator
     I = IdResolver.begin(Name),
     IEnd = IdResolver.end();
 
@@ -662,7 +662,7 @@
   // they were declared in the nearest enclosing namespace which contains
   // both the using-directive and the nominated namespace.
   // [Note: in this context, "contains" means "contains directly or
-  // indirectly". 
+  // indirectly".
   //
   // For example:
   // namespace A { int i; }
@@ -705,7 +705,7 @@
         if (R)
           return std::make_pair(true, R);
       }
-      if (Ctx->getParent() != Ctx->getLexicalParent() 
+      if (Ctx->getParent() != Ctx->getLexicalParent()
           || isa<CXXMethodDecl>(Ctx)) {
         // It is out of line defined C++ method or struct, we continue
         // doing name lookup in parent context. Once we will find namespace
@@ -780,7 +780,7 @@
           if (!S->isDeclScope(DeclPtrTy::make(*LastI)))
             break;
         }
-        
+
         // We store name lookup result, and continue trying to look into
         // associated context, and maybe namespaces nominated by
         // using-directives.
@@ -834,13 +834,13 @@
 /// @param Name     The name of the entity that we are searching for.
 ///
 /// @param Loc      If provided, the source location where we're performing
-/// name lookup. At present, this is only used to produce diagnostics when 
+/// name lookup. At present, this is only used to produce diagnostics when
 /// C library functions (like "malloc") are implicitly declared.
 ///
 /// @returns The result of name lookup, which includes zero or more
 /// declarations and possibly additional information used to diagnose
 /// ambiguities.
-Sema::LookupResult 
+Sema::LookupResult
 Sema::LookupName(Scope *S, DeclarationName Name, LookupNameKind NameKind,
                  bool RedeclarationOnly, bool AllowBuiltinCreation,
                  SourceLocation Loc) {
@@ -872,7 +872,7 @@
     case Sema::LookupRedeclarationWithLinkage:
       // Find the nearest non-transparent declaration scope.
       while (!(S->getFlags() & Scope::DeclScope) ||
-             (S->getEntity() && 
+             (S->getEntity() &&
               static_cast<DeclContext *>(S->getEntity())
                 ->isTransparentContext()))
         S = S->getParent();
@@ -886,7 +886,7 @@
     case Sema::LookupObjCImplementationName:
       IDNS = Decl::IDNS_ObjCImplementation;
       break;
-      
+
     case Sema::LookupObjCCategoryImplName:
       IDNS = Decl::IDNS_ObjCCategoryImpl;
       break;
@@ -899,7 +899,7 @@
     bool LeftStartingScope = false;
 
     for (IdentifierResolver::iterator I = IdResolver.begin(Name),
-                                   IEnd = IdResolver.end(); 
+                                   IEnd = IdResolver.end();
          I != IEnd; ++I)
       if ((*I)->isInIdentifierNamespace(IDNS)) {
         if (NameKind == LookupRedeclarationWithLinkage) {
@@ -948,7 +948,7 @@
   // If we didn't find a use of this identifier, and if the identifier
   // corresponds to a compiler builtin, create the decl object for the builtin
   // now, injecting it into translation unit scope, and return it.
-  if (NameKind == LookupOrdinaryName || 
+  if (NameKind == LookupOrdinaryName ||
       NameKind == LookupRedeclarationWithLinkage) {
     IdentifierInfo *II = Name.getAsIdentifierInfo();
     if (II && AllowBuiltinCreation) {
@@ -956,7 +956,7 @@
       if (unsigned BuiltinID = II->getBuiltinID()) {
         // In C++, we don't have any predefined library functions like
         // 'malloc'. Instead, we'll just error.
-        if (getLangOptions().CPlusPlus && 
+        if (getLangOptions().CPlusPlus &&
             Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
           return LookupResult::CreateLookupResult(Context, 0);
 
@@ -1003,18 +1003,18 @@
 Sema::LookupQualifiedName(DeclContext *LookupCtx, DeclarationName Name,
                           LookupNameKind NameKind, bool RedeclarationOnly) {
   assert(LookupCtx && "Sema::LookupQualifiedName requires a lookup context");
-  
-  if (!Name) 
+
+  if (!Name)
     return LookupResult::CreateLookupResult(Context, 0);
-  
+
   // If we're performing qualified name lookup (e.g., lookup into a
   // struct), find fields as part of ordinary name lookup.
   unsigned IDNS
-    = getIdentifierNamespacesFromLookupNameKind(NameKind, 
+    = getIdentifierNamespacesFromLookupNameKind(NameKind,
                                                 getLangOptions().CPlusPlus);
   if (NameKind == LookupOrdinaryName)
     IDNS |= Decl::IDNS_Member;
-  
+
   // Make sure that the declaration context is complete.
   assert((!isa<TagDecl>(LookupCtx) ||
           LookupCtx->isDependentContext() ||
@@ -1022,7 +1022,7 @@
           Context.getTypeDeclType(cast<TagDecl>(LookupCtx))->getAs<TagType>()
             ->isBeingDefined()) &&
          "Declaration context must already be complete!");
-    
+
   // Perform qualified name lookup into the LookupCtx.
   DeclContext::lookup_iterator I, E;
   for (llvm::tie(I, E) = LookupCtx->lookup(Name); I != E; ++I)
@@ -1031,7 +1031,7 @@
 
   // If this isn't a C++ class, we aren't allowed to look into base
   // classes, we're done, or the lookup context is dependent, we're done.
-  if (RedeclarationOnly || !isa<CXXRecordDecl>(LookupCtx) || 
+  if (RedeclarationOnly || !isa<CXXRecordDecl>(LookupCtx) ||
       LookupCtx->isDependentContext())
     return LookupResult::CreateLookupResult(Context, 0);
 
@@ -1040,7 +1040,7 @@
   Paths.setOrigin(Context.getTypeDeclType(cast<RecordDecl>(LookupCtx)));
 
   // Look for this member in our base classes
-  if (!LookupInBases(cast<CXXRecordDecl>(LookupCtx), 
+  if (!LookupInBases(cast<CXXRecordDecl>(LookupCtx),
                      MemberLookupCriteria(Name, NameKind, IDNS), Paths))
     return LookupResult::CreateLookupResult(Context, 0);
 
@@ -1062,7 +1062,7 @@
       // This is the first subobject we've looked at. Record it's type.
       SubobjectType = Context.getCanonicalType(PathElement.Base->getType());
       SubobjectNumber = PathElement.SubobjectNumber;
-    } else if (SubobjectType 
+    } else if (SubobjectType
                  != Context.getCanonicalType(PathElement.Base->getType())) {
       // We found members of the given name in two subobjects of
       // different types. This lookup is ambiguous.
@@ -1075,7 +1075,7 @@
       // C++ [class.member.lookup]p5:
       //   A static member, a nested type or an enumerator defined in
       //   a base class T can unambiguously be found even if an object
-      //   has more than one base class subobject of type T. 
+      //   has more than one base class subobject of type T.
       Decl *FirstDecl = *Path->Decls.first;
       if (isa<VarDecl>(FirstDecl) ||
           isa<TypeDecl>(FirstDecl) ||
@@ -1114,7 +1114,7 @@
 
   // If we found a function declaration, return an overload set.
   if ((*Paths.front().Decls.first)->isFunctionOrFunctionTemplate())
-    return LookupResult::CreateLookupResult(Context, 
+    return LookupResult::CreateLookupResult(Context,
                         Paths.front().Decls.first, Paths.front().Decls.second);
 
   // We found a non-function declaration; return a single declaration.
@@ -1132,14 +1132,14 @@
 ///
 /// @param S        The scope from which unqualified name lookup will
 /// begin.
-/// 
+///
 /// @param SS       An optional C++ scope-specifier, e.g., "::N::M".
 ///
 /// @param Name     The name of the entity that name lookup will
 /// search for.
 ///
 /// @param Loc      If provided, the source location where we're performing
-/// name lookup. At present, this is only used to produce diagnostics when 
+/// name lookup. At present, this is only used to produce diagnostics when
 /// C library functions (like "malloc") are implicitly declared.
 ///
 /// @param EnteringContext Indicates whether we are going to enter the
@@ -1147,7 +1147,7 @@
 ///
 /// @returns The result of qualified or unqualified name lookup.
 Sema::LookupResult
-Sema::LookupParsedName(Scope *S, const CXXScopeSpec *SS, 
+Sema::LookupParsedName(Scope *S, const CXXScopeSpec *SS,
                        DeclarationName Name, LookupNameKind NameKind,
                        bool RedeclarationOnly, bool AllowBuiltinCreation,
                        SourceLocation Loc,
@@ -1157,25 +1157,25 @@
     // anything.
     return LookupResult::CreateLookupResult(Context, 0);
   }
-  
+
   if (SS && SS->isSet()) {
     if (DeclContext *DC = computeDeclContext(*SS, EnteringContext)) {
-      // We have resolved the scope specifier to a particular declaration 
+      // We have resolved the scope specifier to a particular declaration
       // contex, and will perform name lookup in that context.
       if (!DC->isDependentContext() && RequireCompleteDeclContext(*SS))
         return LookupResult::CreateLookupResult(Context, 0);
-                                    
+
       return LookupQualifiedName(DC, Name, NameKind, RedeclarationOnly);
     }
 
     // We could not resolve the scope specified to a specific declaration
-    // context, which means that SS refers to an unknown specialization. 
+    // context, which means that SS refers to an unknown specialization.
     // Name lookup can't find anything in this case.
     return LookupResult::CreateLookupResult(Context, 0);
   }
 
-  // Perform unqualified name lookup starting in the given scope. 
-  return LookupName(S, Name, NameKind, RedeclarationOnly, AllowBuiltinCreation, 
+  // Perform unqualified name lookup starting in the given scope.
+  return LookupName(S, Name, NameKind, RedeclarationOnly, AllowBuiltinCreation,
                     Loc);
 }
 
@@ -1184,7 +1184,7 @@
 /// from name lookup.
 ///
 /// @param Result       The ambiguous name lookup result.
-/// 
+///
 /// @param Name         The name of the entity that name lookup was
 /// searching for.
 ///
@@ -1197,7 +1197,7 @@
 ///
 /// @returns true
 bool Sema::DiagnoseAmbiguousLookup(LookupResult &Result, DeclarationName Name,
-                                   SourceLocation NameLoc, 
+                                   SourceLocation NameLoc,
                                    SourceRange LookupRange) {
   assert(Result.isAmbiguous() && "Lookup result must be ambiguous");
 
@@ -1209,7 +1209,7 @@
         << LookupRange;
 
       DeclContext::lookup_iterator Found = Paths->front().Decls.first;
-      while (isa<CXXMethodDecl>(*Found) && 
+      while (isa<CXXMethodDecl>(*Found) &&
              cast<CXXMethodDecl>(*Found)->isStatic())
         ++Found;
 
@@ -1217,7 +1217,7 @@
 
       Result.Destroy();
       return true;
-    } 
+    }
 
     assert(Result.getKind() == LookupResult::AmbiguousBaseSubobjectTypes &&
            "Unhandled form of name lookup ambiguity");
@@ -1254,8 +1254,8 @@
   return true;
 }
 
-static void 
-addAssociatedClassesAndNamespaces(QualType T, 
+static void
+addAssociatedClassesAndNamespaces(QualType T,
                                   ASTContext &Context,
                           Sema::AssociatedNamespaceSet &AssociatedNamespaces,
                                   Sema::AssociatedClassSet &AssociatedClasses);
@@ -1266,19 +1266,19 @@
     Namespaces.insert(Ctx);
 }
 
-// \brief Add the associated classes and namespaces for argument-dependent 
+// \brief Add the associated classes and namespaces for argument-dependent
 // lookup that involves a template argument (C++ [basic.lookup.koenig]p2).
-static void 
-addAssociatedClassesAndNamespaces(const TemplateArgument &Arg, 
+static void
+addAssociatedClassesAndNamespaces(const TemplateArgument &Arg,
                                   ASTContext &Context,
                            Sema::AssociatedNamespaceSet &AssociatedNamespaces,
                                   Sema::AssociatedClassSet &AssociatedClasses) {
   // C++ [basic.lookup.koenig]p2, last bullet:
-  //   -- [...] ;  
+  //   -- [...] ;
   switch (Arg.getKind()) {
     case TemplateArgument::Null:
       break;
-    
+
     case TemplateArgument::Type:
       // [...] the namespaces and classes associated with the types of the
       // template arguments provided for template type parameters (excluding
@@ -1287,12 +1287,12 @@
                                         AssociatedNamespaces,
                                         AssociatedClasses);
       break;
-      
+
     case TemplateArgument::Declaration:
-      // [...] the namespaces in which any template template arguments are 
-      // defined; and the classes in which any member templates used as 
+      // [...] the namespaces in which any template template arguments are
+      // defined; and the classes in which any member templates used as
       // template template arguments are defined.
-      if (ClassTemplateDecl *ClassTemplate 
+      if (ClassTemplateDecl *ClassTemplate
             = dyn_cast<ClassTemplateDecl>(Arg.getAsDecl())) {
         DeclContext *Ctx = ClassTemplate->getDeclContext();
         if (CXXRecordDecl *EnclosingClass = dyn_cast<CXXRecordDecl>(Ctx))
@@ -1303,13 +1303,13 @@
         CollectNamespace(AssociatedNamespaces, Ctx);
       }
       break;
-      
+
     case TemplateArgument::Integral:
     case TemplateArgument::Expression:
-      // [Note: non-type template arguments do not contribute to the set of 
+      // [Note: non-type template arguments do not contribute to the set of
       //  associated namespaces. ]
       break;
-      
+
     case TemplateArgument::Pack:
       for (TemplateArgument::pack_iterator P = Arg.pack_begin(),
                                         PEnd = Arg.pack_end();
@@ -1322,10 +1322,10 @@
 }
 
 // \brief Add the associated classes and namespaces for
-// argument-dependent lookup with an argument of class type 
-// (C++ [basic.lookup.koenig]p2). 
-static void 
-addAssociatedClassesAndNamespaces(CXXRecordDecl *Class, 
+// argument-dependent lookup with an argument of class type
+// (C++ [basic.lookup.koenig]p2).
+static void
+addAssociatedClassesAndNamespaces(CXXRecordDecl *Class,
                                   ASTContext &Context,
                             Sema::AssociatedNamespaceSet &AssociatedNamespaces,
                             Sema::AssociatedClassSet &AssociatedClasses) {
@@ -1335,7 +1335,7 @@
   //        classes are: the class itself; the class of which it is a
   //        member, if any; and its direct and indirect base
   //        classes. Its associated namespaces are the namespaces in
-  //        which its associated classes are defined. 
+  //        which its associated classes are defined.
 
   // Add the class of which it is a member, if any.
   DeclContext *Ctx = Class->getDeclContext();
@@ -1345,22 +1345,22 @@
   while (Ctx->isRecord())
     Ctx = Ctx->getParent();
   CollectNamespace(AssociatedNamespaces, Ctx);
-  
+
   // Add the class itself. If we've already seen this class, we don't
   // need to visit base classes.
   if (!AssociatedClasses.insert(Class))
     return;
 
-  // -- If T is a template-id, its associated namespaces and classes are 
-  //    the namespace in which the template is defined; for member 
+  // -- If T is a template-id, its associated namespaces and classes are
+  //    the namespace in which the template is defined; for member
   //    templates, the member template’s class; the namespaces and classes
-  //    associated with the types of the template arguments provided for 
+  //    associated with the types of the template arguments provided for
   //    template type parameters (excluding template template parameters); the
-  //    namespaces in which any template template arguments are defined; and 
-  //    the classes in which any member templates used as template template 
-  //    arguments are defined. [Note: non-type template arguments do not 
+  //    namespaces in which any template template arguments are defined; and
+  //    the classes in which any member templates used as template template
+  //    arguments are defined. [Note: non-type template arguments do not
   //    contribute to the set of associated namespaces. ]
-  if (ClassTemplateSpecializationDecl *Spec 
+  if (ClassTemplateSpecializationDecl *Spec
         = dyn_cast<ClassTemplateSpecializationDecl>(Class)) {
     DeclContext *Ctx = Spec->getSpecializedTemplate()->getDeclContext();
     if (CXXRecordDecl *EnclosingClass = dyn_cast<CXXRecordDecl>(Ctx))
@@ -1369,14 +1369,14 @@
     while (Ctx->isRecord())
       Ctx = Ctx->getParent();
     CollectNamespace(AssociatedNamespaces, Ctx);
-    
+
     const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
     for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
       addAssociatedClassesAndNamespaces(TemplateArgs[I], Context,
                                         AssociatedNamespaces,
                                         AssociatedClasses);
   }
-  
+
   // Add direct and indirect base classes along with their associated
   // namespaces.
   llvm::SmallVector<CXXRecordDecl *, 32> Bases;
@@ -1409,9 +1409,9 @@
 
 // \brief Add the associated classes and namespaces for
 // argument-dependent lookup with an argument of type T
-// (C++ [basic.lookup.koenig]p2). 
-static void 
-addAssociatedClassesAndNamespaces(QualType T, 
+// (C++ [basic.lookup.koenig]p2).
+static void
+addAssociatedClassesAndNamespaces(QualType T,
                                   ASTContext &Context,
                             Sema::AssociatedNamespaceSet &AssociatedNamespaces,
                                   Sema::AssociatedClassSet &AssociatedClasses) {
@@ -1428,7 +1428,7 @@
   T = Context.getCanonicalType(T).getUnqualifiedType();
 
   //    -- If T is a pointer to U or an array of U, its associated
-  //       namespaces and classes are those associated with U. 
+  //       namespaces and classes are those associated with U.
   //
   // We handle this by unwrapping pointer and array types immediately,
   // to avoid unnecessary recursion.
@@ -1437,7 +1437,7 @@
       T = Ptr->getPointeeType();
     else if (const ArrayType *Ptr = Context.getAsArrayType(T))
       T = Ptr->getElementType();
-    else 
+    else
       break;
   }
 
@@ -1450,12 +1450,12 @@
   //        classes are: the class itself; the class of which it is a
   //        member, if any; and its direct and indirect base
   //        classes. Its associated namespaces are the namespaces in
-  //        which its associated classes are defined. 
+  //        which its associated classes are defined.
   if (const RecordType *ClassType = T->getAs<RecordType>())
-    if (CXXRecordDecl *ClassDecl 
+    if (CXXRecordDecl *ClassDecl
         = dyn_cast<CXXRecordDecl>(ClassType->getDecl())) {
-      addAssociatedClassesAndNamespaces(ClassDecl, Context, 
-                                        AssociatedNamespaces, 
+      addAssociatedClassesAndNamespaces(ClassDecl, Context,
+                                        AssociatedNamespaces,
                                         AssociatedClasses);
       return;
     }
@@ -1463,7 +1463,7 @@
   //     -- If T is an enumeration type, its associated namespace is
   //        the namespace in which it is defined. If it is class
   //        member, its associated class is the member’s class; else
-  //        it has no associated class. 
+  //        it has no associated class.
   if (const EnumType *EnumT = T->getAsEnumType()) {
     EnumDecl *Enum = EnumT->getDecl();
 
@@ -1484,7 +1484,7 @@
   //        types and those associated with the return type.
   if (const FunctionType *FunctionType = T->getAsFunctionType()) {
     // Return type
-    addAssociatedClassesAndNamespaces(FunctionType->getResultType(), 
+    addAssociatedClassesAndNamespaces(FunctionType->getResultType(),
                                       Context,
                                       AssociatedNamespaces, AssociatedClasses);
 
@@ -1494,23 +1494,23 @@
 
     // Argument types
     for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
-                                           ArgEnd = Proto->arg_type_end(); 
+                                           ArgEnd = Proto->arg_type_end();
          Arg != ArgEnd; ++Arg)
       addAssociatedClassesAndNamespaces(*Arg, Context,
                                         AssociatedNamespaces, AssociatedClasses);
-      
+
     return;
   }
 
   //     -- If T is a pointer to a member function of a class X, its
   //        associated namespaces and classes are those associated
   //        with the function parameter types and return type,
-  //        together with those associated with X. 
+  //        together with those associated with X.
   //
   //     -- If T is a pointer to a data member of class X, its
   //        associated namespaces and classes are those associated
   //        with the member type together with those associated with
-  //        X. 
+  //        X.
   if (const MemberPointerType *MemberPtr = T->getAs<MemberPointerType>()) {
     // Handle the type that the pointer to member points to.
     addAssociatedClassesAndNamespaces(MemberPtr->getPointeeType(),
@@ -1537,9 +1537,9 @@
 /// arguments.
 ///
 /// This routine computes the sets of associated classes and associated
-/// namespaces searched by argument-dependent lookup 
+/// namespaces searched by argument-dependent lookup
 /// (C++ [basic.lookup.argdep]) for a given set of arguments.
-void 
+void
 Sema::FindAssociatedClassesAndNamespaces(Expr **Args, unsigned NumArgs,
                                  AssociatedNamespaceSet &AssociatedNamespaces,
                                  AssociatedClassSet &AssociatedClasses) {
@@ -1552,7 +1552,7 @@
   //   associated classes to be considered. The sets of namespaces and
   //   classes is determined entirely by the types of the function
   //   arguments (and the namespace of any template template
-  //   argument). 
+  //   argument).
   for (unsigned ArgIdx = 0; ArgIdx != NumArgs; ++ArgIdx) {
     Expr *Arg = Args[ArgIdx];
 
@@ -1582,7 +1582,7 @@
       DRE = dyn_cast<DeclRefExpr>(Arg);
       TIRE = dyn_cast<TemplateIdRefExpr>(Arg);
     }
-    
+
     OverloadedFunctionDecl *Ovl = 0;
     if (DRE)
       Ovl = dyn_cast<OverloadedFunctionDecl>(DRE->getDecl());
@@ -1618,7 +1618,7 @@
 /// arguments have types T1 (and, if non-empty, T2). This routine
 /// implements the check in C++ [over.match.oper]p3b2 concerning
 /// enumeration types.
-static bool 
+static bool
 IsAcceptableNonMemberOperatorCandidate(FunctionDecl *Fn,
                                        QualType T1, QualType T2,
                                        ASTContext &Context) {
@@ -1686,7 +1686,7 @@
 }
 
 void Sema::LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
-                                        QualType T1, QualType T2, 
+                                        QualType T1, QualType T2,
                                         FunctionSet &Functions) {
   // C++ [over.match.oper]p3:
   //     -- The set of non-member candidates is the result of the
@@ -1702,7 +1702,7 @@
   //        when T2 is an enumeration type, are candidate functions.
   DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(Op);
   LookupResult Operators = LookupName(S, OpName, LookupOperatorName);
-  
+
   assert(!Operators.isAmbiguous() && "Operator lookup cannot be ambiguous");
 
   if (!Operators)
@@ -1713,10 +1713,10 @@
     if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*Op)) {
       if (IsAcceptableNonMemberOperatorCandidate(FD, T1, T2, Context))
         Functions.insert(FD); // FIXME: canonical FD
-    } else if (FunctionTemplateDecl *FunTmpl 
+    } else if (FunctionTemplateDecl *FunTmpl
                  = dyn_cast<FunctionTemplateDecl>(*Op)) {
       // FIXME: friend operators?
-      // FIXME: do we need to check IsAcceptableNonMemberOperatorCandidate, 
+      // FIXME: do we need to check IsAcceptableNonMemberOperatorCandidate,
       // later?
       if (!FunTmpl->getDeclContext()->isRecord())
         Functions.insert(FunTmpl);
@@ -1739,7 +1739,7 @@
   // arguments we have.
   AssociatedNamespaceSet AssociatedNamespaces;
   AssociatedClassSet AssociatedClasses;
-  FindAssociatedClassesAndNamespaces(Args, NumArgs, 
+  FindAssociatedClassesAndNamespaces(Args, NumArgs,
                                      AssociatedNamespaces,
                                      AssociatedClasses);
 
@@ -1755,8 +1755,8 @@
   // Here, we compute Y and add its members to the overloaded
   // candidate set.
   for (AssociatedNamespaceSet::iterator NS = AssociatedNamespaces.begin(),
-                                     NSEnd = AssociatedNamespaces.end(); 
-       NS != NSEnd; ++NS) { 
+                                     NSEnd = AssociatedNamespaces.end();
+       NS != NSEnd; ++NS) {
     //   When considering an associated namespace, the lookup is the
     //   same as the lookup performed when the associated namespace is
     //   used as a qualifier (3.4.3.2) except that:
@@ -1778,7 +1778,7 @@
         if (!AssociatedClasses.count(cast<CXXRecordDecl>(LexDC)))
           continue;
       }
-      
+
       CollectFunctionDecl(Functions, D);
     }
   }

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Sep  9 10:08:12 2009
@@ -30,7 +30,7 @@
 
 /// GetConversionCategory - Retrieve the implicit conversion
 /// category corresponding to the given implicit conversion kind.
-ImplicitConversionCategory 
+ImplicitConversionCategory
 GetConversionCategory(ImplicitConversionKind Kind) {
   static const ImplicitConversionCategory
     Category[(int)ICK_Num_Conversion_Kinds] = {
@@ -138,10 +138,9 @@
 
 /// isPointerConversionToBool - Determines whether this conversion is
 /// a conversion of a pointer or pointer-to-member to bool. This is
-/// used as part of the ranking of standard conversion sequences 
+/// used as part of the ranking of standard conversion sequences
 /// (C++ 13.3.3.2p4).
-bool StandardConversionSequence::isPointerConversionToBool() const
-{
+bool StandardConversionSequence::isPointerConversionToBool() const {
   QualType FromType = QualType::getFromOpaquePtr(FromTypePtr);
   QualType ToType = QualType::getFromOpaquePtr(ToTypePtr);
 
@@ -161,10 +160,9 @@
 /// conversion is a conversion of a pointer to a void pointer. This is
 /// used as part of the ranking of standard conversion sequences (C++
 /// 13.3.3.2p4).
-bool 
+bool
 StandardConversionSequence::
-isPointerConversionToVoidPointer(ASTContext& Context) const
-{
+isPointerConversionToVoidPointer(ASTContext& Context) const {
   QualType FromType = QualType::getFromOpaquePtr(FromTypePtr);
   QualType ToType = QualType::getFromOpaquePtr(ToTypePtr);
 
@@ -262,7 +260,7 @@
 // same signature (C++ 1.3.10) or if the Old declaration isn't a
 // function (or overload set). When it does return false and Old is an
 // OverloadedFunctionDecl, MatchedDecl will be set to point to the
-// FunctionDecl that New cannot be overloaded with. 
+// FunctionDecl that New cannot be overloaded with.
 //
 // Example: Given the following input:
 //
@@ -271,7 +269,7 @@
 //   int f(int, int); // #3
 //
 // When we process #1, there is no previous declaration of "f",
-// so IsOverload will not be used. 
+// so IsOverload will not be used.
 //
 // When we process #2, Old is a FunctionDecl for #1.  By comparing the
 // parameter types, we see that #1 and #2 are overloaded (since they
@@ -285,9 +283,8 @@
 // signature), IsOverload returns false and MatchedDecl will be set to
 // point to the FunctionDecl for #2.
 bool
-Sema::IsOverload(FunctionDecl *New, Decl* OldD, 
-                 OverloadedFunctionDecl::function_iterator& MatchedDecl)
-{
+Sema::IsOverload(FunctionDecl *New, Decl* OldD,
+                 OverloadedFunctionDecl::function_iterator& MatchedDecl) {
   if (OverloadedFunctionDecl* Ovl = dyn_cast<OverloadedFunctionDecl>(OldD)) {
     // Is this new function an overload of every function in the
     // overload set?
@@ -306,8 +303,8 @@
     return IsOverload(New, Old->getTemplatedDecl(), MatchedDecl);
   else if (FunctionDecl* Old = dyn_cast<FunctionDecl>(OldD)) {
     FunctionTemplateDecl *OldTemplate = Old->getDescribedFunctionTemplate();
-    FunctionTemplateDecl *NewTemplate = New->getDescribedFunctionTemplate(); 
-    
+    FunctionTemplateDecl *NewTemplate = New->getDescribedFunctionTemplate();
+
     // C++ [temp.fct]p2:
     //   A function template can be overloaded with other function templates
     //   and with normal (non-template) functions.
@@ -342,21 +339,21 @@
       return true;
 
     // C++ [temp.over.link]p4:
-    //   The signature of a function template consists of its function 
+    //   The signature of a function template consists of its function
     //   signature, its return type and its template parameter list. The names
     //   of the template parameters are significant only for establishing the
-    //   relationship between the template parameters and the rest of the 
+    //   relationship between the template parameters and the rest of the
     //   signature.
     //
     // We check the return type and template parameter lists for function
     // templates first; the remaining checks follow.
     if (NewTemplate &&
-        (!TemplateParameterListsAreEqual(NewTemplate->getTemplateParameters(), 
-                                         OldTemplate->getTemplateParameters(), 
+        (!TemplateParameterListsAreEqual(NewTemplate->getTemplateParameters(),
+                                         OldTemplate->getTemplateParameters(),
                                          false, false, SourceLocation()) ||
          OldType->getResultType() != NewType->getResultType()))
       return true;
-    
+
     // If the function is a class member, its signature includes the
     // cv-qualifiers (if any) on the function itself.
     //
@@ -367,7 +364,7 @@
     // can be overloaded.
     CXXMethodDecl* OldMethod = dyn_cast<CXXMethodDecl>(Old);
     CXXMethodDecl* NewMethod = dyn_cast<CXXMethodDecl>(New);
-    if (OldMethod && NewMethod && 
+    if (OldMethod && NewMethod &&
         !OldMethod->isStatic() && !NewMethod->isStatic() &&
         OldMethod->getTypeQualifiers() != NewMethod->getTypeQualifiers())
       return true;
@@ -411,13 +408,12 @@
 Sema::TryImplicitConversion(Expr* From, QualType ToType,
                             bool SuppressUserConversions,
                             bool AllowExplicit, bool ForceRValue,
-                            bool InOverloadResolution)
-{
+                            bool InOverloadResolution) {
   ImplicitConversionSequence ICS;
   if (IsStandardConversion(From, ToType, InOverloadResolution, ICS.Standard))
     ICS.ConversionKind = ImplicitConversionSequence::StandardConversion;
   else if (getLangOptions().CPlusPlus &&
-           IsUserDefinedConversion(From, ToType, ICS.UserDefined, 
+           IsUserDefinedConversion(From, ToType, ICS.UserDefined,
                                    !SuppressUserConversions, AllowExplicit,
                                    ForceRValue)) {
     ICS.ConversionKind = ImplicitConversionSequence::UserDefinedConversion;
@@ -428,9 +424,9 @@
     //   given Conversion rank, in spite of the fact that a copy
     //   constructor (i.e., a user-defined conversion function) is
     //   called for those cases.
-    if (CXXConstructorDecl *Constructor 
+    if (CXXConstructorDecl *Constructor
           = dyn_cast<CXXConstructorDecl>(ICS.UserDefined.ConversionFunction)) {
-      QualType FromCanon 
+      QualType FromCanon
         = Context.getCanonicalType(From->getType().getUnqualifiedType());
       QualType ToCanon = Context.getCanonicalType(ToType).getUnqualifiedType();
       if (FromCanon == ToCanon || IsDerivedFrom(FromCanon, ToCanon)) {
@@ -470,11 +466,10 @@
 /// contain the standard conversion sequence required to perform this
 /// conversion and this routine will return true. Otherwise, this
 /// routine will return false and the value of SCS is unspecified.
-bool 
-Sema::IsStandardConversion(Expr* From, QualType ToType, 
+bool
+Sema::IsStandardConversion(Expr* From, QualType ToType,
                            bool InOverloadResolution,
-                           StandardConversionSequence &SCS)
-{
+                           StandardConversionSequence &SCS) {
   QualType FromType = From->getType();
 
   // Standard conversions (C++ [conv])
@@ -485,23 +480,23 @@
   SCS.CopyConstructor = 0;
 
   // There are no standard conversions for class types in C++, so
-  // abort early. When overloading in C, however, we do permit 
+  // abort early. When overloading in C, however, we do permit
   if (FromType->isRecordType() || ToType->isRecordType()) {
     if (getLangOptions().CPlusPlus)
       return false;
 
-    // When we're overloading in C, we allow, as standard conversions, 
+    // When we're overloading in C, we allow, as standard conversions,
   }
 
   // The first conversion can be an lvalue-to-rvalue conversion,
   // array-to-pointer conversion, or function-to-pointer conversion
   // (C++ 4p1).
 
-  // Lvalue-to-rvalue conversion (C++ 4.1): 
+  // Lvalue-to-rvalue conversion (C++ 4.1):
   //   An lvalue (3.10) of a non-function, non-array type T can be
   //   converted to an rvalue.
   Expr::isLvalueResult argIsLvalue = From->isLvalue(Context);
-  if (argIsLvalue == Expr::LV_Valid && 
+  if (argIsLvalue == Expr::LV_Valid &&
       !FromType->isFunctionType() && !FromType->isArrayType() &&
       Context.getCanonicalType(FromType) != Context.OverloadTy) {
     SCS.First = ICK_Lvalue_To_Rvalue;
@@ -543,7 +538,7 @@
     // type "pointer to T." The result is a pointer to the
     // function. (C++ 4.3p1).
     FromType = Context.getPointerType(FromType);
-  } else if (FunctionDecl *Fn 
+  } else if (FunctionDecl *Fn
              = ResolveAddressOfOverloadedFunction(From, ToType, false)) {
     // Address of overloaded function (C++ [over.over]).
     SCS.First = ICK_Function_To_Pointer;
@@ -584,7 +579,7 @@
     // conversion to do.
     SCS.Second = ICK_Identity;
   } else if (IsIntegralPromotion(From, FromType, ToType)) {
-    // Integral promotion (C++ 4.5).  
+    // Integral promotion (C++ 4.5).
     SCS.Second = ICK_Integral_Promotion;
     FromType = ToType.getUnqualifiedType();
   } else if (IsFloatingPointPromotion(FromType, ToType)) {
@@ -612,7 +607,7 @@
   } else if ((FromType->isFloatingType() &&
               ToType->isIntegralType() && (!ToType->isBooleanType() &&
                                            !ToType->isEnumeralType())) ||
-             ((FromType->isIntegralType() || FromType->isEnumeralType()) && 
+             ((FromType->isIntegralType() || FromType->isEnumeralType()) &&
               ToType->isFloatingType())) {
     // Floating-integral conversions (C++ 4.9).
     // FIXME: isIntegralType shouldn't be true for enums in C++.
@@ -641,7 +636,7 @@
     // Boolean conversions (C++ 4.12).
     SCS.Second = ICK_Boolean_Conversion;
     FromType = Context.BoolTy;
-  } else if (!getLangOptions().CPlusPlus && 
+  } else if (!getLangOptions().CPlusPlus &&
              Context.typesAreCompatible(ToType, FromType)) {
     // Compatible conversions (Clang extension for C function overloading)
     SCS.Second = ICK_Compatible_Conversion;
@@ -662,12 +657,12 @@
     // No conversion required
     SCS.Third = ICK_Identity;
 
-    // C++ [over.best.ics]p6: 
+    // C++ [over.best.ics]p6:
     //   [...] Any difference in top-level cv-qualification is
     //   subsumed by the initialization itself and does not constitute
     //   a conversion. [...]
     CanonFrom = Context.getCanonicalType(FromType);
-    CanonTo = Context.getCanonicalType(ToType);    
+    CanonTo = Context.getCanonicalType(ToType);
     if (CanonFrom.getUnqualifiedType() == CanonTo.getUnqualifiedType() &&
         CanonFrom.getCVRQualifiers() != CanonTo.getCVRQualifiers()) {
       FromType = ToType;
@@ -688,8 +683,7 @@
 /// expression From (whose potentially-adjusted type is FromType) to
 /// ToType is an integral promotion (C++ 4.5). If so, returns true and
 /// sets PromotedType to the promoted type.
-bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
-{
+bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) {
   const BuiltinType *To = ToType->getAsBuiltinType();
   // All integers are built-in.
   if (!To) {
@@ -706,7 +700,7 @@
         (FromType->isSignedIntegerType() ||
          // We can promote any unsigned integer type whose size is
          // less than int to an int.
-         (!FromType->isSignedIntegerType() && 
+         (!FromType->isSignedIntegerType() &&
           Context.getTypeSize(FromType) < Context.getTypeSize(ToType)))) {
       return To->getKind() == BuiltinType::Int;
     }
@@ -734,15 +728,15 @@
 
     // The types we'll try to promote to, in the appropriate
     // order. Try each of these types.
-    QualType PromoteTypes[6] = { 
-      Context.IntTy, Context.UnsignedIntTy, 
+    QualType PromoteTypes[6] = {
+      Context.IntTy, Context.UnsignedIntTy,
       Context.LongTy, Context.UnsignedLongTy ,
       Context.LongLongTy, Context.UnsignedLongLongTy
     };
     for (int Idx = 0; Idx < 6; ++Idx) {
       uint64_t ToSize = Context.getTypeSize(PromoteTypes[Idx]);
       if (FromSize < ToSize ||
-          (FromSize == ToSize && 
+          (FromSize == ToSize &&
            FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType())) {
         // We found the type that we can promote to. If this is the
         // type we wanted, we have a promotion. Otherwise, no
@@ -770,23 +764,23 @@
           MemberDecl->getBitWidth()->isIntegerConstantExpr(BitWidth, Context)) {
         APSInt ToSize(BitWidth.getBitWidth(), BitWidth.isUnsigned());
         ToSize = Context.getTypeSize(ToType);
-        
+
         // Are we promoting to an int from a bitfield that fits in an int?
         if (BitWidth < ToSize ||
             (FromType->isSignedIntegerType() && BitWidth <= ToSize)) {
           return To->getKind() == BuiltinType::Int;
         }
-        
+
         // Are we promoting to an unsigned int from an unsigned bitfield
         // that fits into an unsigned int?
         if (FromType->isUnsignedIntegerType() && BitWidth <= ToSize) {
           return To->getKind() == BuiltinType::UInt;
         }
-        
+
         return false;
       }
     }
-  
+
   // An rvalue of type bool can be converted to an rvalue of type int,
   // with false becoming zero and true becoming one (C++ 4.5p4).
   if (FromType->isBooleanType() && To->getKind() == BuiltinType::Int) {
@@ -799,8 +793,7 @@
 /// IsFloatingPointPromotion - Determines whether the conversion from
 /// FromType to ToType is a floating point promotion (C++ 4.6). If so,
 /// returns true and sets PromotedType to the promoted type.
-bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType)
-{
+bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType) {
   /// An rvalue of type float can be converted to an rvalue of type
   /// double. (C++ 4.6p1).
   if (const BuiltinType *FromBuiltin = FromType->getAsBuiltinType())
@@ -847,15 +840,15 @@
 /// same type qualifiers as FromPtr has on its pointee type. ToType,
 /// if non-empty, will be a pointer to ToType that may or may not have
 /// the right set of qualifiers on its pointee.
-static QualType 
-BuildSimilarlyQualifiedPointerType(const PointerType *FromPtr, 
+static QualType
+BuildSimilarlyQualifiedPointerType(const PointerType *FromPtr,
                                    QualType ToPointee, QualType ToType,
                                    ASTContext &Context) {
   QualType CanonFromPointee = Context.getCanonicalType(FromPtr->getPointeeType());
   QualType CanonToPointee = Context.getCanonicalType(ToPointee);
   unsigned Quals = CanonFromPointee.getCVRQualifiers();
-  
-  // Exact qualifier match -> return the pointer type we're converting to.  
+
+  // Exact qualifier match -> return the pointer type we're converting to.
   if (CanonToPointee.getCVRQualifiers() == Quals) {
     // ToType is exactly what we need. Return it.
     if (ToType.getTypePtr())
@@ -870,7 +863,7 @@
   return Context.getPointerType(CanonToPointee.getQualifiedType(Quals));
 }
 
-static bool isNullPointerConstantForConversion(Expr *Expr, 
+static bool isNullPointerConstantForConversion(Expr *Expr,
                                                bool InOverloadResolution,
                                                ASTContext &Context) {
   // Handle value-dependent integral null pointer constants correctly.
@@ -881,7 +874,7 @@
 
   return Expr->isNullPointerConstant(Context);
 }
-  
+
 /// IsPointerConversion - Determines whether the conversion of the
 /// expression From, which has the (possibly adjusted) type FromType,
 /// can be converted to the type ToType via a pointer conversion (C++
@@ -901,14 +894,13 @@
 bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
                                bool InOverloadResolution,
                                QualType& ConvertedType,
-                               bool &IncompatibleObjC)
-{
+                               bool &IncompatibleObjC) {
   IncompatibleObjC = false;
   if (isObjCPointerConversion(FromType, ToType, ConvertedType, IncompatibleObjC))
     return true;
 
-  // Conversion from a null pointer constant to any Objective-C pointer type. 
-  if (ToType->isObjCObjectPointerType() && 
+  // Conversion from a null pointer constant to any Objective-C pointer type.
+  if (ToType->isObjCObjectPointerType() &&
       isNullPointerConstantForConversion(From, InOverloadResolution, Context)) {
     ConvertedType = ToType;
     return true;
@@ -922,7 +914,7 @@
   }
   // Blocks: A null pointer constant can be converted to a block
   // pointer type.
-  if (ToType->isBlockPointerType() && 
+  if (ToType->isBlockPointerType() &&
       isNullPointerConstantForConversion(From, InOverloadResolution, Context)) {
     ConvertedType = ToType;
     return true;
@@ -930,7 +922,7 @@
 
   // If the left-hand-side is nullptr_t, the right side can be a null
   // pointer constant.
-  if (ToType->isNullPtrType() && 
+  if (ToType->isNullPtrType() &&
       isNullPointerConstantForConversion(From, InOverloadResolution, Context)) {
     ConvertedType = ToType;
     return true;
@@ -958,7 +950,7 @@
   // can be converted to an rvalue of type "pointer to cv void" (C++
   // 4.10p2).
   if (FromPointeeType->isObjectType() && ToPointeeType->isVoidType()) {
-    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, 
+    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
                                                        ToPointeeType,
                                                        ToType, Context);
     return true;
@@ -966,16 +958,16 @@
 
   // When we're overloading in C, we allow a special kind of pointer
   // conversion for compatible-but-not-identical pointee types.
-  if (!getLangOptions().CPlusPlus && 
+  if (!getLangOptions().CPlusPlus &&
       Context.typesAreCompatible(FromPointeeType, ToPointeeType)) {
-    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, 
+    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
                                                        ToPointeeType,
-                                                       ToType, Context);    
+                                                       ToType, Context);
     return true;
   }
 
   // C++ [conv.ptr]p3:
-  // 
+  //
   //   An rvalue of type "pointer to cv D," where D is a class type,
   //   can be converted to an rvalue of type "pointer to cv B," where
   //   B is a base class (clause 10) of D. If B is an inaccessible
@@ -990,7 +982,7 @@
   if (getLangOptions().CPlusPlus &&
       FromPointeeType->isRecordType() && ToPointeeType->isRecordType() &&
       IsDerivedFrom(FromPointeeType, ToPointeeType)) {
-    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, 
+    ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
                                                        ToPointeeType,
                                                        ToType, Context);
     return true;
@@ -1002,7 +994,7 @@
 /// isObjCPointerConversion - Determines whether this is an
 /// Objective-C pointer conversion. Subroutine of IsPointerConversion,
 /// with the same arguments and return values.
-bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, 
+bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
                                    QualType& ConvertedType,
                                    bool &IncompatibleObjC) {
   if (!getLangOptions().ObjC1)
@@ -1010,7 +1002,7 @@
 
   // First, we handle all conversions on ObjC object pointer types.
   const ObjCObjectPointerType* ToObjCPtr = ToType->getAsObjCObjectPointerType();
-  const ObjCObjectPointerType *FromObjCPtr = 
+  const ObjCObjectPointerType *FromObjCPtr =
     FromType->getAsObjCObjectPointerType();
 
   if (ToObjCPtr && FromObjCPtr) {
@@ -1021,9 +1013,9 @@
       return true;
     }
     // Conversions with Objective-C's id<...>.
-    if ((FromObjCPtr->isObjCQualifiedIdType() || 
+    if ((FromObjCPtr->isObjCQualifiedIdType() ||
          ToObjCPtr->isObjCQualifiedIdType()) &&
-        Context.ObjCQualifiedIdTypesAreCompatible(ToType, FromType, 
+        Context.ObjCQualifiedIdTypesAreCompatible(ToType, FromType,
                                                   /*compare=*/false)) {
       ConvertedType = ToType;
       return true;
@@ -1043,7 +1035,7 @@
       ConvertedType = FromType;
       return true;
     }
-  } 
+  }
   // Beyond this point, both types need to be C pointers or block pointers.
   QualType ToPointeeType;
   if (const PointerType *ToCPtr = ToType->getAs<PointerType>())
@@ -1075,7 +1067,7 @@
   // differences in the argument and result types are in Objective-C
   // pointer conversions. If so, we permit the conversion (but
   // complain about it).
-  const FunctionProtoType *FromFunctionType 
+  const FunctionProtoType *FromFunctionType
     = FromPointeeType->getAsFunctionProtoType();
   const FunctionProtoType *ToFunctionType
     = ToPointeeType->getAsFunctionProtoType();
@@ -1106,7 +1098,7 @@
       // Function types are too different. Abort.
       return false;
     }
-     
+
     // Check argument types.
     for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumArgs();
          ArgIdx != NumArgs; ++ArgIdx) {
@@ -1160,9 +1152,9 @@
                                             From->getSourceRange());
       }
     }
-  if (const ObjCObjectPointerType *FromPtrType = 
+  if (const ObjCObjectPointerType *FromPtrType =
         FromType->getAsObjCObjectPointerType())
-    if (const ObjCObjectPointerType *ToPtrType = 
+    if (const ObjCObjectPointerType *ToPtrType =
           ToType->getAsObjCObjectPointerType()) {
       // Objective-C++ conversions are always okay.
       // FIXME: We should have a different class of conversions for the
@@ -1180,8 +1172,7 @@
 /// If so, returns true and places the converted type (that might differ from
 /// ToType in its cv-qualifiers at some level) into ConvertedType.
 bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
-                                     QualType ToType, QualType &ConvertedType)
-{
+                                     QualType ToType, QualType &ConvertedType) {
   const MemberPointerType *ToTypePtr = ToType->getAs<MemberPointerType>();
   if (!ToTypePtr)
     return false;
@@ -1218,13 +1209,13 @@
 /// for which IsMemberPointerConversion has already returned true. It returns
 /// true and produces a diagnostic if there was an error, or returns false
 /// otherwise.
-bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType, 
+bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType,
                                         CastExpr::CastKind &Kind) {
   QualType FromType = From->getType();
   const MemberPointerType *FromPtrType = FromType->getAs<MemberPointerType>();
   if (!FromPtrType) {
     // This must be a null pointer to member pointer conversion
-    assert(From->isNullPointerConstant(Context) && 
+    assert(From->isNullPointerConstant(Context) &&
            "Expr must be null pointer constant!");
     Kind = CastExpr::CK_NullToMemberPointer;
     return false;
@@ -1278,9 +1269,8 @@
 /// IsQualificationConversion - Determines whether the conversion from
 /// an rvalue of type FromType to ToType is a qualification conversion
 /// (C++ 4.4).
-bool 
-Sema::IsQualificationConversion(QualType FromType, QualType ToType)
-{
+bool
+Sema::IsQualificationConversion(QualType FromType, QualType ToType) {
   FromType = Context.getCanonicalType(FromType);
   ToType = Context.getCanonicalType(ToType);
 
@@ -1307,16 +1297,16 @@
     //      2,j, and similarly for volatile.
     if (!ToType.isAtLeastAsQualifiedAs(FromType))
       return false;
-    
+
     //   -- if the cv 1,j and cv 2,j are different, then const is in
     //      every cv for 0 < k < j.
     if (FromType.getCVRQualifiers() != ToType.getCVRQualifiers()
         && !PreviousToQualsIncludeConst)
       return false;
-    
+
     // Keep track of whether all prior cv-qualifiers in the "to" type
     // include const.
-    PreviousToQualsIncludeConst 
+    PreviousToQualsIncludeConst
       = PreviousToQualsIncludeConst && ToType.isConstQualified();
   }
 
@@ -1359,14 +1349,13 @@
 ///
 /// \param ForceRValue  true if the expression should be treated as an rvalue
 /// for overload resolution.
-bool Sema::IsUserDefinedConversion(Expr *From, QualType ToType, 
+bool Sema::IsUserDefinedConversion(Expr *From, QualType ToType,
                                    UserDefinedConversionSequence& User,
                                    bool AllowConversionFunctions,
-                                   bool AllowExplicit, bool ForceRValue)
-{
+                                   bool AllowExplicit, bool ForceRValue) {
   OverloadCandidateSet CandidateSet;
   if (const RecordType *ToRecordType = ToType->getAs<RecordType>()) {
-    if (CXXRecordDecl *ToRecordDecl 
+    if (CXXRecordDecl *ToRecordDecl
           = dyn_cast<CXXRecordDecl>(ToRecordType->getDecl())) {
       // C++ [over.match.ctor]p1:
       //   When objects of class type are direct-initialized (8.5), or
@@ -1376,11 +1365,11 @@
       //   functions are all the converting constructors (12.3.1) of
       //   that class. The argument list is the expression-list within
       //   the parentheses of the initializer.
-      DeclarationName ConstructorName 
+      DeclarationName ConstructorName
         = Context.DeclarationNames.getCXXConstructorName(
                           Context.getCanonicalType(ToType).getUnqualifiedType());
       DeclContext::lookup_iterator Con, ConEnd;
-      for (llvm::tie(Con, ConEnd) 
+      for (llvm::tie(Con, ConEnd)
              = ToRecordDecl->lookup(ConstructorName);
            Con != ConEnd; ++Con) {
         // Find the constructor (which may be a template).
@@ -1388,17 +1377,17 @@
         FunctionTemplateDecl *ConstructorTmpl
           = dyn_cast<FunctionTemplateDecl>(*Con);
         if (ConstructorTmpl)
-          Constructor 
+          Constructor
             = cast<CXXConstructorDecl>(ConstructorTmpl->getTemplatedDecl());
         else
           Constructor = cast<CXXConstructorDecl>(*Con);
-        
+
         if (!Constructor->isInvalidDecl() &&
             Constructor->isConvertingConstructor(AllowExplicit)) {
           if (ConstructorTmpl)
-            AddTemplateOverloadCandidate(ConstructorTmpl, false, 0, 0, &From, 
+            AddTemplateOverloadCandidate(ConstructorTmpl, false, 0, 0, &From,
                                          1, CandidateSet,
-                                         /*SuppressUserConversions=*/true, 
+                                         /*SuppressUserConversions=*/true,
                                          ForceRValue);
           else
             AddOverloadCandidate(Constructor, &From, 1, CandidateSet,
@@ -1410,19 +1399,19 @@
 
   if (!AllowConversionFunctions) {
     // Don't allow any conversion functions to enter the overload set.
-  } else if (RequireCompleteType(From->getLocStart(), From->getType(), 
-                                 PDiag(0) 
+  } else if (RequireCompleteType(From->getLocStart(), From->getType(),
+                                 PDiag(0)
                                    << From->getSourceRange())) {
     // No conversion functions from incomplete types.
-  } else if (const RecordType *FromRecordType 
+  } else if (const RecordType *FromRecordType
                = From->getType()->getAs<RecordType>()) {
-    if (CXXRecordDecl *FromRecordDecl 
+    if (CXXRecordDecl *FromRecordDecl
           = dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) {
       // Add all of the conversion functions as candidates.
       // FIXME: Look for conversions in base classes!
-      OverloadedFunctionDecl *Conversions 
+      OverloadedFunctionDecl *Conversions
         = FromRecordDecl->getConversionFunctions();
-      for (OverloadedFunctionDecl::function_iterator Func 
+      for (OverloadedFunctionDecl::function_iterator Func
              = Conversions->function_begin();
            Func != Conversions->function_end(); ++Func) {
         CXXConversionDecl *Conv;
@@ -1430,12 +1419,12 @@
         GetFunctionAndTemplate(*Func, Conv, ConvTemplate);
         if (ConvTemplate)
           Conv = dyn_cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
-        else 
+        else
           Conv = dyn_cast<CXXConversionDecl>(*Func);
 
         if (AllowExplicit || !Conv->isExplicit()) {
           if (ConvTemplate)
-            AddTemplateConversionCandidate(ConvTemplate, From, ToType, 
+            AddTemplateConversionCandidate(ConvTemplate, From, ToType,
                                            CandidateSet);
           else
             AddConversionCandidate(Conv, From, ToType, CandidateSet);
@@ -1448,7 +1437,7 @@
   switch (BestViableFunction(CandidateSet, From->getLocStart(), Best)) {
     case OR_Success:
       // Record the standard conversion we used and the conversion function.
-      if (CXXConstructorDecl *Constructor 
+      if (CXXConstructorDecl *Constructor
             = dyn_cast<CXXConstructorDecl>(Best->Function)) {
         // C++ [over.ics.user]p1:
         //   If the user-defined conversion is specified by a
@@ -1461,7 +1450,7 @@
         User.Before = Best->Conversions[0].Standard;
         User.ConversionFunction = Constructor;
         User.After.setAsIdentityConversion();
-        User.After.FromTypePtr 
+        User.After.FromTypePtr
           = ThisType->getAs<PointerType>()->getPointeeType().getAsOpaquePtr();
         User.After.ToTypePtr = ToType.getAsOpaquePtr();
         return true;
@@ -1475,8 +1464,8 @@
         //   implicit object parameter of the conversion function.
         User.Before = Best->Conversions[0].Standard;
         User.ConversionFunction = Conversion;
-        
-        // C++ [over.ics.user]p2: 
+
+        // C++ [over.ics.user]p2:
         //   The second standard conversion sequence converts the
         //   result of the user-defined conversion to the target type
         //   for the sequence. Since an implicit conversion sequence
@@ -1491,7 +1480,7 @@
         assert(false && "Not a constructor or conversion function?");
         return false;
       }
-      
+
     case OR_No_Viable_Function:
     case OR_Deleted:
       // No conversion here! We're done.
@@ -1509,7 +1498,7 @@
 /// CompareImplicitConversionSequences - Compare two implicit
 /// conversion sequences to determine whether one is better than the
 /// other or if they are indistinguishable (C++ 13.3.3.2).
-ImplicitConversionSequence::CompareKind 
+ImplicitConversionSequence::CompareKind
 Sema::CompareImplicitConversionSequences(const ImplicitConversionSequence& ICS1,
                                          const ImplicitConversionSequence& ICS2)
 {
@@ -1521,7 +1510,7 @@
   //   -- a user-defined conversion sequence (13.3.3.1.2) is a better
   //      conversion sequence than an ellipsis conversion sequence
   //      (13.3.3.1.3).
-  // 
+  //
   if (ICS1.ConversionKind < ICS2.ConversionKind)
     return ImplicitConversionSequence::Better;
   else if (ICS2.ConversionKind < ICS1.ConversionKind)
@@ -1532,7 +1521,7 @@
   // following rules apply: (C++ 13.3.3.2p3):
   if (ICS1.ConversionKind == ImplicitConversionSequence::StandardConversion)
     return CompareStandardConversionSequences(ICS1.Standard, ICS2.Standard);
-  else if (ICS1.ConversionKind == 
+  else if (ICS1.ConversionKind ==
              ImplicitConversionSequence::UserDefinedConversion) {
     // User-defined conversion sequence U1 is a better conversion
     // sequence than another user-defined conversion sequence U2 if
@@ -1540,7 +1529,7 @@
     // constructor and if the second standard conversion sequence of
     // U1 is better than the second standard conversion sequence of
     // U2 (C++ 13.3.3.2p3).
-    if (ICS1.UserDefined.ConversionFunction == 
+    if (ICS1.UserDefined.ConversionFunction ==
           ICS2.UserDefined.ConversionFunction)
       return CompareStandardConversionSequences(ICS1.UserDefined.After,
                                                 ICS2.UserDefined.After);
@@ -1552,7 +1541,7 @@
 /// CompareStandardConversionSequences - Compare two standard
 /// conversion sequences to determine whether one is better than the
 /// other or if they are indistinguishable (C++ 13.3.3.2p3).
-ImplicitConversionSequence::CompareKind 
+ImplicitConversionSequence::CompareKind
 Sema::CompareStandardConversionSequences(const StandardConversionSequence& SCS1,
                                          const StandardConversionSequence& SCS2)
 {
@@ -1569,13 +1558,13 @@
     ;
   else if ((SCS1.Second == ICK_Identity && SCS1.Third == SCS2.Third) ||
            (SCS1.Third == ICK_Identity && SCS1.Second == SCS2.Second) ||
-           (SCS1.Second == ICK_Identity && 
+           (SCS1.Second == ICK_Identity &&
             SCS1.Third == ICK_Identity))
     // SCS1 is a proper subsequence of SCS2.
     return ImplicitConversionSequence::Better;
   else if ((SCS2.Second == ICK_Identity && SCS2.Third == SCS1.Third) ||
            (SCS2.Third == ICK_Identity && SCS2.Second == SCS1.Second) ||
-           (SCS2.Second == ICK_Identity && 
+           (SCS2.Second == ICK_Identity &&
             SCS2.Third == ICK_Identity))
     // SCS2 is a proper subsequence of SCS1.
     return ImplicitConversionSequence::Worse;
@@ -1592,7 +1581,7 @@
   // (C++ 13.3.3.2p4): Two conversion sequences with the same rank
   // are indistinguishable unless one of the following rules
   // applies:
-  
+
   //   A conversion that is not a conversion of a pointer, or
   //   pointer to member, to bool is better than another conversion
   //   that is such a conversion.
@@ -1607,9 +1596,9 @@
   //   conversion of B* to A* is better than conversion of B* to
   //   void*, and conversion of A* to void* is better than conversion
   //   of B* to void*.
-  bool SCS1ConvertsToVoid 
+  bool SCS1ConvertsToVoid
     = SCS1.isPointerConversionToVoidPointer(Context);
-  bool SCS2ConvertsToVoid 
+  bool SCS2ConvertsToVoid
     = SCS2.isPointerConversionToVoidPointer(Context);
   if (SCS1ConvertsToVoid != SCS2ConvertsToVoid) {
     // Exactly one of the conversion sequences is a conversion to
@@ -1636,7 +1625,7 @@
     if (SCS2.First == ICK_Array_To_Pointer)
       FromType2 = Context.getArrayDecayedType(FromType2);
 
-    QualType FromPointee1 
+    QualType FromPointee1
       = FromType1->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
     QualType FromPointee2
       = FromType2->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
@@ -1660,7 +1649,7 @@
 
   // Compare based on qualification conversions (C++ 13.3.3.2p3,
   // bullet 3).
-  if (ImplicitConversionSequence::CompareKind QualCK 
+  if (ImplicitConversionSequence::CompareKind QualCK
         = CompareQualificationConversions(SCS1, SCS2))
     return QualCK;
 
@@ -1700,11 +1689,10 @@
 
 /// CompareQualificationConversions - Compares two standard conversion
 /// sequences to determine whether they can be ranked based on their
-/// qualification conversions (C++ 13.3.3.2p3 bullet 3). 
-ImplicitConversionSequence::CompareKind 
+/// qualification conversions (C++ 13.3.3.2p3 bullet 3).
+ImplicitConversionSequence::CompareKind
 Sema::CompareQualificationConversions(const StandardConversionSequence& SCS1,
-                                      const StandardConversionSequence& SCS2)
-{
+                                      const StandardConversionSequence& SCS2) {
   // C++ 13.3.3.2p3:
   //  -- S1 and S2 differ only in their qualification conversion and
   //     yield similar types T1 and T2 (C++ 4.4), respectively, and the
@@ -1727,7 +1715,7 @@
   if (T1.getUnqualifiedType() == T2.getUnqualifiedType())
     return ImplicitConversionSequence::Indistinguishable;
 
-  ImplicitConversionSequence::CompareKind Result 
+  ImplicitConversionSequence::CompareKind Result
     = ImplicitConversionSequence::Indistinguishable;
   while (UnwrapSimilarPointerTypes(T1, T2)) {
     // Within each iteration of the loop, we check the qualifiers to
@@ -1748,7 +1736,7 @@
         // Neither has qualifiers that are a subset of the other's
         // qualifiers.
         return ImplicitConversionSequence::Indistinguishable;
-      
+
       Result = ImplicitConversionSequence::Better;
     } else if (T1.isMoreQualifiedThan(T2)) {
       // T2 has fewer qualifiers, so it could be the better sequence.
@@ -1756,7 +1744,7 @@
         // Neither has qualifiers that are a subset of the other's
         // qualifiers.
         return ImplicitConversionSequence::Indistinguishable;
-      
+
       Result = ImplicitConversionSequence::Worse;
     } else {
       // Qualifiers are disjoint.
@@ -1823,14 +1811,14 @@
   // interfaces.
 
   // Compare based on pointer conversions.
-  if (SCS1.Second == ICK_Pointer_Conversion && 
+  if (SCS1.Second == ICK_Pointer_Conversion &&
       SCS2.Second == ICK_Pointer_Conversion &&
       /*FIXME: Remove if Objective-C id conversions get their own rank*/
       FromType1->isPointerType() && FromType2->isPointerType() &&
       ToType1->isPointerType() && ToType2->isPointerType()) {
-    QualType FromPointee1 
+    QualType FromPointee1
       = FromType1->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
-    QualType ToPointee1 
+    QualType ToPointee1
       = ToType1->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
     QualType FromPointee2
       = FromType2->getAs<PointerType>()->getPointeeType().getUnqualifiedType();
@@ -1863,7 +1851,7 @@
         return ImplicitConversionSequence::Better;
       else if (IsDerivedFrom(FromPointee1, FromPointee2))
         return ImplicitConversionSequence::Worse;
-      
+
       if (FromIface1 && FromIface2) {
         if (Context.canAssignObjCInterfaces(FromIface1, FromIface2))
           return ImplicitConversionSequence::Better;
@@ -1937,20 +1925,20 @@
 /// a parameter of this type). If @p SuppressUserConversions, then we
 /// do not permit any user-defined conversion sequences. If @p ForceRValue,
 /// then we treat @p From as an rvalue, even if it is an lvalue.
-ImplicitConversionSequence 
-Sema::TryCopyInitialization(Expr *From, QualType ToType, 
+ImplicitConversionSequence
+Sema::TryCopyInitialization(Expr *From, QualType ToType,
                             bool SuppressUserConversions, bool ForceRValue,
                             bool InOverloadResolution) {
   if (ToType->isReferenceType()) {
     ImplicitConversionSequence ICS;
-    CheckReferenceInit(From, ToType, 
+    CheckReferenceInit(From, ToType,
                        SuppressUserConversions,
                        /*AllowExplicit=*/false,
                        ForceRValue,
                        &ICS);
     return ICS;
   } else {
-    return TryImplicitConversion(From, ToType, 
+    return TryImplicitConversion(From, ToType,
                                  SuppressUserConversions,
                                  /*AllowExplicit=*/false,
                                  ForceRValue,
@@ -1963,18 +1951,18 @@
 /// an error, returns false if the initialization succeeded. Elidable should
 /// be true when the copy may be elided (C++ 12.8p15). Overload resolution works
 /// differently in C++0x for this case.
-bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType, 
+bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType,
                                      const char* Flavor, bool Elidable) {
   if (!getLangOptions().CPlusPlus) {
     // In C, argument passing is the same as performing an assignment.
     QualType FromType = From->getType();
-    
+
     AssignConvertType ConvTy =
       CheckSingleAssignmentConstraints(ToType, From);
     if (ConvTy != Compatible &&
         CheckTransparentUnionArgumentConstraints(ToType, From) == Compatible)
       ConvTy = Compatible;
-    
+
     return DiagnoseAssignmentResult(ConvTy, From->getLocStart(), ToType,
                                     FromType, From, Flavor);
   }
@@ -2020,7 +2008,7 @@
   // where X is the class of which the function is a member
   // (C++ [over.match.funcs]p4). However, when finding an implicit
   // conversion sequence for the argument, we are not allowed to
-  // create temporaries or perform user-defined conversions 
+  // create temporaries or perform user-defined conversions
   // (C++ [over.match.funcs]p5). We perform a simplified version of
   // reference binding here, that allows class rvalues to bind to
   // non-constant references.
@@ -2058,9 +2046,9 @@
 bool
 Sema::PerformObjectArgumentInitialization(Expr *&From, CXXMethodDecl *Method) {
   QualType FromRecordType, DestType;
-  QualType ImplicitParamRecordType  = 
+  QualType ImplicitParamRecordType  =
     Method->getThisType(Context)->getAs<PointerType>()->getPointeeType();
-  
+
   if (const PointerType *PT = From->getType()->getAs<PointerType>()) {
     FromRecordType = PT->getPointeeType();
     DestType = Method->getThisType(Context);
@@ -2069,13 +2057,13 @@
     DestType = ImplicitParamRecordType;
   }
 
-  ImplicitConversionSequence ICS 
+  ImplicitConversionSequence ICS
     = TryObjectArgumentInitialization(From, Method);
   if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion)
     return Diag(From->getSourceRange().getBegin(),
                 diag::err_implicit_object_parameter_init)
        << ImplicitParamRecordType << FromRecordType << From->getSourceRange();
-  
+
   if (ICS.Standard.Second == ICK_Derived_To_Base &&
       CheckDerivedToBaseConversion(FromRecordType,
                                    ImplicitParamRecordType,
@@ -2083,7 +2071,7 @@
                                    From->getSourceRange()))
     return true;
 
-  ImpCastExprToType(From, DestType, CastExpr::CK_DerivedToBase, 
+  ImpCastExprToType(From, DestType, CastExpr::CK_DerivedToBase,
                     /*isLvalue=*/true);
   return false;
 }
@@ -2091,10 +2079,10 @@
 /// TryContextuallyConvertToBool - Attempt to contextually convert the
 /// expression From to bool (C++0x [conv]p3).
 ImplicitConversionSequence Sema::TryContextuallyConvertToBool(Expr *From) {
-  return TryImplicitConversion(From, Context.BoolTy, 
+  return TryImplicitConversion(From, Context.BoolTy,
                                // FIXME: Are these flags correct?
                                /*SuppressUserConversions=*/false,
-                               /*AllowExplicit=*/true, 
+                               /*AllowExplicit=*/true,
                                /*ForceRValue=*/false,
                                /*InOverloadResolution=*/false);
 }
@@ -2106,7 +2094,7 @@
   if (!PerformImplicitConversion(From, Context.BoolTy, ICS, "converting"))
     return false;
 
-  return Diag(From->getSourceRange().getBegin(), 
+  return Diag(From->getSourceRange().getBegin(),
               diag::err_typecheck_bool_condition)
     << From->getType() << From->getSourceRange();
 }
@@ -2118,21 +2106,20 @@
 /// If @p ForceRValue, treat all arguments as rvalues. This is a slightly
 /// hacky way to implement the overloading rules for elidable copy
 /// initialization in C++0x (C++0x 12.8p15).
-void 
-Sema::AddOverloadCandidate(FunctionDecl *Function, 
+void
+Sema::AddOverloadCandidate(FunctionDecl *Function,
                            Expr **Args, unsigned NumArgs,
                            OverloadCandidateSet& CandidateSet,
                            bool SuppressUserConversions,
-                           bool ForceRValue)
-{
-  const FunctionProtoType* Proto 
+                           bool ForceRValue) {
+  const FunctionProtoType* Proto
     = dyn_cast<FunctionProtoType>(Function->getType()->getAsFunctionType());
   assert(Proto && "Functions without a prototype cannot be overloaded");
-  assert(!isa<CXXConversionDecl>(Function) && 
+  assert(!isa<CXXConversionDecl>(Function) &&
          "Use AddConversionCandidate for conversion functions");
-  assert(!Function->getDescribedFunctionTemplate() && 
+  assert(!Function->getDescribedFunctionTemplate() &&
          "Use AddTemplateOverloadCandidate for function templates");
-  
+
   if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Function)) {
     if (!isa<CXXConstructorDecl>(Method)) {
       // If we get here, it's because we're calling a member function
@@ -2141,7 +2128,7 @@
       // implicitly. This can happen with a qualified call to a member
       // function, e.g., X::f(). We use a NULL object as the implied
       // object argument (C++ [over.call.func]p3).
-      AddMethodCandidate(Method, 0, Args, NumArgs, CandidateSet, 
+      AddMethodCandidate(Method, 0, Args, NumArgs, CandidateSet,
                          SuppressUserConversions, ForceRValue);
       return;
     }
@@ -2190,11 +2177,11 @@
       // (13.3.3.1) that converts that argument to the corresponding
       // parameter of F.
       QualType ParamType = Proto->getArgType(ArgIdx);
-      Candidate.Conversions[ArgIdx] 
-        = TryCopyInitialization(Args[ArgIdx], ParamType, 
+      Candidate.Conversions[ArgIdx]
+        = TryCopyInitialization(Args[ArgIdx], ParamType,
                                 SuppressUserConversions, ForceRValue,
                                 /*InOverloadResolution=*/true);
-      if (Candidate.Conversions[ArgIdx].ConversionKind 
+      if (Candidate.Conversions[ArgIdx].ConversionKind
             == ImplicitConversionSequence::BadConversion) {
         Candidate.Viable = false;
         break;
@@ -2203,7 +2190,7 @@
       // (C++ 13.3.2p2): For the purposes of overload resolution, any
       // argument for which there is no corresponding parameter is
       // considered to ""match the ellipsis" (C+ 13.3.3.1.3).
-      Candidate.Conversions[ArgIdx].ConversionKind 
+      Candidate.Conversions[ArgIdx].ConversionKind
         = ImplicitConversionSequence::EllipsisConversion;
     }
   }
@@ -2215,16 +2202,16 @@
                                  Expr **Args, unsigned NumArgs,
                                  OverloadCandidateSet& CandidateSet,
                                  bool SuppressUserConversions) {
-  for (FunctionSet::const_iterator F = Functions.begin(), 
+  for (FunctionSet::const_iterator F = Functions.begin(),
                                 FEnd = Functions.end();
        F != FEnd; ++F) {
     if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*F))
-      AddOverloadCandidate(FD, Args, NumArgs, CandidateSet, 
+      AddOverloadCandidate(FD, Args, NumArgs, CandidateSet,
                            SuppressUserConversions);
     else
       AddTemplateOverloadCandidate(cast<FunctionTemplateDecl>(*F),
                                    /*FIXME: explicit args */false, 0, 0,
-                                   Args, NumArgs, CandidateSet, 
+                                   Args, NumArgs, CandidateSet,
                                    SuppressUserConversions);
   }
 }
@@ -2238,13 +2225,12 @@
 /// operators. If @p ForceRValue, treat all arguments as rvalues. This is
 /// a slightly hacky way to implement the overloading rules for elidable copy
 /// initialization in C++0x (C++0x 12.8p15).
-void 
+void
 Sema::AddMethodCandidate(CXXMethodDecl *Method, Expr *Object,
                          Expr **Args, unsigned NumArgs,
                          OverloadCandidateSet& CandidateSet,
-                         bool SuppressUserConversions, bool ForceRValue)
-{
-  const FunctionProtoType* Proto 
+                         bool SuppressUserConversions, bool ForceRValue) {
+  const FunctionProtoType* Proto
     = dyn_cast<FunctionProtoType>(Method->getType()->getAsFunctionType());
   assert(Proto && "Methods without a prototype cannot be overloaded");
   assert(!isa<CXXConversionDecl>(Method) &&
@@ -2291,7 +2277,7 @@
     // Determine the implicit conversion sequence for the object
     // parameter.
     Candidate.Conversions[0] = TryObjectArgumentInitialization(Object, Method);
-    if (Candidate.Conversions[0].ConversionKind 
+    if (Candidate.Conversions[0].ConversionKind
           == ImplicitConversionSequence::BadConversion) {
       Candidate.Viable = false;
       return;
@@ -2307,11 +2293,11 @@
       // (13.3.3.1) that converts that argument to the corresponding
       // parameter of F.
       QualType ParamType = Proto->getArgType(ArgIdx);
-      Candidate.Conversions[ArgIdx + 1] 
-        = TryCopyInitialization(Args[ArgIdx], ParamType, 
+      Candidate.Conversions[ArgIdx + 1]
+        = TryCopyInitialization(Args[ArgIdx], ParamType,
                                 SuppressUserConversions, ForceRValue,
                                 /*InOverloadResolution=*/true);
-      if (Candidate.Conversions[ArgIdx + 1].ConversionKind 
+      if (Candidate.Conversions[ArgIdx + 1].ConversionKind
             == ImplicitConversionSequence::BadConversion) {
         Candidate.Viable = false;
         break;
@@ -2320,7 +2306,7 @@
       // (C++ 13.3.2p2): For the purposes of overload resolution, any
       // argument for which there is no corresponding parameter is
       // considered to ""match the ellipsis" (C+ 13.3.3.1.3).
-      Candidate.Conversions[ArgIdx + 1].ConversionKind 
+      Candidate.Conversions[ArgIdx + 1].ConversionKind
         = ImplicitConversionSequence::EllipsisConversion;
     }
   }
@@ -2329,7 +2315,7 @@
 /// \brief Add a C++ member function template as a candidate to the candidate
 /// set, using template argument deduction to produce an appropriate member
 /// function template specialization.
-void 
+void
 Sema::AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl,
                                  bool HasExplicitTemplateArgs,
                                  const TemplateArgument *ExplicitTemplateArgs,
@@ -2339,9 +2325,9 @@
                                  bool SuppressUserConversions,
                                  bool ForceRValue) {
   // C++ [over.match.funcs]p7:
-  //   In each case where a candidate is a function template, candidate 
+  //   In each case where a candidate is a function template, candidate
   //   function template specializations are generated using template argument
-  //   deduction (14.8.3, 14.8.2). Those candidates are then handled as 
+  //   deduction (14.8.3, 14.8.2). Those candidates are then handled as
   //   candidate functions in the usual way.113) A given name can refer to one
   //   or more function templates and also to a set of overloaded non-template
   //   functions. In such a case, the candidate functions generated from each
@@ -2358,20 +2344,20 @@
         (void)Result;
         return;
       }
-  
+
   // Add the function template specialization produced by template argument
   // deduction as a candidate.
   assert(Specialization && "Missing member function template specialization?");
-  assert(isa<CXXMethodDecl>(Specialization) && 
+  assert(isa<CXXMethodDecl>(Specialization) &&
          "Specialization is not a member function?");
-  AddMethodCandidate(cast<CXXMethodDecl>(Specialization), Object, Args, NumArgs, 
+  AddMethodCandidate(cast<CXXMethodDecl>(Specialization), Object, Args, NumArgs,
                      CandidateSet, SuppressUserConversions, ForceRValue);
 }
 
 /// \brief Add a C++ function template specialization as a candidate
 /// in the candidate set, using template argument deduction to produce
 /// an appropriate function template specialization.
-void 
+void
 Sema::AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate,
                                    bool HasExplicitTemplateArgs,
                                  const TemplateArgument *ExplicitTemplateArgs,
@@ -2381,9 +2367,9 @@
                                    bool SuppressUserConversions,
                                    bool ForceRValue) {
   // C++ [over.match.funcs]p7:
-  //   In each case where a candidate is a function template, candidate 
+  //   In each case where a candidate is a function template, candidate
   //   function template specializations are generated using template argument
-  //   deduction (14.8.3, 14.8.2). Those candidates are then handled as 
+  //   deduction (14.8.3, 14.8.2). Those candidates are then handled as
   //   candidate functions in the usual way.113) A given name can refer to one
   //   or more function templates and also to a set of overloaded non-template
   //   functions. In such a case, the candidate functions generated from each
@@ -2400,18 +2386,18 @@
     (void)Result;
     return;
   }
-                            
+
   // Add the function template specialization produced by template argument
   // deduction as a candidate.
   assert(Specialization && "Missing function template specialization?");
   AddOverloadCandidate(Specialization, Args, NumArgs, CandidateSet,
                        SuppressUserConversions, ForceRValue);
 }
-  
+
 /// AddConversionCandidate - Add a C++ conversion function as a
-/// candidate in the candidate set (C++ [over.match.conv], 
+/// candidate in the candidate set (C++ [over.match.conv],
 /// C++ [over.match.copy]). From is the expression we're converting from,
-/// and ToType is the type that we're eventually trying to convert to 
+/// and ToType is the type that we're eventually trying to convert to
 /// (which may or may not be the same type as the type that the
 /// conversion function produces).
 void
@@ -2428,7 +2414,7 @@
   Candidate.IsSurrogate = false;
   Candidate.IgnoreObjectArgument = false;
   Candidate.FinalConversion.setAsIdentityConversion();
-  Candidate.FinalConversion.FromTypePtr 
+  Candidate.FinalConversion.FromTypePtr
     = Conversion->getConversionType().getAsOpaquePtr();
   Candidate.FinalConversion.ToTypePtr = ToType.getAsOpaquePtr();
 
@@ -2438,7 +2424,7 @@
   Candidate.Conversions.resize(1);
   Candidate.Conversions[0] = TryObjectArgumentInitialization(From, Conversion);
 
-  if (Candidate.Conversions[0].ConversionKind 
+  if (Candidate.Conversions[0].ConversionKind
       == ImplicitConversionSequence::BadConversion) {
     Candidate.Viable = false;
     return;
@@ -2452,24 +2438,24 @@
   // lvalues/rvalues and the type. Fortunately, we can allocate this
   // call on the stack and we don't need its arguments to be
   // well-formed.
-  DeclRefExpr ConversionRef(Conversion, Conversion->getType(), 
+  DeclRefExpr ConversionRef(Conversion, Conversion->getType(),
                             SourceLocation());
   ImplicitCastExpr ConversionFn(Context.getPointerType(Conversion->getType()),
                                 CastExpr::CK_Unknown,
                                 &ConversionRef, false);
-  
-  // Note that it is safe to allocate CallExpr on the stack here because 
+
+  // Note that it is safe to allocate CallExpr on the stack here because
   // there are 0 arguments (i.e., nothing is allocated using ASTContext's
   // allocator).
-  CallExpr Call(Context, &ConversionFn, 0, 0, 
+  CallExpr Call(Context, &ConversionFn, 0, 0,
                 Conversion->getConversionType().getNonReferenceType(),
                 SourceLocation());
-  ImplicitConversionSequence ICS = 
-    TryCopyInitialization(&Call, ToType, 
+  ImplicitConversionSequence ICS =
+    TryCopyInitialization(&Call, ToType,
                           /*SuppressUserConversions=*/true,
                           /*ForceRValue=*/false,
                           /*InOverloadResolution=*/false);
-  
+
   switch (ICS.ConversionKind) {
   case ImplicitConversionSequence::StandardConversion:
     Candidate.FinalConversion = ICS.Standard;
@@ -2480,7 +2466,7 @@
     break;
 
   default:
-    assert(false && 
+    assert(false &&
            "Can only end up with a standard conversion sequence or failure");
   }
 }
@@ -2490,7 +2476,7 @@
 /// to deduce the template arguments of the conversion function
 /// template from the type that we are converting to (C++
 /// [temp.deduct.conv]).
-void 
+void
 Sema::AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate,
                                      Expr *From, QualType ToType,
                                      OverloadCandidateSet &CandidateSet) {
@@ -2500,14 +2486,14 @@
   TemplateDeductionInfo Info(Context);
   CXXConversionDecl *Specialization = 0;
   if (TemplateDeductionResult Result
-        = DeduceTemplateArguments(FunctionTemplate, ToType, 
+        = DeduceTemplateArguments(FunctionTemplate, ToType,
                                   Specialization, Info)) {
     // FIXME: Record what happened with template argument deduction, so
     // that we can give the user a beautiful diagnostic.
     (void)Result;
     return;
   }
-                            
+
   // Add the conversion function template specialization produced by
   // template argument deduction as a candidate.
   assert(Specialization && "Missing function template specialization?");
@@ -2534,7 +2520,7 @@
 
   // Determine the implicit conversion sequence for the implicit
   // object parameter.
-  ImplicitConversionSequence ObjectInit 
+  ImplicitConversionSequence ObjectInit
     = TryObjectArgumentInitialization(Object, Conversion);
   if (ObjectInit.ConversionKind == ImplicitConversionSequence::BadConversion) {
     Candidate.Viable = false;
@@ -2544,15 +2530,15 @@
   // The first conversion is actually a user-defined conversion whose
   // first conversion is ObjectInit's standard conversion (which is
   // effectively a reference binding). Record it as such.
-  Candidate.Conversions[0].ConversionKind 
+  Candidate.Conversions[0].ConversionKind
     = ImplicitConversionSequence::UserDefinedConversion;
   Candidate.Conversions[0].UserDefined.Before = ObjectInit.Standard;
   Candidate.Conversions[0].UserDefined.ConversionFunction = Conversion;
-  Candidate.Conversions[0].UserDefined.After 
+  Candidate.Conversions[0].UserDefined.After
     = Candidate.Conversions[0].UserDefined.Before;
   Candidate.Conversions[0].UserDefined.After.setAsIdentityConversion();
 
-  // Find the 
+  // Find the
   unsigned NumArgsInProto = Proto->getNumArgs();
 
   // (C++ 13.3.2p2): A candidate function having fewer than m
@@ -2580,12 +2566,12 @@
       // (13.3.3.1) that converts that argument to the corresponding
       // parameter of F.
       QualType ParamType = Proto->getArgType(ArgIdx);
-      Candidate.Conversions[ArgIdx + 1] 
-        = TryCopyInitialization(Args[ArgIdx], ParamType, 
+      Candidate.Conversions[ArgIdx + 1]
+        = TryCopyInitialization(Args[ArgIdx], ParamType,
                                 /*SuppressUserConversions=*/false,
                                 /*ForceRValue=*/false,
                                 /*InOverloadResolution=*/false);
-      if (Candidate.Conversions[ArgIdx + 1].ConversionKind 
+      if (Candidate.Conversions[ArgIdx + 1].ConversionKind
             == ImplicitConversionSequence::BadConversion) {
         Candidate.Viable = false;
         break;
@@ -2594,7 +2580,7 @@
       // (C++ 13.3.2p2): For the purposes of overload resolution, any
       // argument for which there is no corresponding parameter is
       // considered to ""match the ellipsis" (C+ 13.3.3.1.3).
-      Candidate.Conversions[ArgIdx + 1].ConversionKind 
+      Candidate.Conversions[ArgIdx + 1].ConversionKind
         = ImplicitConversionSequence::EllipsisConversion;
     }
   }
@@ -2661,14 +2647,14 @@
     // Complete the type if it can be completed. Otherwise, we're done.
     if (RequireCompleteType(OpLoc, T1, PartialDiagnostic(0)))
       return;
-    
-    LookupResult Operators = LookupQualifiedName(T1Rec->getDecl(), OpName, 
+
+    LookupResult Operators = LookupQualifiedName(T1Rec->getDecl(), OpName,
                                                  LookupOrdinaryName, false);
-    for (LookupResult::iterator Oper = Operators.begin(), 
+    for (LookupResult::iterator Oper = Operators.begin(),
                              OperEnd = Operators.end();
          Oper != OperEnd;
          ++Oper)
-      AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Args[0], 
+      AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Args[0],
                          Args+1, NumArgs - 1, CandidateSet,
                          /*SuppressUserConversions=*/false);
   }
@@ -2682,7 +2668,7 @@
 /// operator. NumContextualBoolArguments is the number of arguments
 /// (at the beginning of the argument list) that will be contextually
 /// converted to bool.
-void Sema::AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys, 
+void Sema::AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys,
                                Expr **Args, unsigned NumArgs,
                                OverloadCandidateSet& CandidateSet,
                                bool IsAssignmentOperator,
@@ -2708,24 +2694,24 @@
     //     -- no temporaries are introduced to hold the left operand, and
     //     -- no user-defined conversions are applied to the left
     //        operand to achieve a type match with the left-most
-    //        parameter of a built-in candidate. 
+    //        parameter of a built-in candidate.
     //
     // We block these conversions by turning off user-defined
     // conversions, since that is the only way that initialization of
     // a reference to a non-class type can occur from something that
     // is not of the same type.
     if (ArgIdx < NumContextualBoolArguments) {
-      assert(ParamTys[ArgIdx] == Context.BoolTy && 
+      assert(ParamTys[ArgIdx] == Context.BoolTy &&
              "Contextual conversion to bool requires bool type");
       Candidate.Conversions[ArgIdx] = TryContextuallyConvertToBool(Args[ArgIdx]);
     } else {
-      Candidate.Conversions[ArgIdx] 
-        = TryCopyInitialization(Args[ArgIdx], ParamTys[ArgIdx], 
+      Candidate.Conversions[ArgIdx]
+        = TryCopyInitialization(Args[ArgIdx], ParamTys[ArgIdx],
                                 ArgIdx == 0 && IsAssignmentOperator,
                                 /*ForceRValue=*/false,
                                 /*InOverloadResolution=*/false);
     }
-    if (Candidate.Conversions[ArgIdx].ConversionKind 
+    if (Candidate.Conversions[ArgIdx].ConversionKind
         == ImplicitConversionSequence::BadConversion) {
       Candidate.Viable = false;
       break;
@@ -2756,7 +2742,7 @@
   /// Sema - The semantic analysis instance where we are building the
   /// candidate type set.
   Sema &SemaRef;
-  
+
   /// Context - The AST context in which we will build the type sets.
   ASTContext &Context;
 
@@ -2767,7 +2753,7 @@
   /// iterator - Iterates through the types that are part of the set.
   typedef TypeSet::iterator iterator;
 
-  BuiltinCandidateTypeSet(Sema &SemaRef) 
+  BuiltinCandidateTypeSet(Sema &SemaRef)
     : SemaRef(SemaRef), Context(SemaRef.Context) { }
 
   void AddTypesConvertedFrom(QualType Ty, bool AllowUserConversions,
@@ -2866,7 +2852,7 @@
 /// functions of a class type, and AllowExplicitConversions if we
 /// should also include the explicit conversion functions of a class
 /// type.
-void 
+void
 BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
                                                bool AllowUserConversions,
                                                bool AllowExplicitConversions) {
@@ -2891,7 +2877,7 @@
 
     // Add 'cv void*' to our set of types.
     if (!Ty->isVoidType()) {
-      QualType QualVoid 
+      QualType QualVoid
         = Context.VoidTy.getQualifiedType(PointeeTy.getCVRQualifiers());
       AddPointerWithMoreQualifiedTypeVariants(Context.getPointerType(QualVoid));
     }
@@ -2923,19 +2909,19 @@
         // No conversion functions in incomplete types.
         return;
       }
-      
+
       CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(TyRec->getDecl());
       // FIXME: Visit conversion functions in the base classes, too.
-      OverloadedFunctionDecl *Conversions 
+      OverloadedFunctionDecl *Conversions
         = ClassDecl->getConversionFunctions();
-      for (OverloadedFunctionDecl::function_iterator Func 
+      for (OverloadedFunctionDecl::function_iterator Func
              = Conversions->function_begin();
            Func != Conversions->function_end(); ++Func) {
         CXXConversionDecl *Conv;
         FunctionTemplateDecl *ConvTemplate;
         GetFunctionAndTemplate(*Func, Conv, ConvTemplate);
 
-        // Skip conversion function templates; they don't tell us anything 
+        // Skip conversion function templates; they don't tell us anything
         // about which builtin types we can convert to.
         if (ConvTemplate)
           continue;
@@ -2952,33 +2938,33 @@
 /// given type to the candidate set.
 static void AddBuiltinAssignmentOperatorCandidates(Sema &S,
                                                    QualType T,
-                                                   Expr **Args, 
+                                                   Expr **Args,
                                                    unsigned NumArgs,
                                     OverloadCandidateSet &CandidateSet) {
   QualType ParamTypes[2];
-  
+
   // T& operator=(T&, T)
   ParamTypes[0] = S.Context.getLValueReferenceType(T);
   ParamTypes[1] = T;
   S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2, CandidateSet,
                         /*IsAssignmentOperator=*/true);
-  
+
   if (!S.Context.getCanonicalType(T).isVolatileQualified()) {
     // volatile T& operator=(volatile T&, T)
     ParamTypes[0] = S.Context.getLValueReferenceType(T.withVolatile());
     ParamTypes[1] = T;
     S.AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 2, CandidateSet,
-                          /*IsAssignmentOperator=*/true);    
+                          /*IsAssignmentOperator=*/true);
   }
 }
-                                                   
+
 /// AddBuiltinOperatorCandidates - Add the appropriate built-in
 /// operator overloads to the candidate set (C++ [over.built]), based
 /// on the operator @p Op and the arguments given. For example, if the
 /// operator is a binary '+', this routine might add "int
 /// operator+(int, int)" to cover integer addition.
 void
-Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, 
+Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
                                    Expr **Args, unsigned NumArgs,
                                    OverloadCandidateSet& CandidateSet) {
   // The set of "promoted arithmetic types", which are the arithmetic
@@ -2988,14 +2974,14 @@
   // FIXME: What about complex?
   const unsigned FirstIntegralType = 0;
   const unsigned LastIntegralType = 13;
-  const unsigned FirstPromotedIntegralType = 7, 
+  const unsigned FirstPromotedIntegralType = 7,
                  LastPromotedIntegralType = 13;
   const unsigned FirstPromotedArithmeticType = 7,
                  LastPromotedArithmeticType = 16;
   const unsigned NumArithmeticTypes = 16;
   QualType ArithmeticTypes[NumArithmeticTypes] = {
-    Context.BoolTy, Context.CharTy, Context.WCharTy, 
-// FIXME:   Context.Char16Ty, Context.Char32Ty, 
+    Context.BoolTy, Context.CharTy, Context.WCharTy,
+// FIXME:   Context.Char16Ty, Context.Char32Ty,
     Context.SignedCharTy, Context.ShortTy,
     Context.UnsignedCharTy, Context.UnsignedShortTy,
     Context.IntTy, Context.LongTy, Context.LongLongTy,
@@ -3029,7 +3015,7 @@
     break;
 
   case OO_Star: // '*' is either unary or binary
-    if (NumArgs == 1) 
+    if (NumArgs == 1)
       goto UnaryStar;
     else
       goto BinaryStar;
@@ -3074,10 +3060,10 @@
     //
     //       VQ T&      operator--(VQ T&);
     //       T          operator--(VQ T&, int);
-    for (unsigned Arith = (Op == OO_PlusPlus? 0 : 1); 
+    for (unsigned Arith = (Op == OO_PlusPlus? 0 : 1);
          Arith < NumArithmeticTypes; ++Arith) {
       QualType ArithTy = ArithmeticTypes[Arith];
-      QualType ParamTypes[2] 
+      QualType ParamTypes[2]
         = { Context.getLValueReferenceType(ArithTy), Context.IntTy };
 
       // Non-volatile version.
@@ -3110,10 +3096,10 @@
       if (!(*Ptr)->getAs<PointerType>()->getPointeeType()->isObjectType())
         continue;
 
-      QualType ParamTypes[2] = { 
-        Context.getLValueReferenceType(*Ptr), Context.IntTy 
+      QualType ParamTypes[2] = {
+        Context.getLValueReferenceType(*Ptr), Context.IntTy
       };
-      
+
       // Without volatile
       if (NumArgs == 1)
         AddBuiltinCandidate(ParamTypes[0], ParamTypes, Args, 1, CandidateSet);
@@ -3146,7 +3132,7 @@
          Ptr != CandidateTypes.pointer_end(); ++Ptr) {
       QualType ParamTy = *Ptr;
       QualType PointeeTy = ParamTy->getAs<PointerType>()->getPointeeType();
-      AddBuiltinCandidate(Context.getLValueReferenceType(PointeeTy), 
+      AddBuiltinCandidate(Context.getLValueReferenceType(PointeeTy),
                           &ParamTy, Args, 1, CandidateSet);
     }
     break;
@@ -3162,7 +3148,7 @@
       QualType ParamTy = *Ptr;
       AddBuiltinCandidate(ParamTy, &ParamTy, Args, 1, CandidateSet);
     }
-    
+
     // Fall through
 
   UnaryMinus:
@@ -3172,7 +3158,7 @@
     //
     //       T         operator+(T);
     //       T         operator-(T);
-    for (unsigned Arith = FirstPromotedArithmeticType; 
+    for (unsigned Arith = FirstPromotedArithmeticType;
          Arith < LastPromotedArithmeticType; ++Arith) {
       QualType ArithTy = ArithmeticTypes[Arith];
       AddBuiltinCandidate(ArithTy, &ArithTy, Args, 1, CandidateSet);
@@ -3185,7 +3171,7 @@
     //   operator functions of the form
     //
     //        T         operator~(T);
-    for (unsigned Int = FirstPromotedIntegralType; 
+    for (unsigned Int = FirstPromotedIntegralType;
          Int < LastPromotedIntegralType; ++Int) {
       QualType IntTy = ArithmeticTypes[Int];
       AddBuiltinCandidate(IntTy, &IntTy, Args, 1, CandidateSet);
@@ -3211,12 +3197,12 @@
   case OO_EqualEqual:
   case OO_ExclaimEqual:
     // C++ [over.match.oper]p16:
-    //   For every pointer to member type T, there exist candidate operator 
-    //   functions of the form 
+    //   For every pointer to member type T, there exist candidate operator
+    //   functions of the form
     //
     //        bool operator==(T,T);
     //        bool operator!=(T,T);
-    for (BuiltinCandidateTypeSet::iterator 
+    for (BuiltinCandidateTypeSet::iterator
            MemPtr = CandidateTypes.member_pointer_begin(),
            MemPtrEnd = CandidateTypes.member_pointer_end();
          MemPtr != MemPtrEnd;
@@ -3224,9 +3210,9 @@
       QualType ParamTypes[2] = { *MemPtr, *MemPtr };
       AddBuiltinCandidate(Context.BoolTy, ParamTypes, Args, 2, CandidateSet);
     }
-      
+
     // Fall through
-      
+
   case OO_Less:
   case OO_Greater:
   case OO_LessEqual:
@@ -3235,7 +3221,7 @@
     //
     //   For every pointer or enumeration type T, there exist
     //   candidate operator functions of the form
-    //     
+    //
     //        bool       operator<(T, T);
     //        bool       operator>(T, T);
     //        bool       operator<=(T, T);
@@ -3247,7 +3233,7 @@
       QualType ParamTypes[2] = { *Ptr, *Ptr };
       AddBuiltinCandidate(Context.BoolTy, ParamTypes, Args, 2, CandidateSet);
     }
-    for (BuiltinCandidateTypeSet::iterator Enum 
+    for (BuiltinCandidateTypeSet::iterator Enum
            = CandidateTypes.enumeration_begin();
          Enum != CandidateTypes.enumeration_end(); ++Enum) {
       QualType ParamTypes[2] = { *Enum, *Enum };
@@ -3266,7 +3252,7 @@
       //
       //   For every cv-qualified or cv-unqualified object type T
       //   there exist candidate operator functions of the form
-      //    
+      //
       //      T*         operator+(T*, ptrdiff_t);
       //      T&         operator[](T*, ptrdiff_t);    [BELOW]
       //      T*         operator-(T*, ptrdiff_t);
@@ -3279,7 +3265,7 @@
       //   exist candidate operator functions of the form
       //
       //      ptrdiff_t  operator-(T, T);
-      for (BuiltinCandidateTypeSet::iterator Ptr 
+      for (BuiltinCandidateTypeSet::iterator Ptr
              = CandidateTypes.pointer_begin();
            Ptr != CandidateTypes.pointer_end(); ++Ptr) {
         QualType ParamTypes[2] = { *Ptr, Context.getPointerDiffType() };
@@ -3334,9 +3320,9 @@
     //   where LR is the result of the usual arithmetic conversions
     //   between types L and R.
     // Our candidates ignore the first parameter.
-    for (unsigned Left = FirstPromotedArithmeticType; 
+    for (unsigned Left = FirstPromotedArithmeticType;
          Left < LastPromotedArithmeticType; ++Left) {
-      for (unsigned Right = FirstPromotedArithmeticType; 
+      for (unsigned Right = FirstPromotedArithmeticType;
            Right < LastPromotedArithmeticType; ++Right) {
         QualType LandR[2] = { ArithmeticTypes[Left], ArithmeticTypes[Right] };
         QualType Result
@@ -3368,9 +3354,9 @@
     //
     //   where LR is the result of the usual arithmetic conversions
     //   between types L and R.
-    for (unsigned Left = FirstPromotedIntegralType; 
+    for (unsigned Left = FirstPromotedIntegralType;
          Left < LastPromotedIntegralType; ++Left) {
-      for (unsigned Right = FirstPromotedIntegralType; 
+      for (unsigned Right = FirstPromotedIntegralType;
            Right < LastPromotedIntegralType; ++Right) {
         QualType LandR[2] = { ArithmeticTypes[Left], ArithmeticTypes[Right] };
         QualType Result = (Op == OO_LessLess || Op == OO_GreaterGreater)
@@ -3393,13 +3379,13 @@
            Enum = CandidateTypes.enumeration_begin(),
            EnumEnd = CandidateTypes.enumeration_end();
          Enum != EnumEnd; ++Enum)
-      AddBuiltinAssignmentOperatorCandidates(*this, *Enum, Args, 2, 
+      AddBuiltinAssignmentOperatorCandidates(*this, *Enum, Args, 2,
                                              CandidateSet);
     for (BuiltinCandidateTypeSet::iterator
            MemPtr = CandidateTypes.member_pointer_begin(),
          MemPtrEnd = CandidateTypes.member_pointer_end();
          MemPtr != MemPtrEnd; ++MemPtr)
-      AddBuiltinAssignmentOperatorCandidates(*this, *MemPtr, Args, 2, 
+      AddBuiltinAssignmentOperatorCandidates(*this, *MemPtr, Args, 2,
                                              CandidateSet);
       // Fall through.
 
@@ -3455,7 +3441,7 @@
     //        VQ L&      operator+=(VQ L&, R);
     //        VQ L&      operator-=(VQ L&, R);
     for (unsigned Left = 0; Left < NumArithmeticTypes; ++Left) {
-      for (unsigned Right = FirstPromotedArithmeticType; 
+      for (unsigned Right = FirstPromotedArithmeticType;
            Right < LastPromotedArithmeticType; ++Right) {
         QualType ParamTypes[2];
         ParamTypes[1] = ArithmeticTypes[Right];
@@ -3493,7 +3479,7 @@
     //        VQ L&       operator^=(VQ L&, R);
     //        VQ L&       operator|=(VQ L&, R);
     for (unsigned Left = FirstIntegralType; Left < LastIntegralType; ++Left) {
-      for (unsigned Right = FirstPromotedIntegralType; 
+      for (unsigned Right = FirstPromotedIntegralType;
            Right < LastPromotedIntegralType; ++Right) {
         QualType ParamTypes[2];
         ParamTypes[1] = ArithmeticTypes[Right];
@@ -3516,7 +3502,7 @@
     //
     //   There also exist candidate operator functions of the form
     //
-    //        bool        operator!(bool);            
+    //        bool        operator!(bool);
     //        bool        operator&&(bool, bool);     [BELOW]
     //        bool        operator||(bool, bool);     [BELOW]
     QualType ParamTy = Context.BoolTy;
@@ -3547,7 +3533,7 @@
     //
     //   For every cv-qualified or cv-unqualified object type T there
     //   exist candidate operator functions of the form
-    //    
+    //
     //        T*         operator+(T*, ptrdiff_t);     [ABOVE]
     //        T&         operator[](T*, ptrdiff_t);
     //        T*         operator-(T*, ptrdiff_t);     [ABOVE]
@@ -3606,7 +3592,7 @@
 /// given function name (which may also be an operator name) and adds
 /// all of the overload candidates found by ADL to the overload
 /// candidate set (C++ [basic.lookup.argdep]).
-void 
+void
 Sema::AddArgumentDependentLookupCandidates(DeclarationName Name,
                                            Expr **Args, unsigned NumArgs,
                                            OverloadCandidateSet& CandidateSet) {
@@ -3645,7 +3631,7 @@
     if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*Func))
       AddOverloadCandidate(FD, Args, NumArgs, CandidateSet);
     else
-      AddTemplateOverloadCandidate(cast<FunctionTemplateDecl>(*Func),  
+      AddTemplateOverloadCandidate(cast<FunctionTemplateDecl>(*Func),
                                    /*FIXME: explicit args */false, 0, 0,
                                    Args, NumArgs, CandidateSet);
   }
@@ -3653,10 +3639,9 @@
 
 /// isBetterOverloadCandidate - Determines whether the first overload
 /// candidate is a better candidate than the second (C++ 13.3.3p1).
-bool 
+bool
 Sema::isBetterOverloadCandidate(const OverloadCandidate& Cand1,
-                                const OverloadCandidate& Cand2)
-{
+                                const OverloadCandidate& Cand2) {
   // Define viable functions to be better candidates than non-viable
   // functions.
   if (!Cand2.Viable)
@@ -3675,8 +3660,8 @@
     StartArg = 1;
 
   // C++ [over.match.best]p1:
-  //   A viable function F1 is defined to be a better function than another 
-  //   viable function F2 if for all arguments i, ICSi(F1) is not a worse 
+  //   A viable function F1 is defined to be a better function than another
+  //   viable function F2 if for all arguments i, ICSi(F1) is not a worse
   //   conversion sequence than ICSi(F2), and then...
   unsigned NumArgs = Cand1.Conversions.size();
   assert(Cand2.Conversions.size() == NumArgs && "Overload candidate mismatch");
@@ -3699,20 +3684,20 @@
     }
   }
 
-  //    -- for some argument j, ICSj(F1) is a better conversion sequence than 
+  //    -- for some argument j, ICSj(F1) is a better conversion sequence than
   //       ICSj(F2), or, if not that,
   if (HasBetterConversion)
     return true;
 
-  //     - F1 is a non-template function and F2 is a function template 
+  //     - F1 is a non-template function and F2 is a function template
   //       specialization, or, if not that,
   if (Cand1.Function && !Cand1.Function->getPrimaryTemplate() &&
       Cand2.Function && Cand2.Function->getPrimaryTemplate())
     return true;
-  
-  //   -- F1 and F2 are function template specializations, and the function 
-  //      template for F1 is more specialized than the template for F2 
-  //      according to the partial ordering rules described in 14.5.5.2, or, 
+
+  //   -- F1 and F2 are function template specializations, and the function
+  //      template for F1 is more specialized than the template for F2
+  //      according to the partial ordering rules described in 14.5.5.2, or,
   //      if not that,
   if (Cand1.Function && Cand1.Function->getPrimaryTemplate() &&
       Cand2.Function && Cand2.Function->getPrimaryTemplate())
@@ -3728,8 +3713,8 @@
   //      the type of the entity being initialized) is a better
   //      conversion sequence than the standard conversion sequence
   //      from the return type of F2 to the destination type.
-  if (Cand1.Function && Cand2.Function && 
-      isa<CXXConversionDecl>(Cand1.Function) && 
+  if (Cand1.Function && Cand2.Function &&
+      isa<CXXConversionDecl>(Cand1.Function) &&
       isa<CXXConversionDecl>(Cand2.Function)) {
     switch (CompareStandardConversionSequences(Cand1.FinalConversion,
                                                Cand2.FinalConversion)) {
@@ -3750,7 +3735,7 @@
   return false;
 }
 
-/// \brief Computes the best viable function (C++ 13.3.3) 
+/// \brief Computes the best viable function (C++ 13.3.3)
 /// within an overload candidate set.
 ///
 /// \param CandidateSet the set of candidate functions.
@@ -3758,15 +3743,14 @@
 /// \param Loc the location of the function name (or operator symbol) for
 /// which overload resolution occurs.
 ///
-/// \param Best f overload resolution was successful or found a deleted 
+/// \param Best f overload resolution was successful or found a deleted
 /// function, Best points to the candidate function found.
 ///
 /// \returns The result of overload resolution.
-Sema::OverloadingResult 
+Sema::OverloadingResult
 Sema::BestViableFunction(OverloadCandidateSet& CandidateSet,
                          SourceLocation Loc,
-                         OverloadCandidateSet::iterator& Best)
-{
+                         OverloadCandidateSet::iterator& Best) {
   // Find the best viable function.
   Best = CandidateSet.end();
   for (OverloadCandidateSet::iterator Cand = CandidateSet.begin();
@@ -3785,24 +3769,24 @@
   // function. If not, we have an ambiguity.
   for (OverloadCandidateSet::iterator Cand = CandidateSet.begin();
        Cand != CandidateSet.end(); ++Cand) {
-    if (Cand->Viable && 
+    if (Cand->Viable &&
         Cand != Best &&
         !isBetterOverloadCandidate(*Best, *Cand)) {
       Best = CandidateSet.end();
       return OR_Ambiguous;
     }
   }
-  
+
   // Best is the best viable function.
   if (Best->Function &&
-      (Best->Function->isDeleted() || 
+      (Best->Function->isDeleted() ||
        Best->Function->getAttr<UnavailableAttr>()))
     return OR_Deleted;
 
   // C++ [basic.def.odr]p2:
   //   An overloaded function is used if it is selected by overload resolution
-  //   when referred to from a potentially-evaluated expression. [Note: this 
-  //   covers calls to named functions (5.2.2), operator overloading 
+  //   when referred to from a potentially-evaluated expression. [Note: this
+  //   covers calls to named functions (5.2.2), operator overloading
   //   (clause 13), user-defined conversions (12.3.2), allocation function for
   //   placement new (5.3.4), as well as non-default initialization (8.5).
   if (Best->Function)
@@ -3813,10 +3797,9 @@
 /// PrintOverloadCandidates - When overload resolution fails, prints
 /// diagnostic messages containing the candidates in the candidate
 /// set. If OnlyViable is true, only viable candidates will be printed.
-void 
+void
 Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
-                              bool OnlyViable)
-{
+                              bool OnlyViable) {
   OverloadCandidateSet::iterator Cand = CandidateSet.begin(),
                              LastCand = CandidateSet.end();
   for (; Cand != LastCand; ++Cand) {
@@ -3866,7 +3849,7 @@
         // FIXME: We need to get the identifier in here
         // FIXME: Do we want the error message to point at the operator?
         // (built-ins won't have a location)
-        QualType FnType 
+        QualType FnType
           = Context.getFunctionType(Cand->BuiltinTypes.ResultTy,
                                     Cand->BuiltinTypes.ParamTypes,
                                     Cand->Conversions.size(),
@@ -3886,7 +3869,7 @@
 /// @code
 /// int f(double);
 /// int f(int);
-///                          
+///
 /// int (*pfd)(double) = f; // selects f(double)
 /// @endcode
 ///
@@ -3915,7 +3898,7 @@
 
   // Find the actual overloaded function declaration.
   OverloadedFunctionDecl *Ovl = 0;
-  
+
   // C++ [over.over]p1:
   //   [...] [Note: any redundant set of parentheses surrounding the
   //   overloaded function name is ignored (5.1). ]
@@ -3936,21 +3919,21 @@
     FunctionTemplate = dyn_cast<FunctionTemplateDecl>(DR->getDecl());
   }
 
-  // If there's no overloaded function declaration or function template, 
+  // If there's no overloaded function declaration or function template,
   // we're done.
   if (!Ovl && !FunctionTemplate)
     return 0;
- 
+
   OverloadIterator Fun;
   if (Ovl)
     Fun = Ovl;
   else
     Fun = FunctionTemplate;
-  
+
   // Look through all of the overloaded functions, searching for one
   // whose type matches exactly.
   llvm::SmallPtrSet<FunctionDecl *, 4> Matches;
-  
+
   bool FoundNonTemplateFunction = false;
   for (OverloadIterator FunEnd; Fun != FunEnd; ++Fun) {
     // C++ [over.over]p3:
@@ -3960,22 +3943,22 @@
     //   type "pointer-to-member-function."
     // Note that according to DR 247, the containing class does not matter.
 
-    if (FunctionTemplateDecl *FunctionTemplate 
+    if (FunctionTemplateDecl *FunctionTemplate
           = dyn_cast<FunctionTemplateDecl>(*Fun)) {
-      if (CXXMethodDecl *Method 
+      if (CXXMethodDecl *Method
             = dyn_cast<CXXMethodDecl>(FunctionTemplate->getTemplatedDecl())) {
-        // Skip non-static function templates when converting to pointer, and 
+        // Skip non-static function templates when converting to pointer, and
         // static when converting to member pointer.
         if (Method->isStatic() == IsMember)
           continue;
       } else if (IsMember)
         continue;
-      
+
       // C++ [over.over]p2:
-      //   If the name is a function template, template argument deduction is 
-      //   done (14.8.2.2), and if the argument deduction succeeds, the 
-      //   resulting template argument list is used to generate a single 
-      //   function template specialization, which is added to the set of 
+      //   If the name is a function template, template argument deduction is
+      //   done (14.8.2.2), and if the argument deduction succeeds, the
+      //   resulting template argument list is used to generate a single
+      //   function template specialization, which is added to the set of
       //   overloaded functions considered.
       FunctionDecl *Specialization = 0;
       TemplateDeductionInfo Info(Context);
@@ -3986,13 +3969,13 @@
         // FIXME: make a note of the failed deduction for diagnostics.
         (void)Result;
       } else {
-        assert(FunctionType 
+        assert(FunctionType
                  == Context.getCanonicalType(Specialization->getType()));
         Matches.insert(
                 cast<FunctionDecl>(Specialization->getCanonicalDecl()));
       }
     }
-    
+
     if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(*Fun)) {
       // Skip non-static functions when converting to pointer, and static
       // when converting to member pointer.
@@ -4006,7 +3989,7 @@
         Matches.insert(cast<FunctionDecl>(Fun->getCanonicalDecl()));
         FoundNonTemplateFunction = true;
       }
-    } 
+    }
   }
 
   // If there were 0 or 1 matches, we're done.
@@ -4042,7 +4025,7 @@
     for (++M; M != MEnd; ++M)
       if (getMoreSpecializedTemplate((*M)->getPrimaryTemplate(),
                                      (*Best)->getPrimaryTemplate(),
-                                     false) 
+                                     false)
             == (*M)->getPrimaryTemplate())
         Best = M;
 
@@ -4074,12 +4057,12 @@
     // candidates output later.
      RemainingMatches.append(Matches.begin(), Matches.end());
   }
-  
-  // [...] After such eliminations, if any, there shall remain exactly one 
+
+  // [...] After such eliminations, if any, there shall remain exactly one
   // selected function.
   if (RemainingMatches.size() == 1)
     return RemainingMatches.front();
-  
+
   // FIXME: We should probably return the same thing that BestViableFunction
   // returns (even if we issue the diagnostics here).
   Diag(From->getLocStart(), diag::err_addr_ovl_ambiguous)
@@ -4103,7 +4086,7 @@
                                             unsigned NumExplicitTemplateArgs,
                                             SourceLocation LParenLoc,
                                             Expr **Args, unsigned NumArgs,
-                                            SourceLocation *CommaLocs, 
+                                            SourceLocation *CommaLocs,
                                             SourceLocation RParenLoc,
                                             bool &ArgumentDependentLookup) {
   OverloadCandidateSet CandidateSet;
@@ -4117,16 +4100,16 @@
   //   and let Y be the lookup set produced by argument dependent
   //   lookup (defined as follows). If X contains
   //
-  //     -- a declaration of a class member, or 
+  //     -- a declaration of a class member, or
   //
   //     -- a block-scope function declaration that is not a
-  //        using-declaration, or 
-  // 
+  //        using-declaration, or
+  //
   //     -- a declaration that is neither a function or a function
   //        template
   //
-  //   then Y is empty. 
-  if (OverloadedFunctionDecl *Ovl 
+  //   then Y is empty.
+  if (OverloadedFunctionDecl *Ovl
         = dyn_cast_or_null<OverloadedFunctionDecl>(Callee)) {
     for (OverloadedFunctionDecl::function_iterator Func = Ovl->function_begin(),
                                                 FuncEnd = Ovl->function_end();
@@ -4135,7 +4118,7 @@
       if (FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(*Func)) {
         if (HasExplicitTemplateArgs)
           continue;
-        
+
         AddOverloadCandidate(FunDecl, Args, NumArgs, CandidateSet);
         Ctx = FunDecl->getDeclContext();
       } else {
@@ -4158,11 +4141,11 @@
     if (Func->getDeclContext()->isRecord() ||
         Func->getDeclContext()->isFunctionOrMethod())
       ArgumentDependentLookup = false;
-  } else if (FunctionTemplateDecl *FuncTemplate 
+  } else if (FunctionTemplateDecl *FuncTemplate
                = dyn_cast_or_null<FunctionTemplateDecl>(Callee)) {
     AddTemplateOverloadCandidate(FuncTemplate, HasExplicitTemplateArgs,
                                  ExplicitTemplateArgs,
-                                 NumExplicitTemplateArgs, 
+                                 NumExplicitTemplateArgs,
                                  Args, NumArgs, CandidateSet);
 
     if (FuncTemplate->getDeclContext()->isRecord())
@@ -4231,7 +4214,7 @@
 Sema::OwningExprResult Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc,
                                                      unsigned OpcIn,
                                                      FunctionSet &Functions,
-                                                     ExprArg input) {  
+                                                     ExprArg input) {
   UnaryOperator::Opcode Opc = static_cast<UnaryOperator::Opcode>(OpcIn);
   Expr *Input = (Expr *)input.get();
 
@@ -4241,28 +4224,28 @@
 
   Expr *Args[2] = { Input, 0 };
   unsigned NumArgs = 1;
-    
+
   // For post-increment and post-decrement, add the implicit '0' as
   // the second argument, so that we know this is a post-increment or
   // post-decrement.
   if (Opc == UnaryOperator::PostInc || Opc == UnaryOperator::PostDec) {
     llvm::APSInt Zero(Context.getTypeSize(Context.IntTy), false);
-    Args[1] = new (Context) IntegerLiteral(Zero, Context.IntTy, 
+    Args[1] = new (Context) IntegerLiteral(Zero, Context.IntTy,
                                            SourceLocation());
     NumArgs = 2;
   }
 
   if (Input->isTypeDependent()) {
-    OverloadedFunctionDecl *Overloads 
+    OverloadedFunctionDecl *Overloads
       = OverloadedFunctionDecl::Create(Context, CurContext, OpName);
-    for (FunctionSet::iterator Func = Functions.begin(), 
+    for (FunctionSet::iterator Func = Functions.begin(),
                             FuncEnd = Functions.end();
          Func != FuncEnd; ++Func)
       Overloads->addOverload(*Func);
 
     DeclRefExpr *Fn = new (Context) DeclRefExpr(Overloads, Context.OverloadTy,
                                                 OpLoc, false, false);
-    
+
     input.release();
     return Owned(new (Context) CXXOperatorCallExpr(Context, Op, Fn,
                                                    &Args[0], NumArgs,
@@ -4288,11 +4271,11 @@
   case OR_Success: {
     // We found a built-in operator or an overloaded operator.
     FunctionDecl *FnDecl = Best->Function;
-    
+
     if (FnDecl) {
       // We matched an overloaded operator. Build a call to that
       // operator.
-      
+
       // Convert the arguments.
       if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
         if (PerformObjectArgumentInitialization(Input, Method))
@@ -4309,15 +4292,15 @@
       QualType ResultTy
         = FnDecl->getType()->getAsFunctionType()->getResultType();
       ResultTy = ResultTy.getNonReferenceType();
-      
+
       // Build the actual expression node.
       Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(),
                                                SourceLocation());
       UsualUnaryConversions(FnExpr);
-      
+
       input.release();
-      
-      Expr *CE = new (Context) CXXOperatorCallExpr(Context, Op, FnExpr, 
+
+      Expr *CE = new (Context) CXXOperatorCallExpr(Context, Op, FnExpr,
                                                    &Input, 1, ResultTy, OpLoc);
       return MaybeBindToTemporary(CE);
     } else {
@@ -4377,9 +4360,9 @@
 ///
 /// \param LHS Left-hand argument.
 /// \param RHS Right-hand argument.
-Sema::OwningExprResult 
+Sema::OwningExprResult
 Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
-                            unsigned OpcIn, 
+                            unsigned OpcIn,
                             FunctionSet &Functions,
                             Expr *LHS, Expr *RHS) {
   Expr *Args[2] = { LHS, RHS };
@@ -4397,18 +4380,18 @@
       return Owned(new (Context) BinaryOperator(Args[0], Args[1], Opc,
                                                 Context.DependentTy, OpLoc));
 
-    OverloadedFunctionDecl *Overloads 
+    OverloadedFunctionDecl *Overloads
       = OverloadedFunctionDecl::Create(Context, CurContext, OpName);
-    for (FunctionSet::iterator Func = Functions.begin(), 
+    for (FunctionSet::iterator Func = Functions.begin(),
                             FuncEnd = Functions.end();
          Func != FuncEnd; ++Func)
       Overloads->addOverload(*Func);
 
     DeclRefExpr *Fn = new (Context) DeclRefExpr(Overloads, Context.OverloadTy,
                                                 OpLoc, false, false);
-    
+
     return Owned(new (Context) CXXOperatorCallExpr(Context, Op, Fn,
-                                                   Args, 2, 
+                                                   Args, 2,
                                                    Context.DependentTy,
                                                    OpLoc));
   }
@@ -4473,7 +4456,7 @@
                                                  OpLoc);
         UsualUnaryConversions(FnExpr);
 
-        Expr *CE = new (Context) CXXOperatorCallExpr(Context, Op, FnExpr, 
+        Expr *CE = new (Context) CXXOperatorCallExpr(Context, Op, FnExpr,
                                                      Args, 2, ResultTy, OpLoc);
         return MaybeBindToTemporary(CE);
       } else {
@@ -4534,8 +4517,8 @@
 /// expression refers to a member function or an overloaded member
 /// function.
 Sema::ExprResult
-Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, 
-                                SourceLocation LParenLoc, Expr **Args, 
+Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
+                                SourceLocation LParenLoc, Expr **Args,
                                 unsigned NumArgs, SourceLocation *CommaLocs,
                                 SourceLocation RParenLoc) {
   // Dig out the member expression. This holds both the object
@@ -4556,11 +4539,11 @@
     // Add overload candidates
     OverloadCandidateSet CandidateSet;
     DeclarationName DeclName = MemExpr->getMemberDecl()->getDeclName();
-    
+
     for (OverloadIterator Func(MemExpr->getMemberDecl()), FuncEnd;
          Func != FuncEnd; ++Func) {
       if ((Method = dyn_cast<CXXMethodDecl>(*Func)))
-        AddMethodCandidate(Method, ObjectArg, Args, NumArgs, CandidateSet, 
+        AddMethodCandidate(Method, ObjectArg, Args, NumArgs, CandidateSet,
                            /*SuppressUserConversions=*/false);
       else
         AddMethodTemplateCandidate(cast<FunctionTemplateDecl>(*Func),
@@ -4571,7 +4554,7 @@
                                    CandidateSet,
                                    /*SuppressUsedConversions=*/false);
     }
-      
+
     OverloadCandidateSet::iterator Best;
     switch (BestViableFunction(CandidateSet, MemExpr->getLocStart(), Best)) {
     case OR_Success:
@@ -4579,7 +4562,7 @@
       break;
 
     case OR_No_Viable_Function:
-      Diag(MemExpr->getSourceRange().getBegin(), 
+      Diag(MemExpr->getSourceRange().getBegin(),
            diag::err_ovl_no_viable_member_function_in_call)
         << DeclName << MemExprE->getSourceRange();
       PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
@@ -4587,7 +4570,7 @@
       return true;
 
     case OR_Ambiguous:
-      Diag(MemExpr->getSourceRange().getBegin(), 
+      Diag(MemExpr->getSourceRange().getBegin(),
            diag::err_ovl_ambiguous_member_call)
         << DeclName << MemExprE->getSourceRange();
       PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
@@ -4595,7 +4578,7 @@
       return true;
 
     case OR_Deleted:
-      Diag(MemExpr->getSourceRange().getBegin(), 
+      Diag(MemExpr->getSourceRange().getBegin(),
            diag::err_ovl_deleted_member_call)
         << Best->Function->isDeleted()
         << DeclName << MemExprE->getSourceRange();
@@ -4610,21 +4593,21 @@
   }
 
   assert(Method && "Member call to something that isn't a method?");
-  ExprOwningPtr<CXXMemberCallExpr> 
+  ExprOwningPtr<CXXMemberCallExpr>
     TheCall(this, new (Context) CXXMemberCallExpr(Context, MemExpr, Args,
-                                                  NumArgs, 
+                                                  NumArgs,
                                   Method->getResultType().getNonReferenceType(),
                                   RParenLoc));
 
   // Convert the object argument (for a non-static member function call).
-  if (!Method->isStatic() && 
+  if (!Method->isStatic() &&
       PerformObjectArgumentInitialization(ObjectArg, Method))
     return true;
   MemExpr->setBase(ObjectArg);
 
   // Convert the rest of the arguments
   const FunctionProtoType *Proto = cast<FunctionProtoType>(Method->getType());
-  if (ConvertArgumentsForCall(&*TheCall, MemExpr, Method, Proto, Args, NumArgs, 
+  if (ConvertArgumentsForCall(&*TheCall, MemExpr, Method, Proto, Args, NumArgs,
                               RParenLoc))
     return true;
 
@@ -4638,15 +4621,15 @@
 /// type (C++ [over.call.object]), which can end up invoking an
 /// overloaded function call operator (@c operator()) or performing a
 /// user-defined conversion on the object argument.
-Sema::ExprResult 
-Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object, 
+Sema::ExprResult
+Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
                                    SourceLocation LParenLoc,
                                    Expr **Args, unsigned NumArgs,
-                                   SourceLocation *CommaLocs, 
+                                   SourceLocation *CommaLocs,
                                    SourceLocation RParenLoc) {
   assert(Object->getType()->isRecordType() && "Requires object type argument");
   const RecordType *Record = Object->getType()->getAs<RecordType>();
-  
+
   // C++ [over.call.object]p1:
   //  If the primary-expression E in the function call syntax
   //  evaluates to a class object of type "cv T", then the set of
@@ -4659,7 +4642,7 @@
   DeclContext::lookup_const_iterator Oper, OperEnd;
   for (llvm::tie(Oper, OperEnd) = Record->getDecl()->lookup(OpName);
        Oper != OperEnd; ++Oper)
-    AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Object, Args, NumArgs, 
+    AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Object, Args, NumArgs,
                        CandidateSet, /*SuppressUserConversions=*/false);
 
   // C++ [over.call.object]p2:
@@ -4679,12 +4662,12 @@
   //   functions for each conversion function declared in an
   //   accessible base class provided the function is not hidden
   //   within T by another intervening declaration.
-  
+
   if (!RequireCompleteType(SourceLocation(), Object->getType(), 0)) {
     // FIXME: Look in base classes for more conversion operators!
-    OverloadedFunctionDecl *Conversions 
+    OverloadedFunctionDecl *Conversions
       = cast<CXXRecordDecl>(Record->getDecl())->getConversionFunctions();
-    for (OverloadedFunctionDecl::function_iterator 
+    for (OverloadedFunctionDecl::function_iterator
            Func = Conversions->function_begin(),
            FuncEnd = Conversions->function_end();
          Func != FuncEnd; ++Func) {
@@ -4707,7 +4690,7 @@
         AddSurrogateCandidate(Conv, Proto, Object, Args, NumArgs, CandidateSet);
     }
   }
-  
+
   // Perform overload resolution.
   OverloadCandidateSet::iterator Best;
   switch (BestViableFunction(CandidateSet, Object->getLocStart(), Best)) {
@@ -4717,7 +4700,7 @@
     break;
 
   case OR_No_Viable_Function:
-    Diag(Object->getSourceRange().getBegin(), 
+    Diag(Object->getSourceRange().getBegin(),
          diag::err_ovl_no_viable_object_call)
       << Object->getType() << Object->getSourceRange();
     PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
@@ -4737,7 +4720,7 @@
       << Object->getType() << Object->getSourceRange();
     PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
     break;
-  }    
+  }
 
   if (Best == CandidateSet.end()) {
     // We had an error; delete all of the subexpressions and return
@@ -4751,7 +4734,7 @@
   if (Best->Function == 0) {
     // Since there is no function declaration, this is one of the
     // surrogate candidates. Dig out the conversion function.
-    CXXConversionDecl *Conv 
+    CXXConversionDecl *Conv
       = cast<CXXConversionDecl>(
                          Best->Conversions[0].UserDefined.ConversionFunction);
 
@@ -4790,16 +4773,16 @@
   MethodArgs[0] = Object;
   for (unsigned ArgIdx = 0; ArgIdx < NumArgs; ++ArgIdx)
     MethodArgs[ArgIdx + 1] = Args[ArgIdx];
-      
-  Expr *NewFn = new (Context) DeclRefExpr(Method, Method->getType(), 
+
+  Expr *NewFn = new (Context) DeclRefExpr(Method, Method->getType(),
                                           SourceLocation());
   UsualUnaryConversions(NewFn);
 
   // Once we've built TheCall, all of the expressions are properly
   // owned.
   QualType ResultTy = Method->getResultType().getNonReferenceType();
-  ExprOwningPtr<CXXOperatorCallExpr> 
-    TheCall(this, new (Context) CXXOperatorCallExpr(Context, OO_Call, NewFn, 
+  ExprOwningPtr<CXXOperatorCallExpr>
+    TheCall(this, new (Context) CXXOperatorCallExpr(Context, OO_Call, NewFn,
                                                     MethodArgs, NumArgs + 1,
                                                     ResultTy, RParenLoc));
   delete [] MethodArgs;
@@ -4823,7 +4806,7 @@
     Expr *Arg;
     if (i < NumArgs) {
       Arg = Args[i];
-      
+
       // Pass the argument.
       QualType ProtoArgType = Proto->getArgType(i);
       IsError |= PerformCopyInitialization(Arg, ProtoArgType, "passing");
@@ -4853,13 +4836,13 @@
 }
 
 /// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator->
-///  (if one exists), where @c Base is an expression of class type and 
+///  (if one exists), where @c Base is an expression of class type and
 /// @c Member is the name of the member we're trying to find.
 Sema::OwningExprResult
 Sema::BuildOverloadedArrowExpr(Scope *S, ExprArg BaseIn, SourceLocation OpLoc) {
   Expr *Base = static_cast<Expr *>(BaseIn.get());
   assert(Base->getType()->isRecordType() && "left-hand side must have class type");
-  
+
   // C++ [over.ref]p1:
   //
   //   [...] An expression x->m is interpreted as (x.operator->())->m
@@ -4872,7 +4855,7 @@
   const RecordType *BaseRecord = Base->getType()->getAs<RecordType>();
 
   DeclContext::lookup_const_iterator Oper, OperEnd;
-  for (llvm::tie(Oper, OperEnd) 
+  for (llvm::tie(Oper, OperEnd)
          = BaseRecord->getDecl()->lookup(OpName); Oper != OperEnd; ++Oper)
     AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Base, 0, 0, CandidateSet,
                        /*SuppressUserConversions=*/false);
@@ -4920,7 +4903,7 @@
   Expr *FnExpr = new (Context) DeclRefExpr(Method, Method->getType(),
                                            SourceLocation());
   UsualUnaryConversions(FnExpr);
-  Base = new (Context) CXXOperatorCallExpr(Context, OO_Arrow, FnExpr, &Base, 1, 
+  Base = new (Context) CXXOperatorCallExpr(Context, OO_Arrow, FnExpr, &Base, 1,
                                  Method->getResultType().getNonReferenceType(),
                                  OpLoc);
   return Owned(Base);
@@ -4936,13 +4919,13 @@
     FixOverloadedFunctionReference(PE->getSubExpr(), Fn);
     E->setType(PE->getSubExpr()->getType());
   } else if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(E)) {
-    assert(UnOp->getOpcode() == UnaryOperator::AddrOf && 
+    assert(UnOp->getOpcode() == UnaryOperator::AddrOf &&
            "Can only take the address of an overloaded function");
     if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Fn)) {
       if (Method->isStatic()) {
         // Do nothing: static member functions aren't any different
         // from non-member functions.
-      } else if (QualifiedDeclRefExpr *DRE 
+      } else if (QualifiedDeclRefExpr *DRE
                  = dyn_cast<QualifiedDeclRefExpr>(UnOp->getSubExpr())) {
         // We have taken the address of a pointer to member
         // function. Perform the computation here so that we get the
@@ -4951,7 +4934,7 @@
         DRE->setType(Fn->getType());
         QualType ClassType
           = Context.getTypeDeclType(cast<RecordDecl>(Method->getDeclContext()));
-        E->setType(Context.getMemberPointerType(Fn->getType(), 
+        E->setType(Context.getMemberPointerType(Fn->getType(),
                                                 ClassType.getTypePtr()));
         return;
       }
@@ -4960,7 +4943,7 @@
     E->setType(Context.getPointerType(UnOp->getSubExpr()->getType()));
   } else if (DeclRefExpr *DR = dyn_cast<DeclRefExpr>(E)) {
     assert((isa<OverloadedFunctionDecl>(DR->getDecl()) ||
-            isa<FunctionTemplateDecl>(DR->getDecl())) && 
+            isa<FunctionTemplateDecl>(DR->getDecl())) &&
            "Expected overloaded function or function template");
     DR->setDecl(Fn);
     E->setType(Fn->getType());

Modified: cfe/trunk/lib/Sema/SemaOverload.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.h (original)
+++ cfe/trunk/lib/Sema/SemaOverload.h Wed Sep  9 10:08:12 2009
@@ -59,7 +59,7 @@
     ICC_Conversion                 ///< Conversion
   };
 
-  ImplicitConversionCategory 
+  ImplicitConversionCategory
   GetConversionCategory(ImplicitConversionKind Kind);
 
   /// ImplicitConversionRank - The rank of an implicit conversion
@@ -98,7 +98,7 @@
     ImplicitConversionKind Third : 8;
 
     /// Deprecated - Whether this the deprecated conversion of a
-    /// string literal to a pointer to non-const character data 
+    /// string literal to a pointer to non-const character data
     /// (C++ 4.2p2).
     bool Deprecated : 1;
 
@@ -106,11 +106,11 @@
     /// that we should warn about (if we actually use it).
     bool IncompatibleObjC : 1;
 
-    /// ReferenceBinding - True when this is a reference binding 
+    /// ReferenceBinding - True when this is a reference binding
     /// (C++ [over.ics.ref]).
     bool ReferenceBinding : 1;
 
-    /// DirectBinding - True when this is a reference binding that is a 
+    /// DirectBinding - True when this is a reference binding that is a
     /// direct binding (C++ [dcl.init.ref]).
     bool DirectBinding : 1;
 
@@ -134,7 +134,7 @@
     /// conversions.
     CXXConstructorDecl *CopyConstructor;
 
-    void setAsIdentityConversion();        
+    void setAsIdentityConversion();
     ImplicitConversionRank getRank() const;
     bool isPointerConversionToBool() const;
     bool isPointerConversionToVoidPointer(ASTContext& Context) const;
@@ -159,7 +159,7 @@
     /// After - Represents the standard conversion that occurs after
     /// the actual user-defined conversion.
     StandardConversionSequence After;
-    
+
     /// ConversionFunction - The function that will perform the
     /// user-defined conversion.
     FunctionDecl* ConversionFunction;
@@ -168,7 +168,7 @@
   };
 
   /// ImplicitConversionSequence - Represents an implicit conversion
-  /// sequence, which may be a standard conversion sequence 
+  /// sequence, which may be a standard conversion sequence
   /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2),
   /// or an ellipsis conversion sequence (C++ 13.3.3.1.3).
   struct ImplicitConversionSequence {
@@ -211,8 +211,8 @@
   /// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
   struct OverloadCandidate {
     /// Function - The actual function that this candidate
-    /// represents. When NULL, this is a built-in candidate 
-    /// (C++ [over.oper]) or a surrogate for a conversion to a 
+    /// represents. When NULL, this is a built-in candidate
+    /// (C++ [over.oper]) or a surrogate for a conversion to a
     /// function pointer or reference (C++ [over.call.object]).
     FunctionDecl *Function;
 
@@ -222,7 +222,7 @@
       QualType ResultTy;
       QualType ParamTypes[3];
     } BuiltinTypes;
-    
+
     /// Surrogate - The conversion function for which this candidate
     /// is a surrogate, but only if IsSurrogate is true.
     CXXConversionDecl *Surrogate;

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Sep  9 10:08:12 2009
@@ -52,10 +52,10 @@
                                            SourceLocation StartLoc,
                                            SourceLocation EndLoc) {
   DeclGroupRef DG = dg.getAsVal<DeclGroupRef>();
-  
+
   // If we have an invalid decl, just return an error.
   if (DG.isNull()) return StmtError();
-  
+
   return Owned(new (Context) DeclStmt(DG, StartLoc, EndLoc));
 }
 
@@ -67,12 +67,12 @@
   // Ignore expressions that have void type.
   if (E->getType()->isVoidType())
     return;
-  
+
   SourceLocation Loc;
   SourceRange R1, R2;
   if (!E->isUnusedResultAWarning(Loc, R1, R2))
     return;
-  
+
   // Okay, we have an unused result.  Depending on what the base expression is,
   // we might want to make a more specific diagnostic.  Check for one of these
   // cases now.
@@ -80,7 +80,7 @@
   E = E->IgnoreParens();
   if (isa<ObjCImplicitSetterGetterRefExpr>(E))
     DiagID = diag::warn_unused_property_expr;
-  
+
   Diag(Loc, DiagID) << R1 << R2;
 }
 
@@ -101,7 +101,7 @@
     // We found the end of the list or a statement.  Scan for another declstmt.
     for (; i != NumElts && !isa<DeclStmt>(Elts[i]); ++i)
       /*empty*/;
-    
+
     if (i != NumElts) {
       Decl *D = *cast<DeclStmt>(Elts[i])->decl_begin();
       Diag(D->getLocation(), diag::ext_mixed_decls_code);
@@ -112,7 +112,7 @@
     // Ignore statements that are last in a statement expression.
     if (isStmtExpr && i == NumElts - 1)
       continue;
-    
+
     DiagnoseUnusedExprResult(Elts[i]);
   }
 
@@ -126,9 +126,9 @@
   assert((lhsval.get() != 0) && "missing expression in case statement");
 
   // C99 6.8.4.2p3: The expression shall be an integer constant.
-  // However, GCC allows any evaluatable integer expression. 
+  // However, GCC allows any evaluatable integer expression.
   Expr *LHSVal = static_cast<Expr*>(lhsval.get());
-  if (!LHSVal->isTypeDependent() && !LHSVal->isValueDependent() && 
+  if (!LHSVal->isTypeDependent() && !LHSVal->isValueDependent() &&
       VerifyIntegerConstantExpression(LHSVal))
     return StmtError();
 
@@ -163,7 +163,7 @@
 }
 
 Action::OwningStmtResult
-Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, 
+Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc,
                        StmtArg subStmt, Scope *CurScope) {
   Stmt *SubStmt = subStmt.takeAs<Stmt>();
 
@@ -210,7 +210,7 @@
                   StmtArg ThenVal, SourceLocation ElseLoc,
                   StmtArg ElseVal) {
   OwningExprResult CondResult(CondVal.release());
-  
+
   Expr *condExpr = CondResult.takeAs<Expr>();
 
   assert(condExpr && "ActOnIfStmt(): missing expression");
@@ -220,12 +220,12 @@
     // Take ownership again until we're past the error checking.
     CondResult = condExpr;
     QualType condType = condExpr->getType();
-    
+
     if (getLangOptions().CPlusPlus) {
       if (CheckCXXBooleanCondition(condExpr)) // C++ 6.4p4
         return StmtError();
     } else if (!condType->isScalarType()) // C99 6.8.4.1p1
-      return StmtError(Diag(IfLoc, 
+      return StmtError(Diag(IfLoc,
                             diag::err_typecheck_statement_requires_scalar)
                        << condType << condExpr->getSourceRange());
   }
@@ -237,14 +237,14 @@
   // this helps prevent bugs due to typos, such as
   // if (condition);
   //   do_stuff();
-  if (!ElseVal.get()) { 
+  if (!ElseVal.get()) {
     if (NullStmt* stmt = dyn_cast<NullStmt>(thenStmt))
       Diag(stmt->getSemiLoc(), diag::warn_empty_if_body);
   }
 
   Stmt *elseStmt = ElseVal.takeAs<Stmt>();
   DiagnoseUnusedExprResult(elseStmt);
-  
+
   CondResult.release();
   return Owned(new (Context) IfStmt(IfLoc, condExpr, thenStmt,
                                     ElseLoc, elseStmt));
@@ -264,9 +264,9 @@
     // of this section. Integral promotions are performed.
     if (!Cond->isTypeDependent()) {
       QualType Ty = Cond->getType();
-      
+
       // FIXME: Handle class types.
-      
+
       // If the type is wrong a diagnostic will be emitted later at
       // ActOnFinishSwitchStmt.
       if (Ty->isIntegralType() || Ty->isEnumeralType()) {
@@ -290,19 +290,19 @@
 /// the specified diagnostic.
 void Sema::ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &Val,
                                               unsigned NewWidth, bool NewSign,
-                                              SourceLocation Loc, 
+                                              SourceLocation Loc,
                                               unsigned DiagID) {
   // Perform a conversion to the promoted condition type if needed.
   if (NewWidth > Val.getBitWidth()) {
     // If this is an extension, just do it.
     llvm::APSInt OldVal(Val);
     Val.extend(NewWidth);
-    
+
     // If the input was signed and negative and the output is unsigned,
     // warn.
     if (!NewSign && OldVal.isSigned() && OldVal.isNegative())
       Diag(Loc, DiagID) << OldVal.toString(10) << Val.toString(10);
-    
+
     Val.setIsSigned(NewSign);
   } else if (NewWidth < Val.getBitWidth()) {
     // If this is a truncation, check for overflow.
@@ -313,7 +313,7 @@
     ConvVal.setIsSigned(Val.isSigned());
     if (ConvVal != Val)
       Diag(Loc, DiagID) << Val.toString(10) << ConvVal.toString(10);
-    
+
     // Regardless of whether a diagnostic was emitted, really do the
     // truncation.
     Val.trunc(NewWidth);
@@ -323,7 +323,7 @@
     // overflow as well: unsigned(INTMIN)
     llvm::APSInt OldVal(Val);
     Val.setIsSigned(NewSign);
-    
+
     if (Val.isNegative())  // Sign bit changes meaning.
       Diag(Loc, DiagID) << OldVal.toString(10) << Val.toString(10);
   }
@@ -369,12 +369,12 @@
   assert(SS == (SwitchStmt*)Switch.get() && "switch stack missing push/pop!");
 
   SS->setBody(BodyStmt, SwitchLoc);
-  getSwitchStack().pop_back(); 
+  getSwitchStack().pop_back();
 
   Expr *CondExpr = SS->getCond();
   QualType CondType = CondExpr->getType();
 
-  if (!CondExpr->isTypeDependent() && 
+  if (!CondExpr->isTypeDependent() &&
       !CondType->isIntegerType()) { // C99 6.8.4.2p1
     Diag(SwitchLoc, diag::err_typecheck_statement_requires_integer)
       << CondType << CondExpr->getSourceRange();
@@ -383,29 +383,29 @@
 
   // Get the bitwidth of the switched-on value before promotions.  We must
   // convert the integer case values to this width before comparison.
-  bool HasDependentValue 
+  bool HasDependentValue
     = CondExpr->isTypeDependent() || CondExpr->isValueDependent();
-  unsigned CondWidth 
+  unsigned CondWidth
     = HasDependentValue? 0
                        : static_cast<unsigned>(Context.getTypeSize(CondType));
   bool CondIsSigned = CondType->isSignedIntegerType();
-  
+
   // Accumulate all of the case values in a vector so that we can sort them
   // and detect duplicates.  This vector contains the APInt for the case after
   // it has been converted to the condition type.
   typedef llvm::SmallVector<std::pair<llvm::APSInt, CaseStmt*>, 64> CaseValsTy;
   CaseValsTy CaseVals;
-  
+
   // Keep track of any GNU case ranges we see.  The APSInt is the low value.
   std::vector<std::pair<llvm::APSInt, CaseStmt*> > CaseRanges;
-  
+
   DefaultStmt *TheDefaultStmt = 0;
-  
+
   bool CaseListIsErroneous = false;
-  
+
   for (SwitchCase *SC = SS->getSwitchCaseList(); SC && !HasDependentValue;
        SC = SC->getNextSwitchCase()) {
-    
+
     if (DefaultStmt *DS = dyn_cast<DefaultStmt>(SC)) {
       if (TheDefaultStmt) {
         Diag(DS->getDefaultLoc(), diag::err_multiple_default_labels_defined);
@@ -418,10 +418,10 @@
         CaseListIsErroneous = true;
       }
       TheDefaultStmt = DS;
-      
+
     } else {
       CaseStmt *CS = cast<CaseStmt>(SC);
-      
+
       // We already verified that the expression has a i-c-e value (C99
       // 6.8.4.2p3) - get that value now.
       Expr *Lo = CS->getLHS();
@@ -430,9 +430,9 @@
         HasDependentValue = true;
         break;
       }
-        
+
       llvm::APSInt LoVal = Lo->EvaluateAsInt(Context);
-      
+
       // Convert the value to the same width/sign as the condition.
       ConvertIntegerToTypeWarnOnOverflow(LoVal, CondWidth, CondIsSigned,
                                          CS->getLHS()->getLocStart(),
@@ -442,16 +442,16 @@
       // cast.
       ImpCastExprToType(Lo, CondType);
       CS->setLHS(Lo);
-      
+
       // If this is a case range, remember it in CaseRanges, otherwise CaseVals.
       if (CS->getRHS()) {
-        if (CS->getRHS()->isTypeDependent() || 
+        if (CS->getRHS()->isTypeDependent() ||
             CS->getRHS()->isValueDependent()) {
           HasDependentValue = true;
           break;
         }
         CaseRanges.push_back(std::make_pair(LoVal, CS));
-      } else 
+      } else
         CaseVals.push_back(std::make_pair(LoVal, CS));
     }
   }
@@ -466,7 +466,7 @@
           // If we have a duplicate, report it.
           Diag(CaseVals[i+1].second->getLHS()->getLocStart(),
                diag::err_duplicate_case) << CaseVals[i].first.toString(10);
-          Diag(CaseVals[i].second->getLHS()->getLocStart(), 
+          Diag(CaseVals[i].second->getLHS()->getLocStart(),
                diag::note_duplicate_case_prev);
           // FIXME: We really want to remove the bogus case stmt from the
           // substmt, but we have no way to do this right now.
@@ -474,31 +474,31 @@
         }
       }
     }
-  
+
     // Detect duplicate case ranges, which usually don't exist at all in
     // the first place.
     if (!CaseRanges.empty()) {
       // Sort all the case ranges by their low value so we can easily detect
       // overlaps between ranges.
       std::stable_sort(CaseRanges.begin(), CaseRanges.end());
-      
+
       // Scan the ranges, computing the high values and removing empty ranges.
       std::vector<llvm::APSInt> HiVals;
       for (unsigned i = 0, e = CaseRanges.size(); i != e; ++i) {
         CaseStmt *CR = CaseRanges[i].second;
         Expr *Hi = CR->getRHS();
         llvm::APSInt HiVal = Hi->EvaluateAsInt(Context);
-        
+
         // Convert the value to the same width/sign as the condition.
         ConvertIntegerToTypeWarnOnOverflow(HiVal, CondWidth, CondIsSigned,
                                            CR->getRHS()->getLocStart(),
                                            diag::warn_case_value_overflow);
-        
+
         // If the LHS is not the same type as the condition, insert an implicit
         // cast.
         ImpCastExprToType(Hi, CondType);
         CR->setRHS(Hi);
-        
+
         // If the low value is bigger than the high value, the case is empty.
         if (CaseRanges[i].first > HiVal) {
           Diag(CR->getLHS()->getLocStart(), diag::warn_case_empty_range)
@@ -510,7 +510,7 @@
         }
         HiVals.push_back(HiVal);
       }
-      
+
       // Rescan the ranges, looking for overlap with singleton values and other
       // ranges.  Since the range list is sorted, we only need to compare case
       // ranges with their neighbors.
@@ -518,12 +518,12 @@
         llvm::APSInt &CRLo = CaseRanges[i].first;
         llvm::APSInt &CRHi = HiVals[i];
         CaseStmt *CR = CaseRanges[i].second;
-        
+
         // Check to see whether the case range overlaps with any
         // singleton cases.
         CaseStmt *OverlapStmt = 0;
         llvm::APSInt OverlapVal(32);
-        
+
         // Find the smallest value >= the lower bound.  If I is in the
         // case range, then we have overlap.
         CaseValsTy::iterator I = std::lower_bound(CaseVals.begin(),
@@ -533,26 +533,26 @@
           OverlapVal  = I->first;   // Found overlap with scalar.
           OverlapStmt = I->second;
         }
-        
+
         // Find the smallest value bigger than the upper bound.
         I = std::upper_bound(I, CaseVals.end(), CRHi, CaseCompareFunctor());
         if (I != CaseVals.begin() && (I-1)->first >= CRLo) {
           OverlapVal  = (I-1)->first;      // Found overlap with scalar.
           OverlapStmt = (I-1)->second;
         }
-        
+
         // Check to see if this case stmt overlaps with the subsequent
         // case range.
         if (i && CRLo <= HiVals[i-1]) {
           OverlapVal  = HiVals[i-1];       // Found overlap with range.
           OverlapStmt = CaseRanges[i-1].second;
         }
-        
+
         if (OverlapStmt) {
           // If we have a duplicate, report it.
           Diag(CR->getLHS()->getLocStart(), diag::err_duplicate_case)
             << OverlapVal.toString(10);
-          Diag(OverlapStmt->getLHS()->getLocStart(), 
+          Diag(OverlapStmt->getLHS()->getLocStart(),
                diag::note_duplicate_case_prev);
           // FIXME: We really want to remove the bogus case stmt from the
           // substmt, but we have no way to do this right now.
@@ -581,7 +581,7 @@
     DefaultFunctionArrayConversion(condExpr);
     CondArg = condExpr;
     QualType condType = condExpr->getType();
-    
+
     if (getLangOptions().CPlusPlus) {
       if (CheckCXXBooleanCondition(condExpr)) // C++ 6.4p4
         return StmtError();
@@ -593,7 +593,7 @@
 
   Stmt *bodyStmt = Body.takeAs<Stmt>();
   DiagnoseUnusedExprResult(bodyStmt);
-  
+
   CondArg.release();
   return Owned(new (Context) WhileStmt(condExpr, bodyStmt, WhileLoc));
 }
@@ -609,12 +609,12 @@
     DefaultFunctionArrayConversion(condExpr);
     Cond = condExpr;
     QualType condType = condExpr->getType();
-    
+
     if (getLangOptions().CPlusPlus) {
       if (CheckCXXBooleanCondition(condExpr)) // C++ 6.4p4
         return StmtError();
     } else if (!condType->isScalarType()) // C99 6.8.5p2
-      return StmtError(Diag(DoLoc, 
+      return StmtError(Diag(DoLoc,
                             diag::err_typecheck_statement_requires_scalar)
                        << condType << condExpr->getSourceRange());
   }
@@ -664,7 +664,7 @@
                             diag::err_typecheck_statement_requires_scalar)
         << SecondType << Second->getSourceRange());
   }
-  
+
   DiagnoseUnusedExprResult(First);
   DiagnoseUnusedExprResult(Third);
   DiagnoseUnusedExprResult(Body);
@@ -707,9 +707,9 @@
                    diag::err_selector_element_not_lvalue)
           << First->getSourceRange());
 
-      FirstType = static_cast<Expr*>(First)->getType();        
+      FirstType = static_cast<Expr*>(First)->getType();
     }
-    if (!FirstType->isObjCObjectPointerType() && 
+    if (!FirstType->isObjCObjectPointerType() &&
         !FirstType->isBlockPointerType())
         Diag(ForLoc, diag::err_selector_element_type)
           << FirstType << First->getSourceRange();
@@ -832,8 +832,8 @@
     // we have a non-void block with an expression, continue checking
     QualType RetValType = RetValExp->getType();
 
-    // C99 6.8.6.4p3(136): The return statement is not an assignment. The 
-    // overlap restriction of subclause 6.5.16.1 does not apply to the case of 
+    // C99 6.8.6.4p3(136): The return statement is not an assignment. The
+    // overlap restriction of subclause 6.5.16.1 does not apply to the case of
     // function return.
 
     // In C++ the return statement is handled via a copy initialization.
@@ -890,7 +890,7 @@
     FnRetType = MD->getResultType();
   else // If we don't have a function/method context, bail.
     return StmtError();
-    
+
   if (FnRetType->isVoidType()) {
     if (RetValExp) {// C99 6.8.6.4p1 (ext_ since GCC warns)
       unsigned D = diag::ext_return_has_expr;
@@ -905,7 +905,7 @@
           << CurDecl->getDeclName() << isa<ObjCMethodDecl>(CurDecl)
           << RetValExp->getSourceRange();
       }
-      
+
       RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp, true);
     }
     return Owned(new (Context) ReturnStmt(ReturnLoc, RetValExp));
@@ -926,8 +926,8 @@
   if (!FnRetType->isDependentType() && !RetValExp->isTypeDependent()) {
     // we have a non-void function with an expression, continue checking
 
-    // C99 6.8.6.4p3(136): The return statement is not an assignment. The 
-    // overlap restriction of subclause 6.5.16.1 does not apply to the case of 
+    // C99 6.8.6.4p3(136): The return statement is not an assignment. The
+    // overlap restriction of subclause 6.5.16.1 does not apply to the case of
     // function return.
 
     // C++0x 12.8p15: When certain criteria are met, an implementation is
@@ -1009,7 +1009,7 @@
   StringLiteral **Clobbers = reinterpret_cast<StringLiteral**>(clobbers.get());
 
   llvm::SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos;
-  
+
   // The parser verifies that there is a string literal here.
   if (AsmString->isWide())
     return StmtError(Diag(AsmString->getLocStart(),diag::err_asm_wide_character)
@@ -1021,7 +1021,7 @@
       return StmtError(Diag(Literal->getLocStart(),diag::err_asm_wide_character)
         << Literal->getSourceRange());
 
-    TargetInfo::ConstraintInfo Info(Literal->getStrData(), 
+    TargetInfo::ConstraintInfo Info(Literal->getStrData(),
                                     Literal->getByteLength(),
                                     Names[i]);
     if (!Context.Target.validateOutputConstraint(Info))
@@ -1036,7 +1036,7 @@
                   diag::err_asm_invalid_lvalue_in_output)
         << OutputExpr->getSourceRange());
     }
-    
+
     OutputConstraintInfos.push_back(Info);
   }
 
@@ -1048,7 +1048,7 @@
       return StmtError(Diag(Literal->getLocStart(),diag::err_asm_wide_character)
         << Literal->getSourceRange());
 
-    TargetInfo::ConstraintInfo Info(Literal->getStrData(), 
+    TargetInfo::ConstraintInfo Info(Literal->getStrData(),
                                     Literal->getByteLength(),
                                     Names[i]);
     if (!Context.Target.validateInputConstraint(OutputConstraintInfos.data(),
@@ -1073,13 +1073,13 @@
       if (InputExpr->getType()->isVoidType()) {
         return StmtError(Diag(InputExpr->getLocStart(),
                               diag::err_asm_invalid_type_in_input)
-          << InputExpr->getType() << Info.getConstraintStr() 
+          << InputExpr->getType() << Info.getConstraintStr()
           << InputExpr->getSourceRange());
       }
     }
-    
+
     DefaultFunctionArrayConversion(Exprs[i]);
-    
+
     InputConstraintInfos.push_back(Info);
   }
 
@@ -1117,16 +1117,16 @@
     DeleteStmt(NS);
     return StmtError();
   }
-  
+
   // Validate tied input operands for type mismatches.
   for (unsigned i = 0, e = InputConstraintInfos.size(); i != e; ++i) {
     TargetInfo::ConstraintInfo &Info = InputConstraintInfos[i];
-    
+
     // If this is a tied constraint, verify that the output and input have
     // either exactly the same type, or that they are int/ptr operands with the
     // same size (int/long, int*/long, are ok etc).
     if (!Info.hasTiedOperand()) continue;
-    
+
     unsigned TiedTo = Info.getTiedOperand();
     Expr *OutputExpr = Exprs[TiedTo];
     Expr *InputExpr = Exprs[i+NumOutputs];
@@ -1134,11 +1134,11 @@
     QualType OutTy = OutputExpr->getType();
     if (Context.hasSameType(InTy, OutTy))
       continue;  // All types can be tied to themselves.
-    
+
     // Int/ptr operands have some special cases that we allow.
     if ((OutTy->isIntegerType() || OutTy->isPointerType()) &&
         (InTy->isIntegerType() || InTy->isPointerType())) {
-      
+
       // They are ok if they are the same size.  Tying void* to int is ok if
       // they are the same size, for example.  This also allows tying void* to
       // int*.
@@ -1146,7 +1146,7 @@
       uint64_t InSize = Context.getTypeSize(InTy);
       if (OutSize == InSize)
         continue;
-      
+
       // If the smaller input/output operand is not mentioned in the asm string,
       // then we can promote it and the asm string won't notice.  Check this
       // case now.
@@ -1154,7 +1154,7 @@
       for (unsigned p = 0, e = Pieces.size(); p != e; ++p) {
         AsmStmt::AsmStringPiece &Piece = Pieces[p];
         if (!Piece.isOperand()) continue;
-        
+
         // If this is a reference to the input and if the input was the smaller
         // one, then we have to reject this asm.
         if (Piece.getOperandNo() == i+NumOutputs) {
@@ -1173,7 +1173,7 @@
           }
         }
       }
-      
+
       // If the smaller value wasn't mentioned in the asm string, and if the
       // output was a register, just extend the shorter one to the size of the
       // larger one.
@@ -1181,7 +1181,7 @@
           OutputConstraintInfos[TiedTo].allowsRegister())
         continue;
     }
-    
+
     Diag(InputExpr->getLocStart(),
          diag::err_asm_tying_incompatible_types)
       << InTy << OutTy << OutputExpr->getSourceRange()
@@ -1189,7 +1189,7 @@
     DeleteStmt(NS);
     return StmtError();
   }
-  
+
   return Owned(NS);
 }
 
@@ -1199,18 +1199,18 @@
                            StmtArg Body, StmtArg catchList) {
   Stmt *CatchList = catchList.takeAs<Stmt>();
   ParmVarDecl *PVD = cast_or_null<ParmVarDecl>(Parm.getAs<Decl>());
-  
+
   // PVD == 0 implies @catch(...).
   if (PVD) {
     // If we already know the decl is invalid, reject it.
     if (PVD->isInvalidDecl())
       return StmtError();
-    
+
     if (!PVD->getType()->isObjCObjectPointerType())
-      return StmtError(Diag(PVD->getLocation(), 
+      return StmtError(Diag(PVD->getLocation(),
                        diag::err_catch_param_not_objc_type));
     if (PVD->getType()->isObjCQualifiedIdType())
-      return StmtError(Diag(PVD->getLocation(), 
+      return StmtError(Diag(PVD->getLocation(),
                        diag::err_illegal_qualifiers_on_catch_parm));
   }
 
@@ -1271,8 +1271,8 @@
       return StmtError(Diag(AtLoc, diag::error_objc_synchronized_expects_object)
                        << SyncExpr->getType() << SyncExpr->getSourceRange());
   }
-  
-  return Owned(new (Context) ObjCAtSynchronizedStmt(AtLoc, 
+
+  return Owned(new (Context) ObjCAtSynchronizedStmt(AtLoc,
                                                     SynchExpr.takeAs<Stmt>(),
                                                     SynchBody.takeAs<Stmt>()));
 }
@@ -1307,12 +1307,12 @@
     else
       return getTypeSpecStartLoc() < y.getTypeSpecStartLoc();
   }
-  
+
   bool operator==(const TypeWithHandler& other) const {
     return t.getTypePtr() == other.t.getTypePtr()
         && t.getCVRQualifiers() == other.t.getCVRQualifiers();
   }
-  
+
   QualType getQualType() const { return t; }
   CXXCatchStmt *getCatchStmt() const { return stmt; }
   SourceLocation getTypeSpecStartLoc() const {
@@ -1331,17 +1331,17 @@
   Stmt **Handlers = reinterpret_cast<Stmt**>(RawHandlers.get());
 
   llvm::SmallVector<TypeWithHandler, 8> TypesWithHandlers;
-  
-  for(unsigned i = 0; i < NumHandlers; ++i) {
+
+  for (unsigned i = 0; i < NumHandlers; ++i) {
     CXXCatchStmt *Handler = llvm::cast<CXXCatchStmt>(Handlers[i]);
     if (!Handler->getExceptionDecl()) {
       if (i < NumHandlers - 1)
         return StmtError(Diag(Handler->getLocStart(),
                               diag::err_early_catch_all));
-      
+
       continue;
     }
-    
+
     const QualType CaughtType = Handler->getCaughtType();
     const QualType CanonicalCaughtType = Context.getCanonicalType(CaughtType);
     TypesWithHandlers.push_back(TypeWithHandler(CanonicalCaughtType, Handler));
@@ -1350,11 +1350,11 @@
   // Detect handlers for the same type as an earlier one.
   if (NumHandlers > 1) {
     llvm::array_pod_sort(TypesWithHandlers.begin(), TypesWithHandlers.end());
-    
+
     TypeWithHandler prev = TypesWithHandlers[0];
     for (unsigned i = 1; i < TypesWithHandlers.size(); ++i) {
       TypeWithHandler curr = TypesWithHandlers[i];
-      
+
       if (curr == prev) {
         Diag(curr.getTypeSpecStartLoc(),
              diag::warn_exception_caught_by_earlier_handler)
@@ -1363,11 +1363,11 @@
              diag::note_previous_exception_handler)
           << prev.getCatchStmt()->getCaughtType().getAsString();
       }
-      
+
       prev = curr;
     }
   }
-  
+
   // FIXME: We should detect handlers that cannot catch anything because an
   // earlier handler catches a superclass. Need to find a method that is not
   // quadratic for this.

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Sep  9 10:08:12 2009
@@ -27,10 +27,10 @@
 static NamedDecl *isAcceptableTemplateName(ASTContext &Context, NamedDecl *D) {
   if (!D)
     return 0;
-  
+
   if (isa<TemplateDecl>(D))
     return D;
-  
+
   if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(D)) {
     // C++ [temp.local]p1:
     //   Like normal (non-template) classes, class templates have an
@@ -52,14 +52,14 @@
             = dyn_cast<ClassTemplateSpecializationDecl>(Record))
         return Spec->getSpecializedTemplate();
     }
-    
+
     return 0;
   }
-  
+
   OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D);
   if (!Ovl)
     return 0;
-  
+
   for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(),
                                               FEnd = Ovl->function_end();
        F != FEnd; ++F) {
@@ -71,11 +71,11 @@
         if (isa<FunctionTemplateDecl>(*F))
           break;
       }
-      
+
       if (F != FEnd) {
         // Build an overloaded function decl containing only the
         // function templates in Ovl.
-        OverloadedFunctionDecl *OvlTemplate 
+        OverloadedFunctionDecl *OvlTemplate
           = OverloadedFunctionDecl::Create(Context,
                                            Ovl->getDeclContext(),
                                            Ovl->getDeclName());
@@ -85,19 +85,19 @@
           if (isa<FunctionTemplateDecl>(*F))
             OvlTemplate->addOverload(*F);
         }
-        
+
         return OvlTemplate;
       }
 
       return FuncTmpl;
     }
   }
-  
+
   return 0;
 }
 
 TemplateNameKind Sema::isTemplateName(Scope *S,
-                                      const IdentifierInfo &II, 
+                                      const IdentifierInfo &II,
                                       SourceLocation IdLoc,
                                       const CXXScopeSpec *SS,
                                       TypeTy *ObjectTypePtr,
@@ -109,7 +109,7 @@
   if (ObjectTypePtr) {
     // This nested-name-specifier occurs in a member access expression, e.g.,
     // x->B::f, and we are looking into the type of the object.
-    assert((!SS || !SS->isSet()) && 
+    assert((!SS || !SS->isSet()) &&
            "ObjectType and scope specifier cannot coexist");
     QualType ObjectType = QualType::getFromOpaquePtr(ObjectTypePtr);
     LookupCtx = computeDeclContext(ObjectType);
@@ -121,29 +121,29 @@
     LookupCtx = computeDeclContext(*SS, EnteringContext);
     isDependent = isDependentScopeSpecifier(*SS);
   }
-  
+
   LookupResult Found;
   bool ObjectTypeSearchedInScope = false;
   if (LookupCtx) {
     // Perform "qualified" name lookup into the declaration context we
     // computed, which is either the type of the base of a member access
-    // expression or the declaration context associated with a prior 
+    // expression or the declaration context associated with a prior
     // nested-name-specifier.
 
     // The declaration context must be complete.
     if (!LookupCtx->isDependentContext() && RequireCompleteDeclContext(*SS))
       return TNK_Non_template;
-    
+
     Found = LookupQualifiedName(LookupCtx, &II, LookupOrdinaryName);
-    
+
     if (ObjectTypePtr && Found.getKind() == LookupResult::NotFound) {
       // C++ [basic.lookup.classref]p1:
       //   In a class member access expression (5.2.5), if the . or -> token is
-      //   immediately followed by an identifier followed by a <, the 
-      //   identifier must be looked up to determine whether the < is the 
+      //   immediately followed by an identifier followed by a <, the
+      //   identifier must be looked up to determine whether the < is the
       //   beginning of a template argument list (14.2) or a less-than operator.
-      //   The identifier is first looked up in the class of the object 
-      //   expression. If the identifier is not found, it is then looked up in 
+      //   The identifier is first looked up in the class of the object
+      //   expression. If the identifier is not found, it is then looked up in
       //   the context of the entire postfix-expression and shall name a class
       //   or function template.
       //
@@ -153,15 +153,15 @@
       ObjectTypeSearchedInScope = true;
     }
   } else if (isDependent) {
-    // We cannot look into a dependent object type or 
+    // We cannot look into a dependent object type or
     return TNK_Non_template;
   } else {
     // Perform unqualified name lookup in the current scope.
     Found = LookupName(S, &II, LookupOrdinaryName);
   }
-  
+
   // FIXME: Cope with ambiguous name-lookup results.
-  assert(!Found.isAmbiguous() && 
+  assert(!Found.isAmbiguous() &&
          "Cannot handle template name-lookup ambiguities");
 
   NamedDecl *Template = isAcceptableTemplateName(Context, Found);
@@ -170,24 +170,24 @@
 
   if (ObjectTypePtr && !ObjectTypeSearchedInScope) {
     // C++ [basic.lookup.classref]p1:
-    //   [...] If the lookup in the class of the object expression finds a 
+    //   [...] If the lookup in the class of the object expression finds a
     //   template, the name is also looked up in the context of the entire
     //   postfix-expression and [...]
     //
     LookupResult FoundOuter = LookupName(S, &II, LookupOrdinaryName);
     // FIXME: Handle ambiguities in this lookup better
     NamedDecl *OuterTemplate = isAcceptableTemplateName(Context, FoundOuter);
-    
+
     if (!OuterTemplate) {
-      //   - if the name is not found, the name found in the class of the 
+      //   - if the name is not found, the name found in the class of the
       //     object expression is used, otherwise
     } else if (!isa<ClassTemplateDecl>(OuterTemplate)) {
-      //   - if the name is found in the context of the entire 
-      //     postfix-expression and does not name a class template, the name 
+      //   - if the name is found in the context of the entire
+      //     postfix-expression and does not name a class template, the name
       //     found in the class of the object expression is used, otherwise
     } else {
       //   - if the name found is a class template, it must refer to the same
-      //     entity as the one found in the class of the object expression, 
+      //     entity as the one found in the class of the object expression,
       //     otherwise the program is ill-formed.
       if (OuterTemplate->getCanonicalDecl() != Template->getCanonicalDecl()) {
         Diag(IdLoc, diag::err_nested_name_member_ref_lookup_ambiguous)
@@ -195,38 +195,38 @@
         Diag(Template->getLocation(), diag::note_ambig_member_ref_object_type)
           << QualType::getFromOpaquePtr(ObjectTypePtr);
         Diag(OuterTemplate->getLocation(), diag::note_ambig_member_ref_scope);
-        
-        // Recover by taking the template that we found in the object 
+
+        // Recover by taking the template that we found in the object
         // expression's type.
       }
-    }      
+    }
   }
-  
+
   if (SS && SS->isSet() && !SS->isInvalid()) {
-    NestedNameSpecifier *Qualifier 
+    NestedNameSpecifier *Qualifier
       = static_cast<NestedNameSpecifier *>(SS->getScopeRep());
-    if (OverloadedFunctionDecl *Ovl 
+    if (OverloadedFunctionDecl *Ovl
           = dyn_cast<OverloadedFunctionDecl>(Template))
-      TemplateResult 
+      TemplateResult
         = TemplateTy::make(Context.getQualifiedTemplateName(Qualifier, false,
                                                             Ovl));
     else
-      TemplateResult 
+      TemplateResult
         = TemplateTy::make(Context.getQualifiedTemplateName(Qualifier, false,
-                                                 cast<TemplateDecl>(Template)));    
-  } else if (OverloadedFunctionDecl *Ovl 
+                                                 cast<TemplateDecl>(Template)));
+  } else if (OverloadedFunctionDecl *Ovl
                = dyn_cast<OverloadedFunctionDecl>(Template)) {
     TemplateResult = TemplateTy::make(TemplateName(Ovl));
   } else {
     TemplateResult = TemplateTy::make(
                                   TemplateName(cast<TemplateDecl>(Template)));
   }
-  
-  if (isa<ClassTemplateDecl>(Template) || 
+
+  if (isa<ClassTemplateDecl>(Template) ||
       isa<TemplateTemplateParmDecl>(Template))
     return TNK_Type_template;
-  
-  assert((isa<FunctionTemplateDecl>(Template) || 
+
+  assert((isa<FunctionTemplateDecl>(Template) ||
           isa<OverloadedFunctionDecl>(Template)) &&
          "Unhandled template kind in Sema::isTemplateName");
   return TNK_Function_template;
@@ -246,7 +246,7 @@
   // C++ [temp.local]p4:
   //   A template-parameter shall not be redeclared within its
   //   scope (including nested scopes).
-  Diag(Loc, diag::err_template_param_shadow) 
+  Diag(Loc, diag::err_template_param_shadow)
     << cast<NamedDecl>(PrevDecl)->getDeclName();
   Diag(PrevDecl->getLocation(), diag::note_template_param_here);
   return true;
@@ -269,24 +269,24 @@
 /// (otherwise, "class" was used), and KeyLoc is the location of the
 /// "class" or "typename" keyword. ParamName is the name of the
 /// parameter (NULL indicates an unnamed template parameter) and
-/// ParamName is the location of the parameter name (if any). 
+/// ParamName is the location of the parameter name (if any).
 /// If the type parameter has a default argument, it will be added
 /// later via ActOnTypeParameterDefault.
-Sema::DeclPtrTy Sema::ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis, 
+Sema::DeclPtrTy Sema::ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis,
                                          SourceLocation EllipsisLoc,
                                          SourceLocation KeyLoc,
                                          IdentifierInfo *ParamName,
                                          SourceLocation ParamNameLoc,
                                          unsigned Depth, unsigned Position) {
-  assert(S->isTemplateParamScope() && 
-	 "Template type parameter not in template parameter scope!");
+  assert(S->isTemplateParamScope() &&
+         "Template type parameter not in template parameter scope!");
   bool Invalid = false;
 
   if (ParamName) {
     NamedDecl *PrevDecl = LookupName(S, ParamName, LookupTagName);
     if (PrevDecl && PrevDecl->isTemplateParameter())
       Invalid = Invalid || DiagnoseTemplateParameterShadow(ParamNameLoc,
-							   PrevDecl);
+                                                           PrevDecl);
   }
 
   SourceLocation Loc = ParamNameLoc;
@@ -294,8 +294,8 @@
     Loc = KeyLoc;
 
   TemplateTypeParmDecl *Param
-    = TemplateTypeParmDecl::Create(Context, CurContext, Loc, 
-                                   Depth, Position, ParamName, Typename, 
+    = TemplateTypeParmDecl::Create(Context, CurContext, Loc,
+                                   Depth, Position, ParamName, Typename,
                                    Ellipsis);
   if (Invalid)
     Param->setInvalidDecl();
@@ -310,28 +310,28 @@
 }
 
 /// ActOnTypeParameterDefault - Adds a default argument (the type
-/// Default) to the given template type parameter (TypeParam). 
-void Sema::ActOnTypeParameterDefault(DeclPtrTy TypeParam, 
+/// Default) to the given template type parameter (TypeParam).
+void Sema::ActOnTypeParameterDefault(DeclPtrTy TypeParam,
                                      SourceLocation EqualLoc,
-                                     SourceLocation DefaultLoc, 
+                                     SourceLocation DefaultLoc,
                                      TypeTy *DefaultT) {
-  TemplateTypeParmDecl *Parm 
+  TemplateTypeParmDecl *Parm
     = cast<TemplateTypeParmDecl>(TypeParam.getAs<Decl>());
   // FIXME: Preserve type source info.
   QualType Default = GetTypeFromParser(DefaultT);
 
   // C++0x [temp.param]p9:
   // A default template-argument may be specified for any kind of
-  // template-parameter that is not a template parameter pack.  
+  // template-parameter that is not a template parameter pack.
   if (Parm->isParameterPack()) {
     Diag(DefaultLoc, diag::err_template_param_pack_default_arg);
     return;
   }
-  
+
   // C++ [temp.param]p14:
   //   A template-parameter shall not be used in its own default argument.
   // FIXME: Implement this check! Needs a recursive walk over the types.
-  
+
   // Check the template argument itself.
   if (CheckTemplateArgument(Parm, Default, DefaultLoc)) {
     Parm->setInvalidDecl();
@@ -346,7 +346,7 @@
 ///
 /// \returns the (possibly-promoted) parameter type if valid;
 /// otherwise, produces a diagnostic and returns a NULL type.
-QualType 
+QualType
 Sema::CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc) {
   // C++ [temp.param]p4:
   //
@@ -355,11 +355,11 @@
   //
   //       -- integral or enumeration type,
   if (T->isIntegralType() || T->isEnumeralType() ||
-      //   -- pointer to object or pointer to function, 
-      (T->isPointerType() && 
+      //   -- pointer to object or pointer to function,
+      (T->isPointerType() &&
        (T->getAs<PointerType>()->getPointeeType()->isObjectType() ||
         T->getAs<PointerType>()->getPointeeType()->isFunctionType())) ||
-      //   -- reference to object or reference to function, 
+      //   -- reference to object or reference to function,
       T->isReferenceType() ||
       //   -- pointer to member.
       T->isMemberPointerType() ||
@@ -390,7 +390,7 @@
 /// class Array") has been parsed. S is the current scope and D is
 /// the parsed declarator.
 Sema::DeclPtrTy Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
-                                                    unsigned Depth, 
+                                                    unsigned Depth,
                                                     unsigned Position) {
   DeclaratorInfo *DInfo = 0;
   QualType T = GetTypeForDeclarator(D, S, &DInfo);
@@ -432,14 +432,14 @@
 void Sema::ActOnNonTypeTemplateParameterDefault(DeclPtrTy TemplateParamD,
                                                 SourceLocation EqualLoc,
                                                 ExprArg DefaultE) {
-  NonTypeTemplateParmDecl *TemplateParm 
+  NonTypeTemplateParmDecl *TemplateParm
     = cast<NonTypeTemplateParmDecl>(TemplateParamD.getAs<Decl>());
   Expr *Default = static_cast<Expr *>(DefaultE.get());
-  
+
   // C++ [temp.param]p14:
   //   A template-parameter shall not be used in its own default argument.
   // FIXME: Implement this check! Needs a recursive walk over the types.
-  
+
   // Check the well-formedness of the default template argument.
   TemplateArgument Converted;
   if (CheckTemplateArgument(TemplateParm, TemplateParm->getType(), Default,
@@ -461,8 +461,7 @@
                                                      IdentifierInfo *Name,
                                                      SourceLocation NameLoc,
                                                      unsigned Depth,
-                                                     unsigned Position)
-{
+                                                     unsigned Position) {
   assert(S->isTemplateParamScope() &&
          "Template template parameter not in template parameter scope!");
 
@@ -496,12 +495,12 @@
 void Sema::ActOnTemplateTemplateParameterDefault(DeclPtrTy TemplateParamD,
                                                  SourceLocation EqualLoc,
                                                  ExprArg DefaultE) {
-  TemplateTemplateParmDecl *TemplateParm 
+  TemplateTemplateParmDecl *TemplateParm
     = cast<TemplateTemplateParmDecl>(TemplateParamD.getAs<Decl>());
 
   // Since a template-template parameter's default argument is an
   // id-expression, it must be a DeclRefExpr.
-  DeclRefExpr *Default 
+  DeclRefExpr *Default
     = cast<DeclRefExpr>(static_cast<Expr *>(DefaultE.get()));
 
   // C++ [temp.param]p14:
@@ -510,12 +509,12 @@
 
   // Check the well-formedness of the template argument.
   if (!isa<TemplateDecl>(Default->getDecl())) {
-    Diag(Default->getSourceRange().getBegin(), 
+    Diag(Default->getSourceRange().getBegin(),
          diag::err_template_arg_must_be_template)
       << Default->getSourceRange();
     TemplateParm->setInvalidDecl();
     return;
-  } 
+  }
   if (CheckTemplateArgument(TemplateParm, Default)) {
     TemplateParm->setInvalidDecl();
     return;
@@ -530,7 +529,7 @@
 Sema::TemplateParamsTy *
 Sema::ActOnTemplateParameterList(unsigned Depth,
                                  SourceLocation ExportLoc,
-                                 SourceLocation TemplateLoc, 
+                                 SourceLocation TemplateLoc,
                                  SourceLocation LAngleLoc,
                                  DeclPtrTy *Params, unsigned NumParams,
                                  SourceLocation RAngleLoc) {
@@ -548,7 +547,7 @@
                          AttributeList *Attr,
                          TemplateParameterList *TemplateParams,
                          AccessSpecifier AS) {
-  assert(TemplateParams && TemplateParams->size() > 0 && 
+  assert(TemplateParams && TemplateParams->size() > 0 &&
          "No template parameters");
   assert(TUK != TUK_Reference && "Can only declare or define class templates");
   bool Invalid = false;
@@ -580,14 +579,14 @@
       // FIXME: Produce a reasonable diagnostic here
       return true;
     }
-    
-    Previous = LookupQualifiedName(SemanticContext, Name, LookupOrdinaryName, 
+
+    Previous = LookupQualifiedName(SemanticContext, Name, LookupOrdinaryName,
                                    true);
   } else {
     SemanticContext = CurContext;
     Previous = LookupName(S, Name, LookupOrdinaryName, true);
   }
-  
+
   assert(!Previous.isAmbiguous() && "Ambiguity in class template redecl?");
   NamedDecl *PrevDecl = 0;
   if (Previous.begin() != Previous.end())
@@ -595,10 +594,10 @@
 
   if (PrevDecl && !isDeclInScope(PrevDecl, SemanticContext, S))
     PrevDecl = 0;
-  
+
   // If there is a previous declaration with the same name, check
   // whether this is a valid redeclaration.
-  ClassTemplateDecl *PrevClassTemplate 
+  ClassTemplateDecl *PrevClassTemplate
     = dyn_cast_or_null<ClassTemplateDecl>(PrevDecl);
   if (PrevClassTemplate) {
     // Ensure that the template parameter lists are compatible.
@@ -614,9 +613,9 @@
     //   template declaration (7.1.5.3).
     RecordDecl *PrevRecordDecl = PrevClassTemplate->getTemplatedDecl();
     if (!isAcceptableTagRedeclaration(PrevRecordDecl, Kind, KWLoc, *Name)) {
-      Diag(KWLoc, diag::err_use_with_wrong_tag) 
+      Diag(KWLoc, diag::err_use_with_wrong_tag)
         << Name
-        << CodeModificationHint::CreateReplacement(KWLoc, 
+        << CodeModificationHint::CreateReplacement(KWLoc,
                             PrevRecordDecl->getKindName());
       Diag(PrevRecordDecl->getLocation(), diag::note_previous_use);
       Kind = PrevRecordDecl->getTagKind();
@@ -654,13 +653,13 @@
   if (CheckTemplateParameterList(TemplateParams,
             PrevClassTemplate? PrevClassTemplate->getTemplateParameters() : 0))
     Invalid = true;
-    
+
   // FIXME: If we had a scope specifier, we better have a previous template
   // declaration!
 
-  CXXRecordDecl *NewClass = 
+  CXXRecordDecl *NewClass =
     CXXRecordDecl::Create(Context, Kind, SemanticContext, NameLoc, Name, KWLoc,
-                          PrevClassTemplate? 
+                          PrevClassTemplate?
                             PrevClassTemplate->getTemplatedDecl() : 0,
                           /*DelayTypeCreation=*/true);
 
@@ -671,16 +670,16 @@
   NewClass->setDescribedClassTemplate(NewTemplate);
 
   // Build the type for the class template declaration now.
-  QualType T = 
-    Context.getTypeDeclType(NewClass, 
-                            PrevClassTemplate? 
-                              PrevClassTemplate->getTemplatedDecl() : 0);  
+  QualType T =
+    Context.getTypeDeclType(NewClass,
+                            PrevClassTemplate?
+                              PrevClassTemplate->getTemplatedDecl() : 0);
   assert(T->isDependentType() && "Class template type is not dependent?");
   (void)T;
 
   // Set the access specifier.
   SetMemberAccessSpecifier(NewTemplate, PrevClassTemplate, AS);
-  
+
   // Set the lexical context of these templates
   NewClass->setLexicalDeclContext(CurContext);
   NewTemplate->setLexicalDeclContext(CurContext);
@@ -722,7 +721,7 @@
 bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
                                       TemplateParameterList *OldParams) {
   bool Invalid = false;
-  
+
   // C++ [temp.param]p10:
   //   The set of default template-arguments available for use with a
   //   template declaration or definition is obtained by merging the
@@ -755,7 +754,7 @@
     // If a template parameter of a class template is a template parameter pack,
     // it must be the last template parameter.
     if (SawParameterPack) {
-      Diag(ParameterPackLoc, 
+      Diag(ParameterPackLoc,
            diag::err_template_param_pack_must_be_last_template_parameter);
       Invalid = true;
     }
@@ -763,15 +762,15 @@
     // Merge default arguments for template type parameters.
     if (TemplateTypeParmDecl *NewTypeParm
           = dyn_cast<TemplateTypeParmDecl>(*NewParam)) {
-      TemplateTypeParmDecl *OldTypeParm 
+      TemplateTypeParmDecl *OldTypeParm
           = OldParams? cast<TemplateTypeParmDecl>(*OldParam) : 0;
-      
+
       if (NewTypeParm->isParameterPack()) {
         assert(!NewTypeParm->hasDefaultArgument() &&
                "Parameter packs can't have a default argument!");
         SawParameterPack = true;
         ParameterPackLoc = NewTypeParm->getLocation();
-      } else if (OldTypeParm && OldTypeParm->hasDefaultArgument() && 
+      } else if (OldTypeParm && OldTypeParm->hasDefaultArgument() &&
           NewTypeParm->hasDefaultArgument()) {
         OldDefaultLoc = OldTypeParm->getDefaultArgumentLoc();
         NewDefaultLoc = NewTypeParm->getDefaultArgumentLoc();
@@ -796,7 +795,7 @@
       // Merge default arguments for non-type template parameters
       NonTypeTemplateParmDecl *OldNonTypeParm
         = OldParams? cast<NonTypeTemplateParmDecl>(*OldParam) : 0;
-      if (OldNonTypeParm && OldNonTypeParm->hasDefaultArgument() && 
+      if (OldNonTypeParm && OldNonTypeParm->hasDefaultArgument() &&
           NewNonTypeParm->hasDefaultArgument()) {
         OldDefaultLoc = OldNonTypeParm->getDefaultArgumentLoc();
         NewDefaultLoc = NewNonTypeParm->getDefaultArgumentLoc();
@@ -817,14 +816,14 @@
         SawDefaultArgument = true;
         PreviousDefaultArgLoc = NewNonTypeParm->getDefaultArgumentLoc();
       } else if (SawDefaultArgument)
-        MissingDefaultArg = true;      
+        MissingDefaultArg = true;
     } else {
     // Merge default arguments for template template parameters
       TemplateTemplateParmDecl *NewTemplateParm
         = cast<TemplateTemplateParmDecl>(*NewParam);
       TemplateTemplateParmDecl *OldTemplateParm
         = OldParams? cast<TemplateTemplateParmDecl>(*OldParam) : 0;
-      if (OldTemplateParm && OldTemplateParm->hasDefaultArgument() && 
+      if (OldTemplateParm && OldTemplateParm->hasDefaultArgument() &&
           NewTemplateParm->hasDefaultArgument()) {
         OldDefaultLoc = OldTemplateParm->getDefaultArgumentLoc();
         NewDefaultLoc = NewTemplateParm->getDefaultArgumentLoc();
@@ -844,7 +843,7 @@
         SawDefaultArgument = true;
         PreviousDefaultArgLoc = NewTemplateParm->getDefaultArgumentLoc();
       } else if (SawDefaultArgument)
-        MissingDefaultArg = true;      
+        MissingDefaultArg = true;
     }
 
     if (RedundantDefaultArg) {
@@ -859,7 +858,7 @@
       //   If a template-parameter has a default template-argument,
       //   all subsequent template-parameters shall have a default
       //   template-argument supplied.
-      Diag((*NewParam)->getLocation(), 
+      Diag((*NewParam)->getLocation(),
            diag::err_template_param_default_arg_missing);
       Diag(PreviousDefaultArgLoc, diag::note_template_param_prev_default_arg);
       Invalid = true;
@@ -874,13 +873,13 @@
   return Invalid;
 }
 
-/// \brief Match the given template parameter lists to the given scope 
+/// \brief Match the given template parameter lists to the given scope
 /// specifier, returning the template parameter list that applies to the
 /// name.
 ///
 /// \param DeclStartLoc the start of the declaration that has a scope
 /// specifier or a template parameter list.
-/// 
+///
 /// \param SS the scope specifier that will be matched to the given template
 /// parameter lists. This scope specifier precedes a qualified name that is
 /// being declared.
@@ -890,10 +889,10 @@
 ///
 /// \param NumParamLists the number of template parameter lists in ParamLists.
 ///
-/// \returns the template parameter list, if any, that corresponds to the 
+/// \returns the template parameter list, if any, that corresponds to the
 /// name that is preceded by the scope specifier @p SS. This template
 /// parameter list may be have template parameters (if we're declaring a
-/// template) or may have no template parameters (if we're declaring a 
+/// template) or may have no template parameters (if we're declaring a
 /// template specialization), or may be NULL (if we were's declaring isn't
 /// itself a template).
 TemplateParameterList *
@@ -907,35 +906,35 @@
     TemplateIdsInSpecifier;
   for (NestedNameSpecifier *NNS = (NestedNameSpecifier *)SS.getScopeRep();
        NNS; NNS = NNS->getPrefix()) {
-    if (const TemplateSpecializationType *SpecType 
+    if (const TemplateSpecializationType *SpecType
           = dyn_cast_or_null<TemplateSpecializationType>(NNS->getAsType())) {
       TemplateDecl *Template = SpecType->getTemplateName().getAsTemplateDecl();
       if (!Template)
         continue; // FIXME: should this be an error? probably...
-   
+
       if (const RecordType *Record = SpecType->getAs<RecordType>()) {
         ClassTemplateSpecializationDecl *SpecDecl
           = cast<ClassTemplateSpecializationDecl>(Record->getDecl());
         // If the nested name specifier refers to an explicit specialization,
         // we don't need a template<> header.
-        // FIXME: revisit this approach once we cope with specialization 
+        // FIXME: revisit this approach once we cope with specialization
         // properly.
         if (SpecDecl->getSpecializationKind() == TSK_ExplicitSpecialization)
           continue;
       }
-      
+
       TemplateIdsInSpecifier.push_back(SpecType);
     }
   }
-  
+
   // Reverse the list of template-ids in the scope specifier, so that we can
   // more easily match up the template-ids and the template parameter lists.
   std::reverse(TemplateIdsInSpecifier.begin(), TemplateIdsInSpecifier.end());
-  
+
   SourceLocation FirstTemplateLoc = DeclStartLoc;
   if (NumParamLists)
     FirstTemplateLoc = ParamLists[0]->getTemplateLoc();
-      
+
   // Match the template-ids found in the specifier to the template parameter
   // lists.
   unsigned Idx = 0;
@@ -947,8 +946,8 @@
       // We have a template-id without a corresponding template parameter
       // list.
       if (DependentTemplateId) {
-        // FIXME: the location information here isn't great. 
-        Diag(SS.getRange().getBegin(), 
+        // FIXME: the location information here isn't great.
+        Diag(SS.getRange().getBegin(),
              diag::err_template_spec_needs_template_parameters)
           << TemplateId
           << SS.getRange();
@@ -960,13 +959,13 @@
       }
       return 0;
     }
-    
+
     // Check the template parameter list against its corresponding template-id.
     if (DependentTemplateId) {
-      TemplateDecl *Template 
+      TemplateDecl *Template
         = TemplateIdsInSpecifier[Idx]->getTemplateName().getAsTemplateDecl();
 
-      if (ClassTemplateDecl *ClassTemplate 
+      if (ClassTemplateDecl *ClassTemplate
             = dyn_cast<ClassTemplateDecl>(Template)) {
         TemplateParameterList *ExpectedTemplateParams = 0;
         // Is this template-id naming the primary template?
@@ -979,34 +978,34 @@
           ExpectedTemplateParams = PartialSpec->getTemplateParameters();
 
         if (ExpectedTemplateParams)
-          TemplateParameterListsAreEqual(ParamLists[Idx], 
+          TemplateParameterListsAreEqual(ParamLists[Idx],
                                          ExpectedTemplateParams,
                                          true);
-      } 
+      }
     } else if (ParamLists[Idx]->size() > 0)
-      Diag(ParamLists[Idx]->getTemplateLoc(), 
+      Diag(ParamLists[Idx]->getTemplateLoc(),
            diag::err_template_param_list_matches_nontemplate)
         << TemplateId
         << ParamLists[Idx]->getSourceRange();
   }
-  
+
   // If there were at least as many template-ids as there were template
   // parameter lists, then there are no template parameter lists remaining for
   // the declaration itself.
   if (Idx >= NumParamLists)
     return 0;
-  
+
   // If there were too many template parameter lists, complain about that now.
   if (Idx != NumParamLists - 1) {
     while (Idx < NumParamLists - 1) {
-      Diag(ParamLists[Idx]->getTemplateLoc(), 
+      Diag(ParamLists[Idx]->getTemplateLoc(),
            diag::err_template_spec_extra_headers)
         << SourceRange(ParamLists[Idx]->getTemplateLoc(),
                        ParamLists[Idx]->getRAngleLoc());
       ++Idx;
     }
   }
-  
+
   // Return the last template parameter list, which corresponds to the
   // entity being declared.
   return ParamLists[NumParamLists - 1];
@@ -1014,8 +1013,8 @@
 
 /// \brief Translates template arguments as provided by the parser
 /// into template arguments used by semantic analysis.
-static void 
-translateTemplateArguments(ASTTemplateArgsPtr &TemplateArgsIn, 
+static void
+translateTemplateArguments(ASTTemplateArgsPtr &TemplateArgsIn,
                            SourceLocation *TemplateArgLocs,
                      llvm::SmallVector<TemplateArgument, 16> &TemplateArgs) {
   TemplateArgs.reserve(TemplateArgsIn.size());
@@ -1049,12 +1048,12 @@
   // template.
   TemplateArgumentListBuilder Converted(Template->getTemplateParameters(),
                                         NumTemplateArgs);
-  if (CheckTemplateArgumentList(Template, TemplateLoc, LAngleLoc, 
+  if (CheckTemplateArgumentList(Template, TemplateLoc, LAngleLoc,
                                 TemplateArgs, NumTemplateArgs, RAngleLoc,
                                 false, Converted))
     return QualType();
 
-  assert((Converted.structuredSize() == 
+  assert((Converted.structuredSize() ==
             Template->getTemplateParameters()->size()) &&
          "Converted template argument list is too short!");
 
@@ -1071,21 +1070,21 @@
     //
     //   template<typename T, typename U = T> struct A;
     TemplateName CanonName = Context.getCanonicalTemplateName(Name);
-    CanonType = Context.getTemplateSpecializationType(CanonName, 
+    CanonType = Context.getTemplateSpecializationType(CanonName,
                                                    Converted.getFlatArguments(),
                                                    Converted.flatSize());
-    
+
     // FIXME: CanonType is not actually the canonical type, and unfortunately
     // it is a TemplateTypeSpecializationType that we will never use again.
     // In the future, we need to teach getTemplateSpecializationType to only
     // build the canonical type and return that to us.
     CanonType = Context.getCanonicalType(CanonType);
-  } else if (ClassTemplateDecl *ClassTemplate 
+  } else if (ClassTemplateDecl *ClassTemplate
                = dyn_cast<ClassTemplateDecl>(Template)) {
     // Find the class template specialization declaration that
     // corresponds to these arguments.
     llvm::FoldingSetNodeID ID;
-    ClassTemplateSpecializationDecl::Profile(ID, 
+    ClassTemplateSpecializationDecl::Profile(ID,
                                              Converted.getFlatArguments(),
                                              Converted.flatSize(),
                                              Context);
@@ -1096,7 +1095,7 @@
       // This is the first time we have referenced this class template
       // specialization. Create the canonical declaration and add it to
       // the set of specializations.
-      Decl = ClassTemplateSpecializationDecl::Create(Context, 
+      Decl = ClassTemplateSpecializationDecl::Create(Context,
                                     ClassTemplate->getDeclContext(),
                                     TemplateLoc,
                                     ClassTemplate,
@@ -1107,7 +1106,7 @@
 
     CanonType = Context.getTypeDeclType(Decl);
   }
-  
+
   // Build the fully-sugared type for this class template
   // specialization, which refers back to the class template
   // specialization we created or found.
@@ -1118,7 +1117,7 @@
 
 Action::TypeResult
 Sema::ActOnTemplateIdType(TemplateTy TemplateD, SourceLocation TemplateLoc,
-                          SourceLocation LAngleLoc, 
+                          SourceLocation LAngleLoc,
                           ASTTemplateArgsPtr TemplateArgsIn,
                           SourceLocation *TemplateArgLocs,
                           SourceLocation RAngleLoc) {
@@ -1151,7 +1150,7 @@
 
   // Verify the tag specifier.
   TagDecl::TagKind TagKind = TagDecl::getTagKindForTypeSpec(TagSpec);
-  
+
   if (const RecordType *RT = Type->getAs<RecordType>()) {
     RecordDecl *D = RT->getDecl();
 
@@ -1179,14 +1178,14 @@
                                                  SourceLocation RAngleLoc) {
   // FIXME: Can we do any checking at this point? I guess we could check the
   // template arguments that we have against the template name, if the template
-  // name refers to a single template. That's not a terribly common case, 
+  // name refers to a single template. That's not a terribly common case,
   // though.
-  return Owned(TemplateIdRefExpr::Create(Context, 
+  return Owned(TemplateIdRefExpr::Create(Context,
                                          /*FIXME: New type?*/Context.OverloadTy,
                                          /*FIXME: Necessary?*/0,
                                          /*FIXME: Necessary?*/SourceRange(),
                                          Template, TemplateNameLoc, LAngleLoc,
-                                         TemplateArgs, 
+                                         TemplateArgs,
                                          NumTemplateArgs, RAngleLoc));
 }
 
@@ -1197,12 +1196,12 @@
                                                 SourceLocation *TemplateArgLocs,
                                                  SourceLocation RAngleLoc) {
   TemplateName Template = TemplateD.getAsVal<TemplateName>();
-  
+
   // Translate the parser's template argument list in our AST format.
   llvm::SmallVector<TemplateArgument, 16> TemplateArgs;
   translateTemplateArguments(TemplateArgsIn, TemplateArgLocs, TemplateArgs);
   TemplateArgsIn.release();
-  
+
   return BuildTemplateIdExpr(Template, TemplateNameLoc, LAngleLoc,
                              TemplateArgs.data(), TemplateArgs.size(),
                              RAngleLoc);
@@ -1220,7 +1219,7 @@
                                          SourceLocation *TemplateArgLocs,
                                          SourceLocation RAngleLoc) {
   TemplateName Template = TemplateD.getAsVal<TemplateName>();
-  
+
   // FIXME: We're going to end up looking up the template based on its name,
   // twice!
   DeclarationName Name;
@@ -1230,17 +1229,17 @@
     Name = Ovl->getDeclName();
   else
     Name = Template.getAsDependentTemplateName()->getName();
-  
+
   // Translate the parser's template argument list in our AST format.
   llvm::SmallVector<TemplateArgument, 16> TemplateArgs;
   translateTemplateArguments(TemplateArgsIn, TemplateArgLocs, TemplateArgs);
   TemplateArgsIn.release();
-  
+
   // Do we have the save the actual template name? We might need it...
   return BuildMemberReferenceExpr(S, move(Base), OpLoc, OpKind, TemplateNameLoc,
                                   Name, true, LAngleLoc,
                                   TemplateArgs.data(), TemplateArgs.size(),
-                                  RAngleLoc, DeclPtrTy(), &SS);  
+                                  RAngleLoc, DeclPtrTy(), &SS);
 }
 
 /// \brief Form a dependent template name.
@@ -1250,13 +1249,13 @@
 /// example, given "MetaFun::template apply", the scope specifier \p
 /// SS will be "MetaFun::", \p TemplateKWLoc contains the location
 /// of the "template" keyword, and "apply" is the \p Name.
-Sema::TemplateTy 
+Sema::TemplateTy
 Sema::ActOnDependentTemplateName(SourceLocation TemplateKWLoc,
                                  const IdentifierInfo &Name,
                                  SourceLocation NameLoc,
                                  const CXXScopeSpec &SS,
                                  TypeTy *ObjectType) {
-  if ((ObjectType && 
+  if ((ObjectType &&
        computeDeclContext(QualType::getFromOpaquePtr(ObjectType))) ||
       (SS.isSet() && computeDeclContext(SS, false))) {
     // C++0x [temp.names]p5:
@@ -1276,7 +1275,7 @@
     // "template" keyword is now permitted). We follow the C++0x
     // rules, even in C++03 mode, retroactively applying the DR.
     TemplateTy Template;
-    TemplateNameKind TNK = isTemplateName(0, Name, NameLoc, &SS, ObjectType, 
+    TemplateNameKind TNK = isTemplateName(0, Name, NameLoc, &SS, ObjectType,
                                           false, Template);
     if (TNK == TNK_Non_template) {
       Diag(NameLoc, diag::err_template_kw_refers_to_non_template)
@@ -1287,12 +1286,12 @@
     return Template;
   }
 
-  NestedNameSpecifier *Qualifier 
+  NestedNameSpecifier *Qualifier
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
   return TemplateTy::make(Context.getDependentTemplateName(Qualifier, &Name));
 }
 
-bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, 
+bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param,
                                      const TemplateArgument &Arg,
                                      TemplateArgumentListBuilder &Converted) {
   // Check template type parameter.
@@ -1305,13 +1304,13 @@
     // is not a type.
     Diag(Arg.getLocation(), diag::err_template_arg_must_be_type);
     Diag(Param->getLocation(), diag::note_template_param_here);
-    
+
     return true;
-  }    
+  }
 
   if (CheckTemplateArgument(Param, Arg.getAsType(), Arg.getLocation()))
     return true;
-  
+
   // Add the converted template type argument.
   Converted.Append(
                  TemplateArgument(Arg.getLocation(),
@@ -1334,9 +1333,9 @@
   unsigned NumArgs = NumTemplateArgs;
   bool Invalid = false;
 
-  bool HasParameterPack = 
+  bool HasParameterPack =
     NumParams > 0 && Params->getParam(NumParams - 1)->isTemplateParameterPack();
-  
+
   if ((NumArgs > NumParams && !HasParameterPack) ||
       (NumArgs < Params->getMinRequiredArguments() &&
        !PartialTemplateArgs)) {
@@ -1356,8 +1355,8 @@
       << Params->getSourceRange();
     Invalid = true;
   }
-  
-  // C++ [temp.arg]p1: 
+
+  // C++ [temp.arg]p1:
   //   [...] The type and form of each template-argument specified in
   //   a template-id shall match the type and form specified for the
   //   corresponding parameter declared by the template in its
@@ -1368,7 +1367,7 @@
        Param != ParamEnd; ++Param, ++ArgIdx) {
     if (ArgIdx > NumArgs && PartialTemplateArgs)
       break;
-    
+
     // Decode the template argument
     TemplateArgument Arg;
     if (ArgIdx >= NumArgs) {
@@ -1381,7 +1380,7 @@
           Converted.EndPack();
           break;
         }
-        
+
         if (!TTP->hasDefaultArgument())
           break;
 
@@ -1390,14 +1389,14 @@
         // If the argument type is dependent, instantiate it now based
         // on the previously-computed template arguments.
         if (ArgType->isDependentType()) {
-          InstantiatingTemplate Inst(*this, TemplateLoc, 
+          InstantiatingTemplate Inst(*this, TemplateLoc,
                                      Template, Converted.getFlatArguments(),
                                      Converted.flatSize(),
                                      SourceRange(TemplateLoc, RAngleLoc));
 
           TemplateArgumentList TemplateArgs(Context, Converted,
                                             /*TakeArgs=*/false);
-          ArgType = SubstType(ArgType, 
+          ArgType = SubstType(ArgType,
                               MultiLevelTemplateArgumentList(TemplateArgs),
                               TTP->getDefaultArgumentLoc(),
                               TTP->getDeclName());
@@ -1407,29 +1406,29 @@
           return true;
 
         Arg = TemplateArgument(TTP->getLocation(), ArgType);
-      } else if (NonTypeTemplateParmDecl *NTTP 
+      } else if (NonTypeTemplateParmDecl *NTTP
                    = dyn_cast<NonTypeTemplateParmDecl>(*Param)) {
         if (!NTTP->hasDefaultArgument())
           break;
 
-        InstantiatingTemplate Inst(*this, TemplateLoc, 
+        InstantiatingTemplate Inst(*this, TemplateLoc,
                                    Template, Converted.getFlatArguments(),
                                    Converted.flatSize(),
                                    SourceRange(TemplateLoc, RAngleLoc));
-        
+
         TemplateArgumentList TemplateArgs(Context, Converted,
                                           /*TakeArgs=*/false);
 
-        Sema::OwningExprResult E 
-          = SubstExpr(NTTP->getDefaultArgument(), 
+        Sema::OwningExprResult E
+          = SubstExpr(NTTP->getDefaultArgument(),
                       MultiLevelTemplateArgumentList(TemplateArgs));
         if (E.isInvalid())
           return true;
-        
+
         Arg = TemplateArgument(E.takeAs<Expr>());
       } else {
-        TemplateTemplateParmDecl *TempParm 
-          = cast<TemplateTemplateParmDecl>(*Param);      
+        TemplateTemplateParmDecl *TempParm
+          = cast<TemplateTemplateParmDecl>(*Param);
 
         if (!TempParm->hasDefaultArgument())
           break;
@@ -1451,13 +1450,13 @@
           if (CheckTemplateTypeArgument(TTP, TemplateArgs[ArgIdx], Converted))
             Invalid = true;
         }
-        
+
         Converted.EndPack();
       } else {
         if (CheckTemplateTypeArgument(TTP, Arg, Converted))
           Invalid = true;
       }
-    } else if (NonTypeTemplateParmDecl *NTTP 
+    } else if (NonTypeTemplateParmDecl *NTTP
                  = dyn_cast<NonTypeTemplateParmDecl>(*Param)) {
       // Check non-type template parameters.
 
@@ -1466,21 +1465,21 @@
       QualType NTTPType = NTTP->getType();
       if (NTTPType->isDependentType()) {
         // Do substitution on the type of the non-type template parameter.
-        InstantiatingTemplate Inst(*this, TemplateLoc, 
+        InstantiatingTemplate Inst(*this, TemplateLoc,
                                    Template, Converted.getFlatArguments(),
                                    Converted.flatSize(),
                                    SourceRange(TemplateLoc, RAngleLoc));
 
         TemplateArgumentList TemplateArgs(Context, Converted,
                                           /*TakeArgs=*/false);
-        NTTPType = SubstType(NTTPType, 
+        NTTPType = SubstType(NTTPType,
                              MultiLevelTemplateArgumentList(TemplateArgs),
                              NTTP->getLocation(),
                              NTTP->getDeclName());
         // If that worked, check the non-type template parameter type
         // for validity.
         if (!NTTPType.isNull())
-          NTTPType = CheckNonTypeTemplateParameterType(NTTPType, 
+          NTTPType = CheckNonTypeTemplateParameterType(NTTPType,
                                                        NTTP->getLocation());
         if (NTTPType.isNull()) {
           Invalid = true;
@@ -1492,7 +1491,7 @@
       case TemplateArgument::Null:
         assert(false && "Should never see a NULL template argument here");
         break;
-          
+
       case TemplateArgument::Expression: {
         Expr *E = Arg.getAsExpr();
         TemplateArgument Result;
@@ -1513,7 +1512,7 @@
       case TemplateArgument::Type:
         // We have a non-type template parameter but the template
         // argument is a type.
-        
+
         // C++ [temp.arg]p2:
         //   In a template-argument, an ambiguity between a type-id and
         //   an expression is resolved to a type-id, regardless of the
@@ -1529,37 +1528,37 @@
         Diag((*Param)->getLocation(), diag::note_template_param_here);
         Invalid = true;
         break;
-      
+
       case TemplateArgument::Pack:
         assert(0 && "FIXME: Implement!");
         break;
       }
-    } else { 
+    } else {
       // Check template template parameters.
-      TemplateTemplateParmDecl *TempParm 
+      TemplateTemplateParmDecl *TempParm
         = cast<TemplateTemplateParmDecl>(*Param);
-     
+
       switch (Arg.getKind()) {
       case TemplateArgument::Null:
         assert(false && "Should never see a NULL template argument here");
         break;
-          
+
       case TemplateArgument::Expression: {
         Expr *ArgExpr = Arg.getAsExpr();
         if (ArgExpr && isa<DeclRefExpr>(ArgExpr) &&
             isa<TemplateDecl>(cast<DeclRefExpr>(ArgExpr)->getDecl())) {
           if (CheckTemplateArgument(TempParm, cast<DeclRefExpr>(ArgExpr)))
             Invalid = true;
-          
+
           // Add the converted template argument.
-          Decl *D 
+          Decl *D
             = cast<DeclRefExpr>(ArgExpr)->getDecl()->getCanonicalDecl();
           Converted.Append(TemplateArgument(Arg.getLocation(), D));
           continue;
         }
       }
         // fall through
-        
+
       case TemplateArgument::Type: {
         // We have a template template parameter but the template
         // argument does not refer to a template.
@@ -1573,11 +1572,11 @@
         // it to the list of converted arguments.
         Converted.Append(Arg);
         break;
-        
+
       case TemplateArgument::Integral:
         assert(false && "Integral argument with template template parameter");
         break;
-      
+
       case TemplateArgument::Pack:
         assert(0 && "FIXME: Implement!");
         break;
@@ -1593,7 +1592,7 @@
 ///
 /// This routine implements the semantics of C++ [temp.arg.type]. It
 /// returns true if an error occurred, and false otherwise.
-bool Sema::CheckTemplateArgument(TemplateTypeParmDecl *Param, 
+bool Sema::CheckTemplateArgument(TemplateTypeParmDecl *Param,
                                  QualType Arg, SourceLocation ArgLoc) {
   // C++ [temp.arg.type]p2:
   //   A local type, a type with no linkage, an unnamed type or a type
@@ -1609,7 +1608,7 @@
   if (Tag && Tag->getDecl()->getDeclContext()->isFunctionOrMethod())
     return Diag(ArgLoc, diag::err_template_arg_local_type)
       << QualType(Tag, 0);
-  else if (Tag && !Tag->getDecl()->getDeclName() && 
+  else if (Tag && !Tag->getDecl()->getDeclName() &&
            !Tag->getDecl()->getTypedefForAnonDecl()) {
     Diag(ArgLoc, diag::err_template_arg_unnamed_type);
     Diag(Tag->getDecl()->getLocation(), diag::note_template_unnamed_type_here);
@@ -1634,7 +1633,7 @@
     return false;
 
   // C++ [temp.arg.nontype]p1:
-  // 
+  //
   //   A template-argument for a non-type, non-template
   //   template-parameter shall be one of: [...]
   //
@@ -1645,11 +1644,11 @@
   //        the name refers to a function or array, or if the
   //        corresponding template-parameter is a reference; or
   DeclRefExpr *DRE = 0;
-  
+
   // Ignore (and complain about) any excess parentheses.
   while (ParenExpr *Parens = dyn_cast<ParenExpr>(Arg)) {
     if (!Invalid) {
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_extra_parens)
         << Arg->getSourceRange();
       Invalid = true;
@@ -1665,7 +1664,7 @@
     DRE = dyn_cast<DeclRefExpr>(Arg);
 
   if (!DRE || !isa<ValueDecl>(DRE->getDecl()))
-    return Diag(Arg->getSourceRange().getBegin(), 
+    return Diag(Arg->getSourceRange().getBegin(),
                 diag::err_template_arg_not_object_or_func_form)
       << Arg->getSourceRange();
 
@@ -1677,14 +1676,14 @@
   // Cannot refer to non-static member functions
   if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(DRE->getDecl()))
     if (!Method->isStatic())
-      return Diag(Arg->getSourceRange().getBegin(), 
+      return Diag(Arg->getSourceRange().getBegin(),
                   diag::err_template_arg_method)
         << Method << Arg->getSourceRange();
-   
+
   // Functions must have external linkage.
   if (FunctionDecl *Func = dyn_cast<FunctionDecl>(DRE->getDecl())) {
     if (Func->getStorageClass() == FunctionDecl::Static) {
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_function_not_extern)
         << Func << Arg->getSourceRange();
       Diag(Func->getLocation(), diag::note_template_arg_internal_object)
@@ -1699,7 +1698,7 @@
 
   if (VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
     if (!Var->hasGlobalStorage()) {
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_object_not_extern)
         << Var << Arg->getSourceRange();
       Diag(Var->getLocation(), diag::note_template_arg_internal_object)
@@ -1711,19 +1710,19 @@
     Entity = Var;
     return Invalid;
   }
-  
+
   // We found something else, but we don't know specifically what it is.
-  Diag(Arg->getSourceRange().getBegin(), 
+  Diag(Arg->getSourceRange().getBegin(),
        diag::err_template_arg_not_object_or_func)
       << Arg->getSourceRange();
-  Diag(DRE->getDecl()->getLocation(), 
+  Diag(DRE->getDecl()->getLocation(),
        diag::note_template_arg_refers_here);
   return true;
 }
 
 /// \brief Checks whether the given template argument is a pointer to
 /// member constant according to C++ [temp.arg.nontype]p1.
-bool 
+bool
 Sema::CheckTemplateArgumentPointerToMember(Expr *Arg, NamedDecl *&Member) {
   bool Invalid = false;
 
@@ -1736,7 +1735,7 @@
     return false;
 
   // C++ [temp.arg.nontype]p1:
-  // 
+  //
   //   A template-argument for a non-type, non-template
   //   template-parameter shall be one of: [...]
   //
@@ -1746,7 +1745,7 @@
   // Ignore (and complain about) any excess parentheses.
   while (ParenExpr *Parens = dyn_cast<ParenExpr>(Arg)) {
     if (!Invalid) {
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_extra_parens)
         << Arg->getSourceRange();
       Invalid = true;
@@ -1776,10 +1775,10 @@
   }
 
   // We found something else, but we don't know specifically what it is.
-  Diag(Arg->getSourceRange().getBegin(), 
+  Diag(Arg->getSourceRange().getBegin(),
        diag::err_template_arg_not_pointer_to_member_form)
       << Arg->getSourceRange();
-  Diag(DRE->getDecl()->getLocation(), 
+  Diag(DRE->getDecl()->getLocation(),
        diag::note_template_arg_refers_here);
   return true;
 }
@@ -1794,7 +1793,7 @@
 ///
 /// If no error was detected, Converted receives the converted template argument.
 bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
-                                 QualType InstantiatedParamType, Expr *&Arg, 
+                                 QualType InstantiatedParamType, Expr *&Arg,
                                  TemplateArgument &Converted) {
   SourceLocation StartLoc = Arg->getSourceRange().getBegin();
 
@@ -1830,7 +1829,7 @@
     SourceLocation NonConstantLoc;
     llvm::APSInt Value;
     if (!ArgType->isIntegralType() && !ArgType->isEnumeralType()) {
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_not_integral_or_enumeral)
         << ArgType << Arg->getSourceRange();
       Diag(Param->getLocation(), diag::note_template_param_here);
@@ -1859,7 +1858,7 @@
       ImpCastExprToType(Arg, ParamType);
     } else {
       // We can't perform this conversion.
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_not_convertible)
         << Arg->getType() << InstantiatedParamType << Arg->getSourceRange();
       Diag(Param->getLocation(), diag::note_template_param_here);
@@ -1885,7 +1884,7 @@
       // Check that we don't overflow the template parameter type.
       unsigned AllowedBits = Context.getTypeSize(IntegerType);
       if (Value.getActiveBits() > AllowedBits) {
-        Diag(Arg->getSourceRange().getBegin(), 
+        Diag(Arg->getSourceRange().getBegin(),
              diag::err_template_arg_too_large)
           << Value.toString(10) << Param->getType()
           << Arg->getSourceRange();
@@ -1909,7 +1908,7 @@
     }
 
     Converted = TemplateArgument(StartLoc, Value,
-                                 ParamType->isEnumeralType() ? ParamType 
+                                 ParamType->isEnumeralType() ? ParamType
                                                              : IntegerType);
     return false;
   }
@@ -1939,7 +1938,7 @@
       (ParamType->isMemberPointerType() &&
        ParamType->getAs<MemberPointerType>()->getPointeeType()
          ->isFunctionType())) {
-    if (Context.hasSameUnqualifiedType(ArgType, 
+    if (Context.hasSameUnqualifiedType(ArgType,
                                        ParamType.getNonReferenceType())) {
       // We don't have to do anything: the types already match.
     } else if (ArgType->isNullPtrType() && (ParamType->isPointerType() ||
@@ -1949,7 +1948,7 @@
     } else if (ArgType->isFunctionType() && ParamType->isPointerType()) {
       ArgType = Context.getPointerType(ArgType);
       ImpCastExprToType(Arg, ArgType);
-    } else if (FunctionDecl *Fn 
+    } else if (FunctionDecl *Fn
                  = ResolveAddressOfOverloadedFunction(Arg, ParamType, true)) {
       if (DiagnoseUseOfDecl(Fn, Arg->getSourceRange().getBegin()))
         return true;
@@ -1962,16 +1961,16 @@
       }
     }
 
-    if (!Context.hasSameUnqualifiedType(ArgType, 
+    if (!Context.hasSameUnqualifiedType(ArgType,
                                         ParamType.getNonReferenceType())) {
       // We can't perform this conversion.
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_not_convertible)
         << Arg->getType() << InstantiatedParamType << Arg->getSourceRange();
       Diag(Param->getLocation(), diag::note_template_param_here);
       return true;
     }
-    
+
     if (ParamType->isMemberPointerType()) {
       NamedDecl *Member = 0;
       if (CheckTemplateArgumentPointerToMember(Arg, Member))
@@ -1982,7 +1981,7 @@
       Converted = TemplateArgument(StartLoc, Member);
       return false;
     }
-    
+
     NamedDecl *Entity = 0;
     if (CheckTemplateArgumentAddressOfObjectOrFunction(Arg, Entity))
       return true;
@@ -2013,16 +2012,16 @@
       ArgType = ParamType;
       ImpCastExprToType(Arg, ParamType);
     }
-    
+
     if (!Context.hasSameUnqualifiedType(ArgType, ParamType)) {
       // We can't perform this conversion.
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_not_convertible)
         << Arg->getType() << InstantiatedParamType << Arg->getSourceRange();
       Diag(Param->getLocation(), diag::note_template_param_here);
       return true;
     }
-    
+
     NamedDecl *Entity = 0;
     if (CheckTemplateArgumentAddressOfObjectOrFunction(Arg, Entity))
       return true;
@@ -2032,7 +2031,7 @@
     Converted = TemplateArgument(StartLoc, Entity);
     return false;
   }
-    
+
   if (const ReferenceType *ParamRefType = ParamType->getAs<ReferenceType>()) {
     //   -- For a non-type template-parameter of type reference to
     //      object, no conversions apply. The type referred to by the
@@ -2044,7 +2043,7 @@
            "Only object references allowed here");
 
     if (!Context.hasSameUnqualifiedType(ParamRefType->getPointeeType(), ArgType)) {
-      Diag(Arg->getSourceRange().getBegin(), 
+      Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_no_ref_bind)
         << InstantiatedParamType << Arg->getType()
         << Arg->getSourceRange();
@@ -2052,10 +2051,10 @@
       return true;
     }
 
-    unsigned ParamQuals 
+    unsigned ParamQuals
       = Context.getCanonicalType(ParamType).getCVRQualifiers();
     unsigned ArgQuals = Context.getCanonicalType(ArgType).getCVRQualifiers();
-    
+
     if ((ParamQuals | ArgQuals) != ParamQuals) {
       Diag(Arg->getSourceRange().getBegin(),
            diag::err_template_arg_ref_bind_ignores_quals)
@@ -2064,7 +2063,7 @@
       Diag(Param->getLocation(), diag::note_template_param_here);
       return true;
     }
-    
+
     NamedDecl *Entity = 0;
     if (CheckTemplateArgumentAddressOfObjectOrFunction(Arg, Entity))
       return true;
@@ -2087,17 +2086,17 @@
     ImpCastExprToType(Arg, ParamType);
   } else {
     // We can't perform this conversion.
-    Diag(Arg->getSourceRange().getBegin(), 
+    Diag(Arg->getSourceRange().getBegin(),
          diag::err_template_arg_not_convertible)
       << Arg->getType() << InstantiatedParamType << Arg->getSourceRange();
     Diag(Param->getLocation(), diag::note_template_param_here);
-    return true;    
+    return true;
   }
 
   NamedDecl *Member = 0;
   if (CheckTemplateArgumentPointerToMember(Arg, Member))
     return true;
-  
+
   if (Member)
     Member = cast<NamedDecl>(Member->getCanonicalDecl());
   Converted = TemplateArgument(StartLoc, Member);
@@ -2125,9 +2124,9 @@
   // Note that we also allow template template parameters here, which
   // will happen when we are dealing with, e.g., class template
   // partial specializations.
-  if (!isa<ClassTemplateDecl>(Template) && 
+  if (!isa<ClassTemplateDecl>(Template) &&
       !isa<TemplateTemplateParmDecl>(Template)) {
-    assert(isa<FunctionTemplateDecl>(Template) && 
+    assert(isa<FunctionTemplateDecl>(Template) &&
            "Only function templates are possible here");
     Diag(Arg->getLocStart(), diag::err_template_arg_not_class_template);
     Diag(Template->getLocation(), diag::note_template_arg_refers_here_func)
@@ -2143,7 +2142,7 @@
 /// \brief Determine whether the given template parameter lists are
 /// equivalent.
 ///
-/// \param New  The new template parameter list, typically written in the 
+/// \param New  The new template parameter list, typically written in the
 /// source code as part of a new template declaration.
 ///
 /// \param Old  The old template parameter list, typically found via
@@ -2165,7 +2164,7 @@
 ///
 /// \returns True if the template parameter lists are equal, false
 /// otherwise.
-bool 
+bool
 Sema::TemplateParameterListsAreEqual(TemplateParameterList *New,
                                      TemplateParameterList *Old,
                                      bool Complain,
@@ -2177,7 +2176,7 @@
       if (TemplateArgLoc.isValid()) {
         Diag(TemplateArgLoc, diag::err_template_arg_template_params_mismatch);
         NextDiag = diag::note_template_param_list_different_arity;
-      } 
+      }
       Diag(New->getTemplateLoc(), NextDiag)
           << (New->size() > Old->size())
           << IsTemplateTemplateParm
@@ -2218,15 +2217,15 @@
       // types within the template parameter list of the template template
       // parameter can be checked, and (2) the template type parameter depths
       // will match up.
-      QualType OldParmType 
+      QualType OldParmType
         = Context.getTypeDeclType(cast<TemplateTypeParmDecl>(*OldParm));
-      QualType NewParmType 
+      QualType NewParmType
         = Context.getTypeDeclType(cast<TemplateTypeParmDecl>(*NewParm));
-      assert(Context.getCanonicalType(OldParmType) == 
-             Context.getCanonicalType(NewParmType) && 
+      assert(Context.getCanonicalType(OldParmType) ==
+             Context.getCanonicalType(NewParmType) &&
              "type parameter mismatch?");
 #endif
-    } else if (NonTypeTemplateParmDecl *OldNTTP 
+    } else if (NonTypeTemplateParmDecl *OldNTTP
                  = dyn_cast<NonTypeTemplateParmDecl>(*OldParm)) {
       // The types of non-type template parameters must agree.
       NonTypeTemplateParmDecl *NewNTTP
@@ -2236,14 +2235,14 @@
         if (Complain) {
           unsigned NextDiag = diag::err_template_nontype_parm_different_type;
           if (TemplateArgLoc.isValid()) {
-            Diag(TemplateArgLoc, 
+            Diag(TemplateArgLoc,
                  diag::err_template_arg_template_params_mismatch);
             NextDiag = diag::note_template_nontype_parm_different_type;
           }
           Diag(NewNTTP->getLocation(), NextDiag)
             << NewNTTP->getType()
             << IsTemplateTemplateParm;
-          Diag(OldNTTP->getLocation(), 
+          Diag(OldNTTP->getLocation(),
                diag::note_template_nontype_parm_prev_declaration)
             << OldNTTP->getType();
         }
@@ -2253,9 +2252,9 @@
       // The template parameter lists of template template
       // parameters must agree.
       // FIXME: Could we perform a faster "type" comparison here?
-      assert(isa<TemplateTemplateParmDecl>(*OldParm) && 
+      assert(isa<TemplateTemplateParmDecl>(*OldParm) &&
              "Only template template parameters handled here");
-      TemplateTemplateParmDecl *OldTTP 
+      TemplateTemplateParmDecl *OldTTP
         = cast<TemplateTemplateParmDecl>(*OldParm);
       TemplateTemplateParmDecl *NewTTP
         = cast<TemplateTemplateParmDecl>(*NewParm);
@@ -2275,29 +2274,29 @@
 ///
 /// If the template declaration is valid in this scope, returns
 /// false. Otherwise, issues a diagnostic and returns true.
-bool 
+bool
 Sema::CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams) {
   // Find the nearest enclosing declaration scope.
   while ((S->getFlags() & Scope::DeclScope) == 0 ||
          (S->getFlags() & Scope::TemplateParamScope) != 0)
     S = S->getParent();
-  
+
   // C++ [temp]p2:
   //   A template-declaration can appear only as a namespace scope or
   //   class scope declaration.
   DeclContext *Ctx = static_cast<DeclContext *>(S->getEntity());
   if (Ctx && isa<LinkageSpecDecl>(Ctx) &&
       cast<LinkageSpecDecl>(Ctx)->getLanguage() != LinkageSpecDecl::lang_cxx)
-    return Diag(TemplateParams->getTemplateLoc(), diag::err_template_linkage) 
+    return Diag(TemplateParams->getTemplateLoc(), diag::err_template_linkage)
              << TemplateParams->getSourceRange();
-  
+
   while (Ctx && isa<LinkageSpecDecl>(Ctx))
     Ctx = Ctx->getParent();
 
   if (Ctx && (Ctx->isFileContext() || Ctx->isRecord()))
     return false;
 
-  return Diag(TemplateParams->getTemplateLoc(), 
+  return Diag(TemplateParams->getTemplateLoc(),
               diag::err_template_outside_namespace_or_class_scope)
     << TemplateParams->getSourceRange();
 }
@@ -2306,11 +2305,11 @@
 /// instantiation in the current context is well-formed.
 ///
 /// This routine determines whether a class template specialization or
-/// explicit instantiation can be declared in the current context 
-/// (C++ [temp.expl.spec]p2, C++0x [temp.explicit]p2) and emits 
-/// appropriate diagnostics if there was an error. It returns true if 
+/// explicit instantiation can be declared in the current context
+/// (C++ [temp.expl.spec]p2, C++0x [temp.explicit]p2) and emits
+/// appropriate diagnostics if there was an error. It returns true if
 // there was an error that we cannot recover from, and false otherwise.
-bool 
+bool
 Sema::CheckClassTemplateSpecializationScope(ClassTemplateDecl *ClassTemplate,
                                    ClassTemplateSpecializationDecl *PrevDecl,
                                             SourceLocation TemplateNameLoc,
@@ -2338,7 +2337,7 @@
   }
 
   DeclContext *DC = CurContext->getEnclosingNamespaceContext();
-  DeclContext *TemplateContext 
+  DeclContext *TemplateContext
     = ClassTemplate->getDeclContext()->getEnclosingNamespaceContext();
   if ((!PrevDecl || PrevDecl->getSpecializationKind() == TSK_Undeclared) &&
       !ExplicitInstantiation) {
@@ -2352,7 +2351,7 @@
           << ClassTemplate << ScopeSpecifierRange;
       else if (isa<NamespaceDecl>(TemplateContext))
         Diag(TemplateNameLoc, diag::err_template_spec_decl_out_of_scope)
-          << PartialSpecialization << ClassTemplate 
+          << PartialSpecialization << ClassTemplate
           << cast<NamedDecl>(TemplateContext) << ScopeSpecifierRange;
 
       Diag(ClassTemplate->getLocation(), diag::note_template_decl_here);
@@ -2379,10 +2378,10 @@
         Diag(TemplateNameLoc, diag::err_template_spec_redecl_out_of_scope)
           << Kind << ClassTemplate
           << cast<NamedDecl>(TemplateContext) << ScopeSpecifierRange;
-      else 
+      else
         SuppressedDiag = true;
     }
-    
+
     if (!SuppressedDiag)
       Diag(ClassTemplate->getLocation(), diag::note_template_decl_here);
   }
@@ -2413,16 +2412,16 @@
   // FIXME: the interface to this function will have to change to
   // accommodate variadic templates.
   MirrorsPrimaryTemplate = true;
-  
+
   const TemplateArgument *ArgList = TemplateArgs.getFlatArguments();
-  
+
   for (unsigned I = 0, N = TemplateParams->size(); I != N; ++I) {
     // Determine whether the template argument list of the partial
     // specialization is identical to the implicit argument list of
     // the primary template. The caller may need to diagnostic this as
     // an error per C++ [temp.class.spec]p9b3.
     if (MirrorsPrimaryTemplate) {
-      if (TemplateTypeParmDecl *TTP 
+      if (TemplateTypeParmDecl *TTP
             = dyn_cast<TemplateTypeParmDecl>(TemplateParams->getParam(I))) {
         if (Context.getCanonicalType(Context.getTypeDeclType(TTP)) !=
               Context.getCanonicalType(ArgList[I].getAsType()))
@@ -2432,11 +2431,11 @@
                                                  TemplateParams->getParam(I))) {
         // FIXME: We should settle on either Declaration storage or
         // Expression storage for template template parameters.
-        TemplateTemplateParmDecl *ArgDecl 
+        TemplateTemplateParmDecl *ArgDecl
           = dyn_cast_or_null<TemplateTemplateParmDecl>(
                                                   ArgList[I].getAsDecl());
         if (!ArgDecl)
-          if (DeclRefExpr *DRE 
+          if (DeclRefExpr *DRE
                 = dyn_cast_or_null<DeclRefExpr>(ArgList[I].getAsExpr()))
             ArgDecl = dyn_cast<TemplateTemplateParmDecl>(DRE->getDecl());
 
@@ -2447,7 +2446,7 @@
       }
     }
 
-    NonTypeTemplateParmDecl *Param 
+    NonTypeTemplateParmDecl *Param
       = dyn_cast<NonTypeTemplateParmDecl>(TemplateParams->getParam(I));
     if (!Param) {
       continue;
@@ -2468,9 +2467,9 @@
     // specialized non-type arguments, so skip any non-specialized
     // arguments.
     if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ArgExpr))
-      if (NonTypeTemplateParmDecl *NTTP 
+      if (NonTypeTemplateParmDecl *NTTP
             = dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl())) {
-        if (MirrorsPrimaryTemplate && 
+        if (MirrorsPrimaryTemplate &&
             (Param->getIndex() != NTTP->getIndex() ||
              Param->getDepth() != NTTP->getDepth()))
           MirrorsPrimaryTemplate = false;
@@ -2486,7 +2485,7 @@
     //        specialization except when the argument expression is a
     //        simple identifier.
     if (ArgExpr->isTypeDependent() || ArgExpr->isValueDependent()) {
-      Diag(ArgExpr->getLocStart(), 
+      Diag(ArgExpr->getLocStart(),
            diag::err_dependent_non_type_arg_in_partial_spec)
         << ArgExpr->getSourceRange();
       return true;
@@ -2496,7 +2495,7 @@
     //        specialized non-type argument shall not be dependent on a
     //        parameter of the specialization.
     if (Param->getType()->isDependentType()) {
-      Diag(ArgExpr->getLocStart(), 
+      Diag(ArgExpr->getLocStart(),
            diag::err_dependent_typed_non_type_arg_in_partial_spec)
         << Param->getType()
         << ArgExpr->getSourceRange();
@@ -2513,7 +2512,7 @@
 Sema::DeclResult
 Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
                                        TagUseKind TUK,
-                                       SourceLocation KWLoc, 
+                                       SourceLocation KWLoc,
                                        const CXXScopeSpec &SS,
                                        TemplateTy TemplateD,
                                        SourceLocation TemplateNameLoc,
@@ -2527,7 +2526,7 @@
 
   // Find the class template we're specializing
   TemplateName Name = TemplateD.getAsVal<TemplateName>();
-  ClassTemplateDecl *ClassTemplate 
+  ClassTemplateDecl *ClassTemplate
     = cast<ClassTemplateDecl>(Name.getAsTemplateDecl());
 
   bool isPartialSpecialization = false;
@@ -2535,8 +2534,8 @@
   // Check the validity of the template headers that introduce this
   // template.
   TemplateParameterList *TemplateParams
-    = MatchTemplateParametersToScopeSpecifier(TemplateNameLoc, SS, 
-                        (TemplateParameterList**)TemplateParameterLists.get(), 
+    = MatchTemplateParametersToScopeSpecifier(TemplateNameLoc, SS,
+                        (TemplateParameterList**)TemplateParameterLists.get(),
                                               TemplateParameterLists.size());
   if (TemplateParams && TemplateParams->size() > 0) {
     isPartialSpecialization = true;
@@ -2548,14 +2547,14 @@
       Decl *Param = TemplateParams->getParam(I);
       if (TemplateTypeParmDecl *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
         if (TTP->hasDefaultArgument()) {
-          Diag(TTP->getDefaultArgumentLoc(), 
+          Diag(TTP->getDefaultArgumentLoc(),
                diag::err_default_arg_in_partial_spec);
           TTP->setDefaultArgument(QualType(), SourceLocation(), false);
         }
       } else if (NonTypeTemplateParmDecl *NTTP
                    = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
         if (Expr *DefArg = NTTP->getDefaultArgument()) {
-          Diag(NTTP->getDefaultArgumentLoc(), 
+          Diag(NTTP->getDefaultArgumentLoc(),
                diag::err_default_arg_in_partial_spec)
             << DefArg->getSourceRange();
           NTTP->setDefaultArgument(0);
@@ -2564,7 +2563,7 @@
       } else {
         TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(Param);
         if (Expr *DefArg = TTP->getDefaultArgument()) {
-          Diag(TTP->getDefaultArgumentLoc(), 
+          Diag(TTP->getDefaultArgumentLoc(),
                diag::err_default_arg_in_partial_spec)
             << DefArg->getSourceRange();
           TTP->setDefaultArgument(0);
@@ -2586,13 +2585,13 @@
   case DeclSpec::TST_class:  Kind = TagDecl::TK_class; break;
   }
   if (!isAcceptableTagRedeclaration(ClassTemplate->getTemplatedDecl(),
-                                    Kind, KWLoc, 
+                                    Kind, KWLoc,
                                     *ClassTemplate->getIdentifier())) {
-    Diag(KWLoc, diag::err_use_with_wrong_tag) 
+    Diag(KWLoc, diag::err_use_with_wrong_tag)
       << ClassTemplate
-      << CodeModificationHint::CreateReplacement(KWLoc, 
+      << CodeModificationHint::CreateReplacement(KWLoc,
                             ClassTemplate->getTemplatedDecl()->getKindName());
-    Diag(ClassTemplate->getTemplatedDecl()->getLocation(), 
+    Diag(ClassTemplate->getTemplatedDecl()->getLocation(),
          diag::note_previous_use);
     Kind = ClassTemplate->getTemplatedDecl()->getTagKind();
   }
@@ -2605,15 +2604,15 @@
   // template.
   TemplateArgumentListBuilder Converted(ClassTemplate->getTemplateParameters(),
                                         TemplateArgs.size());
-  if (CheckTemplateArgumentList(ClassTemplate, TemplateNameLoc, LAngleLoc, 
+  if (CheckTemplateArgumentList(ClassTemplate, TemplateNameLoc, LAngleLoc,
                                 TemplateArgs.data(), TemplateArgs.size(),
                                 RAngleLoc, false, Converted))
     return true;
 
-  assert((Converted.structuredSize() == 
+  assert((Converted.structuredSize() ==
             ClassTemplate->getTemplateParameters()->size()) &&
          "Converted template argument list is too short!");
-  
+
   // Find the class template (partial) specialization declaration that
   // corresponds to these arguments.
   llvm::FoldingSetNodeID ID;
@@ -2627,11 +2626,11 @@
     if (MirrorsPrimaryTemplate) {
       // C++ [temp.class.spec]p9b3:
       //
-      //   -- The argument list of the specialization shall not be identical 
-      //      to the implicit argument list of the primary template. 
+      //   -- The argument list of the specialization shall not be identical
+      //      to the implicit argument list of the primary template.
       Diag(TemplateNameLoc, diag::err_partial_spec_args_match_primary_template)
         << (TUK == TUK_Definition)
-        << CodeModificationHint::CreateRemoval(SourceRange(LAngleLoc, 
+        << CodeModificationHint::CreateRemoval(SourceRange(LAngleLoc,
                                                            RAngleLoc));
       return CheckClassTemplate(S, TagSpec, TUK, KWLoc, SS,
                                 ClassTemplate->getIdentifier(),
@@ -2642,7 +2641,7 @@
     }
 
     // FIXME: Template parameter list matters, too
-    ClassTemplatePartialSpecializationDecl::Profile(ID, 
+    ClassTemplatePartialSpecializationDecl::Profile(ID,
                                                    Converted.getFlatArguments(),
                                                    Converted.flatSize(),
                                                     Context);
@@ -2656,7 +2655,7 @@
 
   if (isPartialSpecialization)
     PrevDecl
-      = ClassTemplate->getPartialSpecializations().FindNodeOrInsertPos(ID, 
+      = ClassTemplate->getPartialSpecializations().FindNodeOrInsertPos(ID,
                                                                     InsertPos);
   else
     PrevDecl
@@ -2667,7 +2666,7 @@
   // Check whether we can declare a class template specialization in
   // the current scope.
   if (CheckClassTemplateSpecializationScope(ClassTemplate, PrevDecl,
-                                            TemplateNameLoc, 
+                                            TemplateNameLoc,
                                             SS.getRange(),
                                             isPartialSpecialization,
                                             /*ExplicitInstantiation=*/false))
@@ -2693,12 +2692,12 @@
                                                   Converted.flatSize());
 
     // Create a new class template partial specialization declaration node.
-    TemplateParameterList *TemplateParams 
+    TemplateParameterList *TemplateParams
       = static_cast<TemplateParameterList*>(*TemplateParameterLists.get());
     ClassTemplatePartialSpecializationDecl *PrevPartial
       = cast_or_null<ClassTemplatePartialSpecializationDecl>(PrevDecl);
-    ClassTemplatePartialSpecializationDecl *Partial 
-      = ClassTemplatePartialSpecializationDecl::Create(Context, 
+    ClassTemplatePartialSpecializationDecl *Partial
+      = ClassTemplatePartialSpecializationDecl::Create(Context,
                                              ClassTemplate->getDeclContext(),
                                                        TemplateNameLoc,
                                                        TemplateParams,
@@ -2734,11 +2733,11 @@
         if (!DeducibleParams[I]) {
           NamedDecl *Param = cast<NamedDecl>(TemplateParams->getParam(I));
           if (Param->getDeclName())
-            Diag(Param->getLocation(), 
+            Diag(Param->getLocation(),
                  diag::note_partial_spec_unused_parameter)
               << Param->getDeclName();
           else
-            Diag(Param->getLocation(), 
+            Diag(Param->getLocation(),
                  diag::note_partial_spec_unused_parameter)
               << std::string("<anonymous>");
         }
@@ -2748,10 +2747,10 @@
     // Create a new class template specialization declaration node for
     // this explicit specialization.
     Specialization
-      = ClassTemplateSpecializationDecl::Create(Context, 
+      = ClassTemplateSpecializationDecl::Create(Context,
                                              ClassTemplate->getDeclContext(),
                                                 TemplateNameLoc,
-                                                ClassTemplate, 
+                                                ClassTemplate,
                                                 Converted,
                                                 PrevDecl);
 
@@ -2759,7 +2758,7 @@
       ClassTemplate->getSpecializations().RemoveNode(PrevDecl);
       ClassTemplate->getSpecializations().GetOrInsertNode(Specialization);
     } else {
-      ClassTemplate->getSpecializations().InsertNode(Specialization, 
+      ClassTemplate->getSpecializations().InsertNode(Specialization,
                                                      InsertPos);
     }
 
@@ -2775,7 +2774,7 @@
       // FIXME: Should also handle explicit specialization after implicit
       // instantiation with a special diagnostic.
       SourceRange Range(TemplateNameLoc, RAngleLoc);
-      Diag(TemplateNameLoc, diag::err_redefinition) 
+      Diag(TemplateNameLoc, diag::err_redefinition)
         << Context.getTypeDeclType(Specialization) << Range;
       Diag(Def->getLocation(), diag::note_previous_definition);
       Specialization->setInvalidDecl();
@@ -2790,8 +2789,8 @@
   // actually wrote the specialization, rather than formatting the
   // name based on the "canonical" representation used to store the
   // template arguments in the specialization.
-  QualType WrittenTy 
-    = Context.getTemplateSpecializationType(Name, 
+  QualType WrittenTy
+    = Context.getTemplateSpecializationType(Name,
                                             TemplateArgs.data(),
                                             TemplateArgs.size(),
                                             CanonType);
@@ -2807,7 +2806,7 @@
   // but we also maintain the lexical context where the actual
   // definition occurs.
   Specialization->setLexicalDeclContext(CurContext);
-  
+
   // We may be starting the definition of this specialization.
   if (TUK == TUK_Definition)
     Specialization->startDefinition();
@@ -2819,34 +2818,34 @@
   return DeclPtrTy::make(Specialization);
 }
 
-Sema::DeclPtrTy 
-Sema::ActOnTemplateDeclarator(Scope *S, 
+Sema::DeclPtrTy
+Sema::ActOnTemplateDeclarator(Scope *S,
                               MultiTemplateParamsArg TemplateParameterLists,
                               Declarator &D) {
   return HandleDeclarator(S, D, move(TemplateParameterLists), false);
 }
 
-Sema::DeclPtrTy 
-Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope, 
+Sema::DeclPtrTy
+Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
                                MultiTemplateParamsArg TemplateParameterLists,
                                       Declarator &D) {
   assert(getCurFunctionDecl() == 0 && "Function parsing confused");
   assert(D.getTypeObject(0).Kind == DeclaratorChunk::Function &&
          "Not a function declarator!");
   DeclaratorChunk::FunctionTypeInfo &FTI = D.getTypeObject(0).Fun;
-  
+
   if (FTI.hasPrototype) {
-    // FIXME: Diagnose arguments without names in C. 
+    // FIXME: Diagnose arguments without names in C.
   }
-  
+
   Scope *ParentScope = FnBodyScope->getParent();
-  
-  DeclPtrTy DP = HandleDeclarator(ParentScope, D, 
+
+  DeclPtrTy DP = HandleDeclarator(ParentScope, D,
                                   move(TemplateParameterLists),
                                   /*IsFunctionDefinition=*/true);
-  if (FunctionTemplateDecl *FunctionTemplate 
+  if (FunctionTemplateDecl *FunctionTemplate
         = dyn_cast_or_null<FunctionTemplateDecl>(DP.getAs<Decl>()))
-    return ActOnStartOfFunctionDef(FnBodyScope, 
+    return ActOnStartOfFunctionDef(FnBodyScope,
                       DeclPtrTy::make(FunctionTemplate->getTemplatedDecl()));
   if (FunctionDecl *Function = dyn_cast_or_null<FunctionDecl>(DP.getAs<Decl>()))
     return ActOnStartOfFunctionDef(FnBodyScope, DeclPtrTy::make(Function));
@@ -2856,10 +2855,10 @@
 // Explicit instantiation of a class template specialization
 // FIXME: Implement extern template semantics
 Sema::DeclResult
-Sema::ActOnExplicitInstantiation(Scope *S, 
+Sema::ActOnExplicitInstantiation(Scope *S,
                                  SourceLocation ExternLoc,
                                  SourceLocation TemplateLoc,
-                                 unsigned TagSpec, 
+                                 unsigned TagSpec,
                                  SourceLocation KWLoc,
                                  const CXXScopeSpec &SS,
                                  TemplateTy TemplateD,
@@ -2871,7 +2870,7 @@
                                  AttributeList *Attr) {
   // Find the class template we're specializing
   TemplateName Name = TemplateD.getAsVal<TemplateName>();
-  ClassTemplateDecl *ClassTemplate 
+  ClassTemplateDecl *ClassTemplate
     = cast<ClassTemplateDecl>(Name.getAsTemplateDecl());
 
   // Check that the specialization uses the same tag kind as the
@@ -2884,13 +2883,13 @@
   case DeclSpec::TST_class:  Kind = TagDecl::TK_class; break;
   }
   if (!isAcceptableTagRedeclaration(ClassTemplate->getTemplatedDecl(),
-                                    Kind, KWLoc, 
+                                    Kind, KWLoc,
                                     *ClassTemplate->getIdentifier())) {
-    Diag(KWLoc, diag::err_use_with_wrong_tag) 
+    Diag(KWLoc, diag::err_use_with_wrong_tag)
       << ClassTemplate
-      << CodeModificationHint::CreateReplacement(KWLoc, 
+      << CodeModificationHint::CreateReplacement(KWLoc,
                             ClassTemplate->getTemplatedDecl()->getKindName());
-    Diag(ClassTemplate->getTemplatedDecl()->getLocation(), 
+    Diag(ClassTemplate->getTemplatedDecl()->getLocation(),
          diag::note_previous_use);
     Kind = ClassTemplate->getTemplatedDecl()->getTagKind();
   }
@@ -2901,7 +2900,7 @@
   //
   // This is C++ DR 275.
   if (CheckClassTemplateSpecializationScope(ClassTemplate, 0,
-                                            TemplateNameLoc, 
+                                            TemplateNameLoc,
                                             SS.getRange(),
                                             /*PartialSpecialization=*/false,
                                             /*ExplicitInstantiation=*/true))
@@ -2915,19 +2914,19 @@
   // template.
   TemplateArgumentListBuilder Converted(ClassTemplate->getTemplateParameters(),
                                         TemplateArgs.size());
-  if (CheckTemplateArgumentList(ClassTemplate, TemplateNameLoc, LAngleLoc, 
+  if (CheckTemplateArgumentList(ClassTemplate, TemplateNameLoc, LAngleLoc,
                                 TemplateArgs.data(), TemplateArgs.size(),
                                 RAngleLoc, false, Converted))
     return true;
 
-  assert((Converted.structuredSize() == 
+  assert((Converted.structuredSize() ==
             ClassTemplate->getTemplateParameters()->size()) &&
          "Converted template argument list is too short!");
-  
+
   // Find the class template specialization declaration that
   // corresponds to these arguments.
   llvm::FoldingSetNodeID ID;
-  ClassTemplateSpecializationDecl::Profile(ID, 
+  ClassTemplateSpecializationDecl::Profile(ID,
                                            Converted.getFlatArguments(),
                                            Converted.flatSize(),
                                            Context);
@@ -2939,13 +2938,13 @@
 
   bool SpecializationRequiresInstantiation = true;
   if (PrevDecl) {
-    if (PrevDecl->getSpecializationKind() 
+    if (PrevDecl->getSpecializationKind()
           == TSK_ExplicitInstantiationDefinition) {
       // This particular specialization has already been declared or
       // instantiated. We cannot explicitly instantiate it.
       Diag(TemplateNameLoc, diag::err_explicit_instantiation_duplicate)
         << Context.getTypeDeclType(PrevDecl);
-      Diag(PrevDecl->getLocation(), 
+      Diag(PrevDecl->getLocation(),
            diag::note_previous_explicit_instantiation);
       return DeclPtrTy::make(PrevDecl);
     }
@@ -2957,10 +2956,10 @@
       //   an explicit specialization for that template, the explicit
       //   instantiation has no effect.
       if (!getLangOptions().CPlusPlus0x) {
-        Diag(TemplateNameLoc, 
+        Diag(TemplateNameLoc,
              diag::ext_explicit_instantiation_after_specialization)
           << Context.getTypeDeclType(PrevDecl);
-        Diag(PrevDecl->getLocation(), 
+        Diag(PrevDecl->getLocation(),
              diag::note_previous_template_specialization);
       }
 
@@ -2970,7 +2969,7 @@
       // accurate reproduction of the source code; we don't actually
       // use it for anything, since it is semantically irrelevant.
       Specialization
-        = ClassTemplateSpecializationDecl::Create(Context, 
+        = ClassTemplateSpecializationDecl::Create(Context,
                                              ClassTemplate->getDeclContext(),
                                                   TemplateNameLoc,
                                                   ClassTemplate,
@@ -2996,13 +2995,13 @@
     // Create a new class template specialization declaration node for
     // this explicit specialization.
     Specialization
-      = ClassTemplateSpecializationDecl::Create(Context, 
+      = ClassTemplateSpecializationDecl::Create(Context,
                                              ClassTemplate->getDeclContext(),
                                                 TemplateNameLoc,
                                                 ClassTemplate,
                                                 Converted, 0);
 
-    ClassTemplate->getSpecializations().InsertNode(Specialization, 
+    ClassTemplate->getSpecializations().InsertNode(Specialization,
                                                    InsertPos);
   }
 
@@ -3013,8 +3012,8 @@
   // the explicit instantiation, rather than formatting the name based
   // on the "canonical" representation used to store the template
   // arguments in the specialization.
-  QualType WrittenTy 
-    = Context.getTemplateSpecializationType(Name, 
+  QualType WrittenTy
+    = Context.getTemplateSpecializationType(Name,
                                             TemplateArgs.data(),
                                             TemplateArgs.size(),
                                   Context.getTypeDeclType(Specialization));
@@ -3035,7 +3034,7 @@
   // This check comes when we actually try to perform the
   // instantiation.
   TemplateSpecializationKind TSK
-    = ExternLoc.isInvalid()? TSK_ExplicitInstantiationDefinition 
+    = ExternLoc.isInvalid()? TSK_ExplicitInstantiationDefinition
                            : TSK_ExplicitInstantiationDeclaration;
   if (SpecializationRequiresInstantiation)
     InstantiateClassTemplateSpecialization(Specialization, TSK);
@@ -3048,10 +3047,10 @@
 
 // Explicit instantiation of a member class of a class template.
 Sema::DeclResult
-Sema::ActOnExplicitInstantiation(Scope *S, 
+Sema::ActOnExplicitInstantiation(Scope *S,
                                  SourceLocation ExternLoc,
                                  SourceLocation TemplateLoc,
-                                 unsigned TagSpec, 
+                                 unsigned TagSpec,
                                  SourceLocation KWLoc,
                                  const CXXScopeSpec &SS,
                                  IdentifierInfo *Name,
@@ -3092,7 +3091,7 @@
   if (getLangOptions().CPlusPlus0x) {
     // FIXME: In C++98, we would like to turn these errors into warnings,
     // dependent on a -Wc++0x flag.
-    DeclContext *PatternContext 
+    DeclContext *PatternContext
       = Pattern->getDeclContext()->getEnclosingNamespaceContext();
     if (!CurContext->Encloses(PatternContext)) {
       Diag(TemplateLoc, diag::err_explicit_instantiation_out_of_scope)
@@ -3102,19 +3101,19 @@
   }
 
   TemplateSpecializationKind TSK
-    = ExternLoc.isInvalid()? TSK_ExplicitInstantiationDefinition 
+    = ExternLoc.isInvalid()? TSK_ExplicitInstantiationDefinition
                            : TSK_ExplicitInstantiationDeclaration;
-  
+
   if (!Record->getDefinition(Context)) {
     // If the class has a definition, instantiate it (and all of its
     // members, recursively).
     Pattern = cast_or_null<CXXRecordDecl>(Pattern->getDefinition(Context));
-    if (Pattern && InstantiateClass(TemplateLoc, Record, Pattern, 
+    if (Pattern && InstantiateClass(TemplateLoc, Record, Pattern,
                                     getTemplateInstantiationArgs(Record),
                                     TSK))
       return true;
   } else // Instantiate all of the members of the class.
-    InstantiateClassMembers(TemplateLoc, Record, 
+    InstantiateClassMembers(TemplateLoc, Record,
                             getTemplateInstantiationArgs(Record), TSK);
 
   // FIXME: We don't have any representation for explicit instantiations of
@@ -3127,7 +3126,7 @@
 Sema::TypeResult
 Sema::ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS,
                         const IdentifierInfo &II, SourceLocation IdLoc) {
-  NestedNameSpecifier *NNS 
+  NestedNameSpecifier *NNS
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
   if (!NNS)
     return true;
@@ -3142,9 +3141,9 @@
 Sema::ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS,
                         SourceLocation TemplateLoc, TypeTy *Ty) {
   QualType T = GetTypeFromParser(Ty);
-  NestedNameSpecifier *NNS 
+  NestedNameSpecifier *NNS
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
-  const TemplateSpecializationType *TemplateId 
+  const TemplateSpecializationType *TemplateId
     = T->getAsTemplateSpecializationType();
   assert(TemplateId && "Expected a template specialization type");
 
@@ -3152,11 +3151,11 @@
     // If we can compute a declaration context, then the "typename"
     // keyword was superfluous. Just build a QualifiedNameType to keep
     // track of the nested-name-specifier.
-    
+
     // FIXME: Note that the QualifiedNameType had the "typename" keyword!
     return Context.getQualifiedNameType(NNS, T).getAsOpaquePtr();
   }
-  
+
   return Context.getTypenameType(NNS, TemplateId).getAsOpaquePtr();
 }
 
@@ -3173,10 +3172,10 @@
     // instantiation, then build a typename type.
     if (!CurrentInstantiation)
       return Context.getTypenameType(NNS, &II);
-    
+
     // The nested-name-specifier refers to the current instantiation, so the
     // "typename" keyword itself is superfluous. In C++03, the program is
-    // actually ill-formed. However, DR 382 (in C++0x CD1) allows such 
+    // actually ill-formed. However, DR 382 (in C++0x CD1) allows such
     // extraneous "typename" keywords, and we retroactively apply this DR to
     // C++03 code.
   }
@@ -3197,7 +3196,7 @@
   assert(Ctx && "No declaration context?");
 
   DeclarationName Name(&II);
-  LookupResult Result = LookupQualifiedName(Ctx, Name, LookupOrdinaryName, 
+  LookupResult Result = LookupQualifiedName(Ctx, Name, LookupOrdinaryName,
                                             false);
   unsigned DiagID = 0;
   Decl *Referenced = 0;
@@ -3247,20 +3246,19 @@
 
 namespace {
   // See Sema::RebuildTypeInCurrentInstantiation
-  class VISIBILITY_HIDDEN CurrentInstantiationRebuilder 
-    : public TreeTransform<CurrentInstantiationRebuilder> 
-  {
+  class VISIBILITY_HIDDEN CurrentInstantiationRebuilder
+    : public TreeTransform<CurrentInstantiationRebuilder> {
     SourceLocation Loc;
     DeclarationName Entity;
-    
+
   public:
-    CurrentInstantiationRebuilder(Sema &SemaRef, 
+    CurrentInstantiationRebuilder(Sema &SemaRef,
                                   SourceLocation Loc,
-                                  DeclarationName Entity) 
-    : TreeTransform<CurrentInstantiationRebuilder>(SemaRef), 
+                                  DeclarationName Entity)
+    : TreeTransform<CurrentInstantiationRebuilder>(SemaRef),
       Loc(Loc), Entity(Entity) { }
-    
-    /// \brief Determine whether the given type \p T has already been 
+
+    /// \brief Determine whether the given type \p T has already been
     /// transformed.
     ///
     /// For the purposes of type reconstruction, a type has already been
@@ -3268,14 +3266,14 @@
     bool AlreadyTransformed(QualType T) {
       return T.isNull() || !T->isDependentType();
     }
-    
-    /// \brief Returns the location of the entity whose type is being 
+
+    /// \brief Returns the location of the entity whose type is being
     /// rebuilt.
     SourceLocation getBaseLocation() { return Loc; }
-    
+
     /// \brief Returns the name of the entity whose type is being rebuilt.
     DeclarationName getBaseEntity() { return Entity; }
-    
+
     /// \brief Transforms an expression by returning the expression itself
     /// (an identity function).
     ///
@@ -3284,7 +3282,7 @@
     Sema::OwningExprResult TransformExpr(Expr *E) {
       return getSema().Owned(E);
     }
-    
+
     /// \brief Transforms a typename type by determining whether the type now
     /// refers to a member of the current instantiation, and then
     /// type-checking and building a QualifiedNameType (when possible).
@@ -3292,7 +3290,7 @@
   };
 }
 
-QualType 
+QualType
 CurrentInstantiationRebuilder::TransformTypenameType(const TypenameType *T) {
   NestedNameSpecifier *NNS
     = TransformNestedNameSpecifier(T->getQualifier(),
@@ -3308,30 +3306,30 @@
   SS.setScopeRep(NNS);
   if (NNS == T->getQualifier() && getSema().computeDeclContext(SS) == 0)
     return QualType(T, 0);
-  
-  // Rebuild the typename type, which will probably turn into a 
+
+  // Rebuild the typename type, which will probably turn into a
   // QualifiedNameType.
   if (const TemplateSpecializationType *TemplateId = T->getTemplateId()) {
-    QualType NewTemplateId 
+    QualType NewTemplateId
       = TransformType(QualType(TemplateId, 0));
     if (NewTemplateId.isNull())
       return QualType();
-    
+
     if (NNS == T->getQualifier() &&
         NewTemplateId == QualType(TemplateId, 0))
       return QualType(T, 0);
-    
+
     return getDerived().RebuildTypenameType(NNS, NewTemplateId);
   }
-  
+
   return getDerived().RebuildTypenameType(NNS, T->getIdentifier());
 }
 
 /// \brief Rebuilds a type within the context of the current instantiation.
 ///
-/// The type \p T is part of the type of an out-of-line member definition of 
+/// The type \p T is part of the type of an out-of-line member definition of
 /// a class template (or class template partial specialization) that was parsed
-/// and constructed before we entered the scope of the class template (or 
+/// and constructed before we entered the scope of the class template (or
 /// partial specialization thereof). This routine will rebuild that type now
 /// that we have entered the declarator's scope, which may produce different
 /// canonical types, e.g.,
@@ -3357,7 +3355,7 @@
                                                  DeclarationName Name) {
   if (T.isNull() || !T->isDependentType())
     return T;
-  
+
   CurrentInstantiationRebuilder Rebuilder(*this, Loc, Name);
   return Rebuilder.TransformType(T);
 }

Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Wed Sep  9 10:08:12 2009
@@ -45,7 +45,7 @@
 using namespace clang;
 
 static Sema::TemplateDeductionResult
-DeduceTemplateArguments(ASTContext &Context, 
+DeduceTemplateArguments(ASTContext &Context,
                         TemplateParameterList *TemplateParams,
                         const TemplateArgument &Param,
                         const TemplateArgument &Arg,
@@ -58,27 +58,27 @@
 static NonTypeTemplateParmDecl *getDeducedParameterFromExpr(Expr *E) {
   if (ImplicitCastExpr *IC = dyn_cast<ImplicitCastExpr>(E))
     E = IC->getSubExpr();
-  
+
   if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
     return dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl());
-  
+
   return 0;
 }
 
-/// \brief Deduce the value of the given non-type template parameter 
+/// \brief Deduce the value of the given non-type template parameter
 /// from the given constant.
 static Sema::TemplateDeductionResult
-DeduceNonTypeTemplateArgument(ASTContext &Context, 
-                              NonTypeTemplateParmDecl *NTTP, 
+DeduceNonTypeTemplateArgument(ASTContext &Context,
+                              NonTypeTemplateParmDecl *NTTP,
                               llvm::APSInt Value,
                               Sema::TemplateDeductionInfo &Info,
                               llvm::SmallVectorImpl<TemplateArgument> &Deduced) {
-  assert(NTTP->getDepth() == 0 && 
+  assert(NTTP->getDepth() == 0 &&
          "Cannot deduce non-type template argument with depth > 0");
-  
+
   if (Deduced[NTTP->getIndex()].isNull()) {
     QualType T = NTTP->getType();
-    
+
     // FIXME: Make sure we didn't overflow our data type!
     unsigned AllowedBits = Context.getTypeSize(T);
     if (Value.getBitWidth() != AllowedBits)
@@ -88,10 +88,10 @@
     Deduced[NTTP->getIndex()] = TemplateArgument(SourceLocation(), Value, T);
     return Sema::TDK_Success;
   }
-  
+
   assert(Deduced[NTTP->getIndex()].getKind() == TemplateArgument::Integral);
-  
-  // If the template argument was previously deduced to a negative value, 
+
+  // If the template argument was previously deduced to a negative value,
   // then our deduction fails.
   const llvm::APSInt *PrevValuePtr = Deduced[NTTP->getIndex()].getAsIntegral();
   if (PrevValuePtr->isNegative()) {
@@ -117,35 +117,35 @@
   return Sema::TDK_Success;
 }
 
-/// \brief Deduce the value of the given non-type template parameter 
+/// \brief Deduce the value of the given non-type template parameter
 /// from the given type- or value-dependent expression.
 ///
 /// \returns true if deduction succeeded, false otherwise.
 
 static Sema::TemplateDeductionResult
-DeduceNonTypeTemplateArgument(ASTContext &Context, 
+DeduceNonTypeTemplateArgument(ASTContext &Context,
                               NonTypeTemplateParmDecl *NTTP,
                               Expr *Value,
                               Sema::TemplateDeductionInfo &Info,
                            llvm::SmallVectorImpl<TemplateArgument> &Deduced) {
-  assert(NTTP->getDepth() == 0 && 
+  assert(NTTP->getDepth() == 0 &&
          "Cannot deduce non-type template argument with depth > 0");
   assert((Value->isTypeDependent() || Value->isValueDependent()) &&
          "Expression template argument must be type- or value-dependent.");
-  
+
   if (Deduced[NTTP->getIndex()].isNull()) {
     // FIXME: Clone the Value?
     Deduced[NTTP->getIndex()] = TemplateArgument(Value);
     return Sema::TDK_Success;
   }
-  
+
   if (Deduced[NTTP->getIndex()].getKind() == TemplateArgument::Integral) {
-    // Okay, we deduced a constant in one case and a dependent expression 
-    // in another case. FIXME: Later, we will check that instantiating the 
+    // Okay, we deduced a constant in one case and a dependent expression
+    // in another case. FIXME: Later, we will check that instantiating the
     // dependent expression gives us the constant value.
     return Sema::TDK_Success;
   }
-  
+
   // FIXME: Compare the expressions for equality!
   return Sema::TDK_Success;
 }
@@ -164,7 +164,7 @@
 
   TemplateDecl *ParamDecl = Param.getAsTemplateDecl();
   TemplateDecl *ArgDecl = Arg.getAsTemplateDecl();
-  
+
   if (!ParamDecl || !ArgDecl) {
     // FIXME: fill in Info.Param/Info.FirstArg
     return Sema::TDK_Inconsistent;
@@ -180,7 +180,7 @@
   return Sema::TDK_Success;
 }
 
-/// \brief Deduce the template arguments by comparing the template parameter 
+/// \brief Deduce the template arguments by comparing the template parameter
 /// type (which is a template-id) with the template argument type.
 ///
 /// \param Context the AST context in which this deduction occurs.
@@ -206,11 +206,11 @@
                         Sema::TemplateDeductionInfo &Info,
                         llvm::SmallVectorImpl<TemplateArgument> &Deduced) {
   assert(Arg->isCanonical() && "Argument type must be canonical");
-  
+
   // Check whether the template argument is a dependent template-id.
   // FIXME: This is untested code; it can be tested when we implement
   // partial ordering of class template partial specializations.
-  if (const TemplateSpecializationType *SpecArg 
+  if (const TemplateSpecializationType *SpecArg
         = dyn_cast<TemplateSpecializationType>(Arg)) {
     // Perform template argument deduction for the template name.
     if (Sema::TemplateDeductionResult Result
@@ -219,9 +219,9 @@
                                     SpecArg->getTemplateName(),
                                     Info, Deduced))
       return Result;
-    
+
     unsigned NumArgs = Param->getNumArgs();
-    
+
     // FIXME: When one of the template-names refers to a
     // declaration with default template arguments, do we need to
     // fill in those default template arguments here? Most likely,
@@ -231,7 +231,7 @@
     // the template-id.
     if (SpecArg->getNumArgs() != NumArgs)
       return Sema::TDK_NonDeducedMismatch;
-    
+
     // Perform template argument deduction on each template
     // argument.
     for (unsigned I = 0; I != NumArgs; ++I)
@@ -241,49 +241,49 @@
                                       SpecArg->getArg(I),
                                       Info, Deduced))
         return Result;
-    
+
     return Sema::TDK_Success;
   }
-  
+
   // If the argument type is a class template specialization, we
   // perform template argument deduction using its template
   // arguments.
   const RecordType *RecordArg = dyn_cast<RecordType>(Arg);
   if (!RecordArg)
     return Sema::TDK_NonDeducedMismatch;
-  
-  ClassTemplateSpecializationDecl *SpecArg 
+
+  ClassTemplateSpecializationDecl *SpecArg
     = dyn_cast<ClassTemplateSpecializationDecl>(RecordArg->getDecl());
   if (!SpecArg)
     return Sema::TDK_NonDeducedMismatch;
-  
+
   // Perform template argument deduction for the template name.
   if (Sema::TemplateDeductionResult Result
-        = DeduceTemplateArguments(Context, 
+        = DeduceTemplateArguments(Context,
                                   Param->getTemplateName(),
                                TemplateName(SpecArg->getSpecializedTemplate()),
                                   Info, Deduced))
     return Result;
-    
+
   // FIXME: Can the # of arguments in the parameter and the argument
   // differ due to default arguments?
   unsigned NumArgs = Param->getNumArgs();
   const TemplateArgumentList &ArgArgs = SpecArg->getTemplateArgs();
   if (NumArgs != ArgArgs.size())
     return Sema::TDK_NonDeducedMismatch;
-  
+
   for (unsigned I = 0; I != NumArgs; ++I)
-    if (Sema::TemplateDeductionResult Result 
+    if (Sema::TemplateDeductionResult Result
           = DeduceTemplateArguments(Context, TemplateParams,
                                     Param->getArg(I),
                                     ArgArgs.get(I),
                                     Info, Deduced))
       return Result;
-    
+
   return Sema::TDK_Success;
 }
 
-/// \brief Returns a completely-unqualified array type, capturing the 
+/// \brief Returns a completely-unqualified array type, capturing the
 /// qualifiers in CVRQuals.
 ///
 /// \param Context the AST context in which the array type was built.
@@ -302,32 +302,32 @@
     CVRQuals = T.getCVRQualifiers();
     return T.getUnqualifiedType();
   }
-  
+
   if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(T)) {
     QualType Elt = getUnqualifiedArrayType(Context, CAT->getElementType(),
                                            CVRQuals);
     if (Elt == CAT->getElementType())
       return T;
 
-    return Context.getConstantArrayType(Elt, CAT->getSize(), 
+    return Context.getConstantArrayType(Elt, CAT->getSize(),
                                         CAT->getSizeModifier(), 0);
   }
-  
+
   if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(T)) {
     QualType Elt = getUnqualifiedArrayType(Context, IAT->getElementType(),
                                            CVRQuals);
     if (Elt == IAT->getElementType())
       return T;
-    
+
     return Context.getIncompleteArrayType(Elt, IAT->getSizeModifier(), 0);
   }
-  
+
   const DependentSizedArrayType *DSAT = cast<DependentSizedArrayType>(T);
   QualType Elt = getUnqualifiedArrayType(Context, DSAT->getElementType(),
                                          CVRQuals);
   if (Elt == DSAT->getElementType())
     return T;
-  
+
   return Context.getDependentSizedArrayType(Elt, DSAT->getSizeExpr()->Retain(),
                                             DSAT->getSizeModifier(), 0,
                                             SourceRange());
@@ -349,13 +349,13 @@
 /// \param Deduced the deduced template arguments
 ///
 /// \param TDF bitwise OR of the TemplateDeductionFlags bits that describe
-/// how template argument deduction is performed. 
+/// how template argument deduction is performed.
 ///
 /// \returns the result of template argument deduction so far. Note that a
 /// "success" result means that template argument deduction has not yet failed,
 /// but it may still fail, later, for other reasons.
 static Sema::TemplateDeductionResult
-DeduceTemplateArguments(ASTContext &Context, 
+DeduceTemplateArguments(ASTContext &Context,
                         TemplateParameterList *TemplateParams,
                         QualType ParamIn, QualType ArgIn,
                         Sema::TemplateDeductionInfo &Info,
@@ -368,30 +368,30 @@
 
   // C++0x [temp.deduct.call]p4 bullet 1:
   //   - If the original P is a reference type, the deduced A (i.e., the type
-  //     referred to by the reference) can be more cv-qualified than the 
+  //     referred to by the reference) can be more cv-qualified than the
   //     transformed A.
   if (TDF & TDF_ParamWithReferenceType) {
-    unsigned ExtraQualsOnParam 
+    unsigned ExtraQualsOnParam
       = Param.getCVRQualifiers() & ~Arg.getCVRQualifiers();
     Param.setCVRQualifiers(Param.getCVRQualifiers() & ~ExtraQualsOnParam);
   }
-  
+
   // If the parameter type is not dependent, there is nothing to deduce.
   if (!Param->isDependentType())
     return Sema::TDK_Success;
 
   // C++ [temp.deduct.type]p9:
-  //   A template type argument T, a template template argument TT or a 
-  //   template non-type argument i can be deduced if P and A have one of 
+  //   A template type argument T, a template template argument TT or a
+  //   template non-type argument i can be deduced if P and A have one of
   //   the following forms:
   //
   //     T
   //     cv-list T
-  if (const TemplateTypeParmType *TemplateTypeParm 
+  if (const TemplateTypeParmType *TemplateTypeParm
         = Param->getAsTemplateTypeParmType()) {
     unsigned Index = TemplateTypeParm->getIndex();
     bool RecanonicalizeArg = false;
-    
+
     // If the argument type is an array type, move the qualifiers up to the
     // top level, so they can be matched with the qualifiers on the parameter.
     // FIXME: address spaces, ObjC GC qualifiers
@@ -403,7 +403,7 @@
         RecanonicalizeArg = true;
       }
     }
-                                          
+
     // The argument type can not be less qualified than the parameter
     // type.
     if (Param.isMoreQualifiedThan(Arg) && !(TDF & TDF_IgnoreQualifiers)) {
@@ -414,23 +414,23 @@
     }
 
     assert(TemplateTypeParm->getDepth() == 0 && "Can't deduce with depth > 0");
-	  
+
     unsigned Quals = Arg.getCVRQualifiers() & ~Param.getCVRQualifiers();
     QualType DeducedType = Arg.getQualifiedType(Quals);
     if (RecanonicalizeArg)
       DeducedType = Context.getCanonicalType(DeducedType);
-    
+
     if (Deduced[Index].isNull())
       Deduced[Index] = TemplateArgument(SourceLocation(), DeducedType);
     else {
-      // C++ [temp.deduct.type]p2: 
+      // C++ [temp.deduct.type]p2:
       //   [...] If type deduction cannot be done for any P/A pair, or if for
-      //   any pair the deduction leads to more than one possible set of 
-      //   deduced values, or if different pairs yield different deduced 
-      //   values, or if any template argument remains neither deduced nor 
+      //   any pair the deduction leads to more than one possible set of
+      //   deduced values, or if different pairs yield different deduced
+      //   values, or if any template argument remains neither deduced nor
       //   explicitly specified, template argument deduction fails.
       if (Deduced[Index].getAsType() != DeducedType) {
-        Info.Param 
+        Info.Param
           = cast<TemplateTypeParmDecl>(TemplateParams->getParam(Index));
         Info.FirstArg = Deduced[Index];
         Info.SecondArg = TemplateArgument(SourceLocation(), Arg);
@@ -451,7 +451,7 @@
         return Sema::TDK_NonDeducedMismatch;
     } else {
       if (Param.getCVRQualifiers() != Arg.getCVRQualifiers())
-        return Sema::TDK_NonDeducedMismatch;  
+        return Sema::TDK_NonDeducedMismatch;
     }
   }
 
@@ -459,26 +459,26 @@
     // No deduction possible for these types
     case Type::Builtin:
       return Sema::TDK_NonDeducedMismatch;
-      
+
     //     T *
     case Type::Pointer: {
       const PointerType *PointerArg = Arg->getAs<PointerType>();
       if (!PointerArg)
         return Sema::TDK_NonDeducedMismatch;
-      
+
       unsigned SubTDF = TDF & (TDF_IgnoreQualifiers | TDF_DerivedClass);
       return DeduceTemplateArguments(Context, TemplateParams,
                                    cast<PointerType>(Param)->getPointeeType(),
                                      PointerArg->getPointeeType(),
                                      Info, Deduced, SubTDF);
     }
-      
+
     //     T &
     case Type::LValueReference: {
       const LValueReferenceType *ReferenceArg = Arg->getAs<LValueReferenceType>();
       if (!ReferenceArg)
         return Sema::TDK_NonDeducedMismatch;
-      
+
       return DeduceTemplateArguments(Context, TemplateParams,
                            cast<LValueReferenceType>(Param)->getPointeeType(),
                                      ReferenceArg->getPointeeType(),
@@ -490,20 +490,20 @@
       const RValueReferenceType *ReferenceArg = Arg->getAs<RValueReferenceType>();
       if (!ReferenceArg)
         return Sema::TDK_NonDeducedMismatch;
-      
+
       return DeduceTemplateArguments(Context, TemplateParams,
                            cast<RValueReferenceType>(Param)->getPointeeType(),
                                      ReferenceArg->getPointeeType(),
                                      Info, Deduced, 0);
     }
-      
+
     //     T [] (implied, but not stated explicitly)
     case Type::IncompleteArray: {
-      const IncompleteArrayType *IncompleteArrayArg = 
+      const IncompleteArrayType *IncompleteArrayArg =
         Context.getAsIncompleteArrayType(Arg);
       if (!IncompleteArrayArg)
         return Sema::TDK_NonDeducedMismatch;
-      
+
       return DeduceTemplateArguments(Context, TemplateParams,
                      Context.getAsIncompleteArrayType(Param)->getElementType(),
                                      IncompleteArrayArg->getElementType(),
@@ -512,16 +512,16 @@
 
     //     T [integer-constant]
     case Type::ConstantArray: {
-      const ConstantArrayType *ConstantArrayArg = 
+      const ConstantArrayType *ConstantArrayArg =
         Context.getAsConstantArrayType(Arg);
       if (!ConstantArrayArg)
         return Sema::TDK_NonDeducedMismatch;
-      
-      const ConstantArrayType *ConstantArrayParm = 
+
+      const ConstantArrayType *ConstantArrayParm =
         Context.getAsConstantArrayType(Param);
       if (ConstantArrayArg->getSize() != ConstantArrayParm->getSize())
         return Sema::TDK_NonDeducedMismatch;
-      
+
       return DeduceTemplateArguments(Context, TemplateParams,
                                      ConstantArrayParm->getElementType(),
                                      ConstantArrayArg->getElementType(),
@@ -533,7 +533,7 @@
       const ArrayType *ArrayArg = dyn_cast<ArrayType>(Arg);
       if (!ArrayArg)
         return Sema::TDK_NonDeducedMismatch;
-      
+
       // Check the element type of the arrays
       const DependentSizedArrayType *DependentArrayParm
         = cast<DependentSizedArrayType>(Param);
@@ -543,18 +543,18 @@
                                       ArrayArg->getElementType(),
                                       Info, Deduced, 0))
         return Result;
-          
+
       // Determine the array bound is something we can deduce.
-      NonTypeTemplateParmDecl *NTTP 
+      NonTypeTemplateParmDecl *NTTP
         = getDeducedParameterFromExpr(DependentArrayParm->getSizeExpr());
       if (!NTTP)
         return Sema::TDK_Success;
-      
-      // We can perform template argument deduction for the given non-type 
+
+      // We can perform template argument deduction for the given non-type
       // template parameter.
-      assert(NTTP->getDepth() == 0 && 
+      assert(NTTP->getDepth() == 0 &&
              "Cannot deduce non-type template argument at depth > 0");
-      if (const ConstantArrayType *ConstantArrayArg 
+      if (const ConstantArrayType *ConstantArrayArg
             = dyn_cast<ConstantArrayType>(ArrayArg)) {
         llvm::APSInt Size(ConstantArrayArg->getSize());
         return DeduceNonTypeTemplateArgument(Context, NTTP, Size,
@@ -565,30 +565,30 @@
         return DeduceNonTypeTemplateArgument(Context, NTTP,
                                              DependentArrayArg->getSizeExpr(),
                                              Info, Deduced);
-      
+
       // Incomplete type does not match a dependently-sized array type
       return Sema::TDK_NonDeducedMismatch;
     }
-      
-    //     type(*)(T) 
-    //     T(*)() 
-    //     T(*)(T) 
+
+    //     type(*)(T)
+    //     T(*)()
+    //     T(*)(T)
     case Type::FunctionProto: {
-      const FunctionProtoType *FunctionProtoArg = 
+      const FunctionProtoType *FunctionProtoArg =
         dyn_cast<FunctionProtoType>(Arg);
       if (!FunctionProtoArg)
         return Sema::TDK_NonDeducedMismatch;
-      
-      const FunctionProtoType *FunctionProtoParam = 
+
+      const FunctionProtoType *FunctionProtoParam =
         cast<FunctionProtoType>(Param);
 
-      if (FunctionProtoParam->getTypeQuals() != 
+      if (FunctionProtoParam->getTypeQuals() !=
           FunctionProtoArg->getTypeQuals())
         return Sema::TDK_NonDeducedMismatch;
-      
+
       if (FunctionProtoParam->getNumArgs() != FunctionProtoArg->getNumArgs())
         return Sema::TDK_NonDeducedMismatch;
-      
+
       if (FunctionProtoParam->isVariadic() != FunctionProtoArg->isVariadic())
         return Sema::TDK_NonDeducedMismatch;
 
@@ -599,7 +599,7 @@
                                       FunctionProtoArg->getResultType(),
                                       Info, Deduced, 0))
         return Result;
-      
+
       for (unsigned I = 0, N = FunctionProtoParam->getNumArgs(); I != N; ++I) {
         // Check argument types.
         if (Sema::TemplateDeductionResult Result
@@ -609,10 +609,10 @@
                                         Info, Deduced, 0))
           return Result;
       }
-      
+
       return Sema::TDK_Success;
     }
-     
+
     //     template-name<T> (where template-name refers to a class template)
     //     template-name<i>
     //     TT<T> (TODO)
@@ -621,26 +621,26 @@
     case Type::TemplateSpecialization: {
       const TemplateSpecializationType *SpecParam
         = cast<TemplateSpecializationType>(Param);
-      
+
       // Try to deduce template arguments from the template-id.
       Sema::TemplateDeductionResult Result
-        = DeduceTemplateArguments(Context, TemplateParams, SpecParam, Arg,  
+        = DeduceTemplateArguments(Context, TemplateParams, SpecParam, Arg,
                                   Info, Deduced);
-      
-      if (Result && (TDF & TDF_DerivedClass) && 
+
+      if (Result && (TDF & TDF_DerivedClass) &&
           Result != Sema::TDK_Inconsistent) {
         // C++ [temp.deduct.call]p3b3:
         //   If P is a class, and P has the form template-id, then A can be a
         //   derived class of the deduced A. Likewise, if P is a pointer to a
-        //   class of the form template-id, A can be a pointer to a derived 
+        //   class of the form template-id, A can be a pointer to a derived
         //   class pointed to by the deduced A.
         //
         // More importantly:
-        //   These alternatives are considered only if type deduction would 
+        //   These alternatives are considered only if type deduction would
         //   otherwise fail.
         if (const RecordType *RecordT = dyn_cast<RecordType>(Arg)) {
           // Use data recursion to crawl through the list of base classes.
-          // Visited contains the set of nodes we have already visited, while 
+          // Visited contains the set of nodes we have already visited, while
           // ToVisit is our stack of records that we still need to visit.
           llvm::SmallPtrSet<const RecordType *, 8> Visited;
           llvm::SmallVector<const RecordType *, 8> ToVisit;
@@ -650,18 +650,18 @@
             // Retrieve the next class in the inheritance hierarchy.
             const RecordType *NextT = ToVisit.back();
             ToVisit.pop_back();
-            
+
             // If we have already seen this type, skip it.
             if (!Visited.insert(NextT))
               continue;
-           
+
             // If this is a base class, try to perform template argument
             // deduction from it.
             if (NextT != RecordT) {
               Sema::TemplateDeductionResult BaseResult
                 = DeduceTemplateArguments(Context, TemplateParams, SpecParam,
                                           QualType(NextT, 0), Info, Deduced);
-              
+
               // If template argument deduction for this base was successful,
               // note that we had some success.
               if (BaseResult == Sema::TDK_Success)
@@ -672,24 +672,24 @@
               else if (BaseResult == Sema::TDK_Inconsistent)
                 return BaseResult;
             }
-            
+
             // Visit base classes
             CXXRecordDecl *Next = cast<CXXRecordDecl>(NextT->getDecl());
             for (CXXRecordDecl::base_class_iterator Base = Next->bases_begin(),
                                                  BaseEnd = Next->bases_end();
                Base != BaseEnd; ++Base) {
-              assert(Base->getType()->isRecordType() && 
+              assert(Base->getType()->isRecordType() &&
                      "Base class that isn't a record?");
               ToVisit.push_back(Base->getType()->getAs<RecordType>());
             }
           }
-          
+
           if (Successful)
             return Sema::TDK_Success;
         }
-        
+
       }
-      
+
       return Result;
     }
 
@@ -724,16 +724,16 @@
 
     //     (clang extension)
     //
-    //     type(^)(T) 
-    //     T(^)() 
-    //     T(^)(T) 
+    //     type(^)(T)
+    //     T(^)()
+    //     T(^)(T)
     case Type::BlockPointer: {
       const BlockPointerType *BlockPtrParam = cast<BlockPointerType>(Param);
       const BlockPointerType *BlockPtrArg = dyn_cast<BlockPointerType>(Arg);
-      
+
       if (!BlockPtrArg)
         return Sema::TDK_NonDeducedMismatch;
-      
+
       return DeduceTemplateArguments(Context, TemplateParams,
                                      BlockPtrParam->getPointeeType(),
                                      BlockPtrArg->getPointeeType(), Info,
@@ -755,7 +755,7 @@
 }
 
 static Sema::TemplateDeductionResult
-DeduceTemplateArguments(ASTContext &Context, 
+DeduceTemplateArguments(ASTContext &Context,
                         TemplateParameterList *TemplateParams,
                         const TemplateArgument &Param,
                         const TemplateArgument &Arg,
@@ -765,8 +765,8 @@
   case TemplateArgument::Null:
     assert(false && "Null template argument in parameter list");
     break;
-      
-  case TemplateArgument::Type: 
+
+  case TemplateArgument::Type:
     assert(Arg.getKind() == TemplateArgument::Type && "Type/value mismatch");
     return DeduceTemplateArguments(Context, TemplateParams, Param.getAsType(),
                                    Arg.getAsType(), Info, Deduced, 0);
@@ -777,7 +777,7 @@
     Info.FirstArg = Param;
     Info.SecondArg = Arg;
     return Sema::TDK_NonDeducedMismatch;
-      
+
   case TemplateArgument::Integral:
     if (Arg.getKind() == TemplateArgument::Integral) {
       // FIXME: Zero extension + sign checking here?
@@ -799,25 +799,25 @@
     Info.FirstArg = Param;
     Info.SecondArg = Arg;
     return Sema::TDK_NonDeducedMismatch;
-      
+
   case TemplateArgument::Expression: {
-    if (NonTypeTemplateParmDecl *NTTP 
+    if (NonTypeTemplateParmDecl *NTTP
           = getDeducedParameterFromExpr(Param.getAsExpr())) {
       if (Arg.getKind() == TemplateArgument::Integral)
         // FIXME: Sign problems here
-        return DeduceNonTypeTemplateArgument(Context, NTTP, 
-                                             *Arg.getAsIntegral(), 
+        return DeduceNonTypeTemplateArgument(Context, NTTP,
+                                             *Arg.getAsIntegral(),
                                              Info, Deduced);
       if (Arg.getKind() == TemplateArgument::Expression)
         return DeduceNonTypeTemplateArgument(Context, NTTP, Arg.getAsExpr(),
                                              Info, Deduced);
-      
+
       assert(false && "Type/value mismatch");
       Info.FirstArg = Param;
       Info.SecondArg = Arg;
       return Sema::TDK_NonDeducedMismatch;
     }
-    
+
     // Can't deduce anything, but that's okay.
     return Sema::TDK_Success;
   }
@@ -825,11 +825,11 @@
     assert(0 && "FIXME: Implement!");
     break;
   }
-      
+
   return Sema::TDK_Success;
 }
 
-static Sema::TemplateDeductionResult 
+static Sema::TemplateDeductionResult
 DeduceTemplateArguments(ASTContext &Context,
                         TemplateParameterList *TemplateParams,
                         const TemplateArgumentList &ParamList,
@@ -840,7 +840,7 @@
   for (unsigned I = 0, N = ParamList.size(); I != N; ++I) {
     if (Sema::TemplateDeductionResult Result
           = DeduceTemplateArguments(Context, TemplateParams,
-                                    ParamList[I], ArgList[I], 
+                                    ParamList[I], ArgList[I],
                                     Info, Deduced))
       return Result;
   }
@@ -848,41 +848,41 @@
 }
 
 /// \brief Determine whether two template arguments are the same.
-static bool isSameTemplateArg(ASTContext &Context, 
+static bool isSameTemplateArg(ASTContext &Context,
                               const TemplateArgument &X,
                               const TemplateArgument &Y) {
   if (X.getKind() != Y.getKind())
     return false;
-  
+
   switch (X.getKind()) {
     case TemplateArgument::Null:
       assert(false && "Comparing NULL template argument");
       break;
-      
+
     case TemplateArgument::Type:
       return Context.getCanonicalType(X.getAsType()) ==
              Context.getCanonicalType(Y.getAsType());
-      
+
     case TemplateArgument::Declaration:
       return X.getAsDecl()->getCanonicalDecl() ==
              Y.getAsDecl()->getCanonicalDecl();
-      
+
     case TemplateArgument::Integral:
       return *X.getAsIntegral() == *Y.getAsIntegral();
-      
+
     case TemplateArgument::Expression:
       // FIXME: We assume that all expressions are distinct, but we should
       // really check their canonical forms.
       return false;
-      
+
     case TemplateArgument::Pack:
       if (X.pack_size() != Y.pack_size())
         return false;
-      
-      for (TemplateArgument::pack_iterator XP = X.pack_begin(), 
-                                        XPEnd = X.pack_end(), 
+
+      for (TemplateArgument::pack_iterator XP = X.pack_begin(),
+                                        XPEnd = X.pack_end(),
                                            YP = Y.pack_begin();
-           XP != XPEnd; ++XP, ++YP) 
+           XP != XPEnd; ++XP, ++YP)
         if (!isSameTemplateArg(Context, *XP, *YP))
           return false;
 
@@ -899,7 +899,7 @@
     return TemplateParameter(TTP);
   else if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D))
     return TemplateParameter(NTTP);
-  
+
   return TemplateParameter(cast<TemplateTemplateParmDecl>(D));
 }
 
@@ -919,9 +919,9 @@
   llvm::SmallVector<TemplateArgument, 4> Deduced;
   Deduced.resize(Partial->getTemplateParameters()->size());
   if (TemplateDeductionResult Result
-        = ::DeduceTemplateArguments(Context, 
+        = ::DeduceTemplateArguments(Context,
                                     Partial->getTemplateParameters(),
-                                    Partial->getTemplateArgs(), 
+                                    Partial->getTemplateArgs(),
                                     TemplateArgs, Info, Deduced))
     return Result;
 
@@ -937,11 +937,11 @@
                                       Deduced.size());
   for (unsigned I = 0, N = Deduced.size(); I != N; ++I) {
     if (Deduced[I].isNull()) {
-      Decl *Param 
+      Decl *Param
         = const_cast<Decl *>(Partial->getTemplateParameters()->getParam(I));
       if (TemplateTypeParmDecl *TTP = dyn_cast<TemplateTypeParmDecl>(Param))
         Info.Param = TTP;
-      else if (NonTypeTemplateParmDecl *NTTP 
+      else if (NonTypeTemplateParmDecl *NTTP
                  = dyn_cast<NonTypeTemplateParmDecl>(Param))
         Info.Param = NTTP;
       else
@@ -953,7 +953,7 @@
   }
 
   // Form the template argument list from the deduced template arguments.
-  TemplateArgumentList *DeducedArgumentList 
+  TemplateArgumentList *DeducedArgumentList
     = new (Context) TemplateArgumentList(Context, Builder, /*TakeArgs=*/true);
   Info.reset(DeducedArgumentList);
 
@@ -961,45 +961,45 @@
   // arguments of the class template partial specialization, and
   // verify that the instantiated template arguments are both valid
   // and are equivalent to the template arguments originally provided
-  // to the class template. 
+  // to the class template.
   ClassTemplateDecl *ClassTemplate = Partial->getSpecializedTemplate();
   const TemplateArgumentList &PartialTemplateArgs = Partial->getTemplateArgs();
   for (unsigned I = 0, N = PartialTemplateArgs.flat_size(); I != N; ++I) {
     Decl *Param = const_cast<Decl *>(
                     ClassTemplate->getTemplateParameters()->getParam(I));
-    TemplateArgument InstArg 
+    TemplateArgument InstArg
       = Subst(PartialTemplateArgs[I],
               MultiLevelTemplateArgumentList(*DeducedArgumentList));
     if (InstArg.isNull()) {
       Info.Param = makeTemplateParameter(Param);
       Info.FirstArg = PartialTemplateArgs[I];
-      return TDK_SubstitutionFailure;      
+      return TDK_SubstitutionFailure;
     }
-    
+
     if (InstArg.getKind() == TemplateArgument::Expression) {
-      // When the argument is an expression, check the expression result 
+      // When the argument is an expression, check the expression result
       // against the actual template parameter to get down to the canonical
       // template argument.
       Expr *InstExpr = InstArg.getAsExpr();
-      if (NonTypeTemplateParmDecl *NTTP 
+      if (NonTypeTemplateParmDecl *NTTP
             = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
         if (CheckTemplateArgument(NTTP, NTTP->getType(), InstExpr, InstArg)) {
           Info.Param = makeTemplateParameter(Param);
           Info.FirstArg = PartialTemplateArgs[I];
-          return TDK_SubstitutionFailure;      
+          return TDK_SubstitutionFailure;
         }
-      } else if (TemplateTemplateParmDecl *TTP 
+      } else if (TemplateTemplateParmDecl *TTP
                    = dyn_cast<TemplateTemplateParmDecl>(Param)) {
         // FIXME: template template arguments should really resolve to decls
         DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(InstExpr);
         if (!DRE || CheckTemplateArgument(TTP, DRE)) {
           Info.Param = makeTemplateParameter(Param);
           Info.FirstArg = PartialTemplateArgs[I];
-          return TDK_SubstitutionFailure;      
+          return TDK_SubstitutionFailure;
         }
       }
     }
-    
+
     if (!isSameTemplateArg(Context, TemplateArgs[I], InstArg)) {
       Info.Param = makeTemplateParameter(Param);
       Info.FirstArg = TemplateArgs[I];
@@ -1016,10 +1016,10 @@
 
 /// \brief Determine whether the given type T is a simple-template-id type.
 static bool isSimpleTemplateIdType(QualType T) {
-  if (const TemplateSpecializationType *Spec 
+  if (const TemplateSpecializationType *Spec
         = T->getAsTemplateSpecializationType())
     return Spec->getTemplateName().getAsTemplateDecl() != 0;
-  
+
   return false;
 }
 
@@ -1029,16 +1029,16 @@
 /// \param FunctionTemplate the function template into which the explicit
 /// template arguments will be substituted.
 ///
-/// \param ExplicitTemplateArguments the explicitly-specified template 
+/// \param ExplicitTemplateArguments the explicitly-specified template
 /// arguments.
 ///
-/// \param NumExplicitTemplateArguments the number of explicitly-specified 
+/// \param NumExplicitTemplateArguments the number of explicitly-specified
 /// template arguments in @p ExplicitTemplateArguments. This value may be zero.
 ///
-/// \param Deduced the deduced template arguments, which will be populated 
+/// \param Deduced the deduced template arguments, which will be populated
 /// with the converted and checked explicit template arguments.
 ///
-/// \param ParamTypes will be populated with the instantiated function 
+/// \param ParamTypes will be populated with the instantiated function
 /// parameters.
 ///
 /// \param FunctionType if non-NULL, the result type of the function template
@@ -1071,33 +1071,33 @@
          P != PEnd;
          ++P)
       ParamTypes.push_back((*P)->getType());
-    
+
     if (FunctionType)
       *FunctionType = Function->getType();
     return TDK_Success;
   }
-  
+
   // Substitution of the explicit template arguments into a function template
   /// is a SFINAE context. Trap any errors that might occur.
-  SFINAETrap Trap(*this);  
-  
+  SFINAETrap Trap(*this);
+
   // C++ [temp.arg.explicit]p3:
-  //   Template arguments that are present shall be specified in the 
-  //   declaration order of their corresponding template-parameters. The 
+  //   Template arguments that are present shall be specified in the
+  //   declaration order of their corresponding template-parameters. The
   //   template argument list shall not specify more template-arguments than
-  //   there are corresponding template-parameters. 
-  TemplateArgumentListBuilder Builder(TemplateParams, 
+  //   there are corresponding template-parameters.
+  TemplateArgumentListBuilder Builder(TemplateParams,
                                       NumExplicitTemplateArgs);
-  
-  // Enter a new template instantiation context where we check the 
+
+  // Enter a new template instantiation context where we check the
   // explicitly-specified template arguments against this function template,
   // and then substitute them into the function parameter types.
-  InstantiatingTemplate Inst(*this, FunctionTemplate->getLocation(), 
+  InstantiatingTemplate Inst(*this, FunctionTemplate->getLocation(),
                              FunctionTemplate, Deduced.data(), Deduced.size(),
            ActiveTemplateInstantiation::ExplicitTemplateArgumentSubstitution);
   if (Inst)
     return TDK_InstantiationDepth;
-  
+
   if (CheckTemplateArgumentList(FunctionTemplate,
                                 SourceLocation(), SourceLocation(),
                                 ExplicitTemplateArgs,
@@ -1106,26 +1106,26 @@
                                 true,
                                 Builder) || Trap.hasErrorOccurred())
     return TDK_InvalidExplicitArguments;
-  
+
   // Form the template argument list from the explicitly-specified
   // template arguments.
-  TemplateArgumentList *ExplicitArgumentList 
+  TemplateArgumentList *ExplicitArgumentList
     = new (Context) TemplateArgumentList(Context, Builder, /*TakeArgs=*/true);
   Info.reset(ExplicitArgumentList);
-  
+
   // Instantiate the types of each of the function parameters given the
   // explicitly-specified template arguments.
   for (FunctionDecl::param_iterator P = Function->param_begin(),
                                 PEnd = Function->param_end();
        P != PEnd;
        ++P) {
-    QualType ParamType 
-      = SubstType((*P)->getType(), 
+    QualType ParamType
+      = SubstType((*P)->getType(),
                   MultiLevelTemplateArgumentList(*ExplicitArgumentList),
                   (*P)->getLocation(), (*P)->getDeclName());
     if (ParamType.isNull() || Trap.hasErrorOccurred())
       return TDK_SubstitutionFailure;
-    
+
     ParamTypes.push_back(ParamType);
   }
 
@@ -1133,19 +1133,19 @@
   // type and form that function type.
   if (FunctionType) {
     // FIXME: exception-specifications?
-    const FunctionProtoType *Proto 
+    const FunctionProtoType *Proto
       = Function->getType()->getAsFunctionProtoType();
     assert(Proto && "Function template does not have a prototype?");
-    
-    QualType ResultType 
+
+    QualType ResultType
       = SubstType(Proto->getResultType(),
                   MultiLevelTemplateArgumentList(*ExplicitArgumentList),
                   Function->getTypeSpecStartLoc(),
                   Function->getDeclName());
     if (ResultType.isNull() || Trap.hasErrorOccurred())
       return TDK_SubstitutionFailure;
-    
-    *FunctionType = BuildFunctionType(ResultType, 
+
+    *FunctionType = BuildFunctionType(ResultType,
                                       ParamTypes.data(), ParamTypes.size(),
                                       Proto->isVariadic(),
                                       Proto->getTypeQuals(),
@@ -1154,33 +1154,33 @@
     if (FunctionType->isNull() || Trap.hasErrorOccurred())
       return TDK_SubstitutionFailure;
   }
-  
+
   // C++ [temp.arg.explicit]p2:
-  //   Trailing template arguments that can be deduced (14.8.2) may be 
-  //   omitted from the list of explicit template-arguments. If all of the 
+  //   Trailing template arguments that can be deduced (14.8.2) may be
+  //   omitted from the list of explicit template-arguments. If all of the
   //   template arguments can be deduced, they may all be omitted; in this
   //   case, the empty template argument list <> itself may also be omitted.
   //
   // Take all of the explicitly-specified arguments and put them into the
-  // set of deduced template arguments. 
+  // set of deduced template arguments.
   Deduced.reserve(TemplateParams->size());
   for (unsigned I = 0, N = ExplicitArgumentList->size(); I != N; ++I)
-    Deduced.push_back(ExplicitArgumentList->get(I));  
-  
+    Deduced.push_back(ExplicitArgumentList->get(I));
+
   return TDK_Success;
 }
 
-/// \brief Finish template argument deduction for a function template, 
+/// \brief Finish template argument deduction for a function template,
 /// checking the deduced template arguments for completeness and forming
 /// the function template specialization.
-Sema::TemplateDeductionResult 
+Sema::TemplateDeductionResult
 Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate,
                             llvm::SmallVectorImpl<TemplateArgument> &Deduced,
                                       FunctionDecl *&Specialization,
                                       TemplateDeductionInfo &Info) {
   TemplateParameterList *TemplateParams
     = FunctionTemplate->getTemplateParameters();
-  
+
   // C++ [temp.deduct.type]p2:
   //   [...] or if any template argument remains neither deduced nor
   //   explicitly specified, template argument deduction fails.
@@ -1191,28 +1191,28 @@
                             const_cast<Decl *>(TemplateParams->getParam(I)));
       return TDK_Incomplete;
     }
-    
+
     Builder.Append(Deduced[I]);
   }
-  
+
   // Form the template argument list from the deduced template arguments.
-  TemplateArgumentList *DeducedArgumentList 
+  TemplateArgumentList *DeducedArgumentList
     = new (Context) TemplateArgumentList(Context, Builder, /*TakeArgs=*/true);
   Info.reset(DeducedArgumentList);
-  
+
   // Template argument deduction for function templates in a SFINAE context.
   // Trap any errors that might occur.
-  SFINAETrap Trap(*this);  
-  
+  SFINAETrap Trap(*this);
+
   // Enter a new template instantiation context while we instantiate the
   // actual function declaration.
-  InstantiatingTemplate Inst(*this, FunctionTemplate->getLocation(), 
+  InstantiatingTemplate Inst(*this, FunctionTemplate->getLocation(),
                              FunctionTemplate, Deduced.data(), Deduced.size(),
               ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution);
   if (Inst)
-    return TDK_InstantiationDepth; 
-  
-  // Substitute the deduced template arguments into the function template 
+    return TDK_InstantiationDepth;
+
+  // Substitute the deduced template arguments into the function template
   // declaration to produce the function template specialization.
   Specialization = cast_or_null<FunctionDecl>(
                       SubstDecl(FunctionTemplate->getTemplatedDecl(),
@@ -1220,12 +1220,12 @@
                          MultiLevelTemplateArgumentList(*DeducedArgumentList)));
   if (!Specialization)
     return TDK_SubstitutionFailure;
-  
-  // If the template argument list is owned by the function template 
+
+  // If the template argument list is owned by the function template
   // specialization, release it.
   if (Specialization->getTemplateSpecializationArgs() == DeducedArgumentList)
     Info.take();
-  
+
   // There may have been an error that did not prevent us from constructing a
   // declaration. Mark the declaration invalid and return with a substitution
   // failure.
@@ -1233,8 +1233,8 @@
     Specialization->setInvalidDecl(true);
     return TDK_SubstitutionFailure;
   }
-  
-  return TDK_Success;  
+
+  return TDK_Success;
 }
 
 /// \brief Perform template argument deduction from a function call
@@ -1243,14 +1243,14 @@
 /// \param FunctionTemplate the function template for which we are performing
 /// template argument deduction.
 ///
-/// \param HasExplicitTemplateArgs whether any template arguments were 
+/// \param HasExplicitTemplateArgs whether any template arguments were
 /// explicitly specified.
 ///
 /// \param ExplicitTemplateArguments when @p HasExplicitTemplateArgs is true,
 /// the explicitly-specified template arguments.
 ///
 /// \param NumExplicitTemplateArguments when @p HasExplicitTemplateArgs is true,
-/// the number of explicitly-specified template arguments in 
+/// the number of explicitly-specified template arguments in
 /// @p ExplicitTemplateArguments. This value may be zero.
 ///
 /// \param Args the function call arguments
@@ -1258,7 +1258,7 @@
 /// \param NumArgs the number of arguments in Args
 ///
 /// \param Specialization if template argument deduction was successful,
-/// this will be set to the function template specialization produced by 
+/// this will be set to the function template specialization produced by
 /// template argument deduction.
 ///
 /// \param Info the argument will be updated to provide additional information
@@ -1283,14 +1283,14 @@
   if (NumArgs < Function->getMinRequiredArguments())
     return TDK_TooFewArguments;
   else if (NumArgs > Function->getNumParams()) {
-    const FunctionProtoType *Proto 
+    const FunctionProtoType *Proto
       = Function->getType()->getAsFunctionProtoType();
     if (!Proto->isVariadic())
       return TDK_TooManyArguments;
-    
+
     CheckArgs = Function->getNumParams();
   }
-    
+
   // The types of the parameters from which we will perform template argument
   // deduction.
   TemplateParameterList *TemplateParams
@@ -1313,25 +1313,25 @@
     for (unsigned I = 0; I != CheckArgs; ++I)
       ParamTypes.push_back(Function->getParamDecl(I)->getType());
   }
-                                        
+
   // Deduce template arguments from the function parameters.
-  Deduced.resize(TemplateParams->size());  
+  Deduced.resize(TemplateParams->size());
   for (unsigned I = 0; I != CheckArgs; ++I) {
     QualType ParamType = ParamTypes[I];
     QualType ArgType = Args[I]->getType();
-    
+
     // C++ [temp.deduct.call]p2:
     //   If P is not a reference type:
     QualType CanonParamType = Context.getCanonicalType(ParamType);
     bool ParamWasReference = isa<ReferenceType>(CanonParamType);
     if (!ParamWasReference) {
-      //   - If A is an array type, the pointer type produced by the 
-      //     array-to-pointer standard conversion (4.2) is used in place of 
+      //   - If A is an array type, the pointer type produced by the
+      //     array-to-pointer standard conversion (4.2) is used in place of
       //     A for type deduction; otherwise,
       if (ArgType->isArrayType())
         ArgType = Context.getArrayDecayedType(ArgType);
-      //   - If A is a function type, the pointer type produced by the 
-      //     function-to-pointer standard conversion (4.3) is used in place 
+      //   - If A is a function type, the pointer type produced by the
+      //     function-to-pointer standard conversion (4.3) is used in place
       //     of A for type deduction; otherwise,
       else if (ArgType->isFunctionType())
         ArgType = Context.getPointerType(ArgType);
@@ -1343,67 +1343,67 @@
           ArgType = CanonArgType.getUnqualifiedType();
       }
     }
-    
+
     // C++0x [temp.deduct.call]p3:
     //   If P is a cv-qualified type, the top level cv-qualifiers of P’s type
-    //   are ignored for type deduction. 
+    //   are ignored for type deduction.
     if (CanonParamType.getCVRQualifiers())
       ParamType = CanonParamType.getUnqualifiedType();
     if (const ReferenceType *ParamRefType = ParamType->getAs<ReferenceType>()) {
-      //   [...] If P is a reference type, the type referred to by P is used 
-      //   for type deduction. 
+      //   [...] If P is a reference type, the type referred to by P is used
+      //   for type deduction.
       ParamType = ParamRefType->getPointeeType();
-      
-      //   [...] If P is of the form T&&, where T is a template parameter, and 
-      //   the argument is an lvalue, the type A& is used in place of A for 
+
+      //   [...] If P is of the form T&&, where T is a template parameter, and
+      //   the argument is an lvalue, the type A& is used in place of A for
       //   type deduction.
       if (isa<RValueReferenceType>(ParamRefType) &&
           ParamRefType->getAsTemplateTypeParmType() &&
           Args[I]->isLvalue(Context) == Expr::LV_Valid)
         ArgType = Context.getLValueReferenceType(ArgType);
     }
-    
+
     // C++0x [temp.deduct.call]p4:
     //   In general, the deduction process attempts to find template argument
     //   values that will make the deduced A identical to A (after the type A
     //   is transformed as described above). [...]
     unsigned TDF = 0;
-    
+
     //     - If the original P is a reference type, the deduced A (i.e., the
     //       type referred to by the reference) can be more cv-qualified than
     //       the transformed A.
     if (ParamWasReference)
       TDF |= TDF_ParamWithReferenceType;
-    //     - The transformed A can be another pointer or pointer to member 
-    //       type that can be converted to the deduced A via a qualification 
+    //     - The transformed A can be another pointer or pointer to member
+    //       type that can be converted to the deduced A via a qualification
     //       conversion (4.4).
     if (ArgType->isPointerType() || ArgType->isMemberPointerType())
       TDF |= TDF_IgnoreQualifiers;
-    //     - If P is a class and P has the form simple-template-id, then the 
+    //     - If P is a class and P has the form simple-template-id, then the
     //       transformed A can be a derived class of the deduced A. Likewise,
     //       if P is a pointer to a class of the form simple-template-id, the
     //       transformed A can be a pointer to a derived class pointed to by
     //       the deduced A.
     if (isSimpleTemplateIdType(ParamType) ||
-        (isa<PointerType>(ParamType) && 
+        (isa<PointerType>(ParamType) &&
          isSimpleTemplateIdType(
                               ParamType->getAs<PointerType>()->getPointeeType())))
       TDF |= TDF_DerivedClass;
-    
+
     if (TemplateDeductionResult Result
         = ::DeduceTemplateArguments(Context, TemplateParams,
                                     ParamType, ArgType, Info, Deduced,
                                     TDF))
       return Result;
-    
+
     // FIXME: C++0x [temp.deduct.call] paragraphs 6-9 deal with function
-    // pointer parameters. 
+    // pointer parameters.
 
     // FIXME: we need to check that the deduced A is the same as A,
     // modulo the various allowed differences.
   }
 
-  return FinishTemplateArgumentDeduction(FunctionTemplate, Deduced, 
+  return FinishTemplateArgumentDeduction(FunctionTemplate, Deduced,
                                          Specialization, Info);
 }
 
@@ -1413,14 +1413,14 @@
 /// \param FunctionTemplate the function template for which we are performing
 /// template argument deduction.
 ///
-/// \param HasExplicitTemplateArgs whether any template arguments were 
+/// \param HasExplicitTemplateArgs whether any template arguments were
 /// explicitly specified.
 ///
 /// \param ExplicitTemplateArguments when @p HasExplicitTemplateArgs is true,
 /// the explicitly-specified template arguments.
 ///
 /// \param NumExplicitTemplateArguments when @p HasExplicitTemplateArgs is true,
-/// the number of explicitly-specified template arguments in 
+/// the number of explicitly-specified template arguments in
 /// @p ExplicitTemplateArguments. This value may be zero.
 ///
 /// \param ArgFunctionType the function type that will be used as the
@@ -1428,7 +1428,7 @@
 /// function template's function type.
 ///
 /// \param Specialization if template argument deduction was successful,
-/// this will be set to the function template specialization produced by 
+/// this will be set to the function template specialization produced by
 /// template argument deduction.
 ///
 /// \param Info the argument will be updated to provide additional information
@@ -1447,33 +1447,33 @@
   TemplateParameterList *TemplateParams
     = FunctionTemplate->getTemplateParameters();
   QualType FunctionType = Function->getType();
-  
+
   // Substitute any explicit template arguments.
   llvm::SmallVector<TemplateArgument, 4> Deduced;
   llvm::SmallVector<QualType, 4> ParamTypes;
   if (HasExplicitTemplateArgs) {
-    if (TemplateDeductionResult Result 
-          = SubstituteExplicitTemplateArguments(FunctionTemplate, 
-                                                ExplicitTemplateArgs, 
+    if (TemplateDeductionResult Result
+          = SubstituteExplicitTemplateArguments(FunctionTemplate,
+                                                ExplicitTemplateArgs,
                                                 NumExplicitTemplateArgs,
-                                                Deduced, ParamTypes, 
+                                                Deduced, ParamTypes,
                                                 &FunctionType, Info))
       return Result;
   }
 
   // Template argument deduction for function templates in a SFINAE context.
   // Trap any errors that might occur.
-  SFINAETrap Trap(*this);  
-  
+  SFINAETrap Trap(*this);
+
   // Deduce template arguments from the function type.
-  Deduced.resize(TemplateParams->size());  
+  Deduced.resize(TemplateParams->size());
   if (TemplateDeductionResult Result
         = ::DeduceTemplateArguments(Context, TemplateParams,
-                                    FunctionType, ArgFunctionType, Info, 
+                                    FunctionType, ArgFunctionType, Info,
                                     Deduced, 0))
     return Result;
-  
-  return FinishTemplateArgumentDeduction(FunctionTemplate, Deduced, 
+
+  return FinishTemplateArgumentDeduction(FunctionTemplate, Deduced,
                                          Specialization, Info);
 }
 
@@ -1485,7 +1485,7 @@
                               QualType ToType,
                               CXXConversionDecl *&Specialization,
                               TemplateDeductionInfo &Info) {
-  CXXConversionDecl *Conv 
+  CXXConversionDecl *Conv
     = cast<CXXConversionDecl>(FunctionTemplate->getTemplatedDecl());
   QualType FromType = Conv->getConversionType();
 
@@ -1506,12 +1506,12 @@
     A = ARef->getPointeeType();
   // C++ [temp.deduct.conv]p2:
   //
-  //   If A is not a reference type: 
+  //   If A is not a reference type:
   else {
     assert(!A->isReferenceType() && "Reference types were handled above");
 
     //   - If P is an array type, the pointer type produced by the
-    //     array-to-pointer standard conversion (4.2) is used in place 
+    //     array-to-pointer standard conversion (4.2) is used in place
     //     of P for type deduction; otherwise,
     if (P->isArrayType())
       P = Context.getArrayDecayedType(P);
@@ -1533,7 +1533,7 @@
 
   // Template argument deduction for function templates in a SFINAE context.
   // Trap any errors that might occur.
-  SFINAETrap Trap(*this);  
+  SFINAETrap Trap(*this);
 
   // C++ [temp.deduct.conv]p1:
   //   Template argument deduction is done by comparing the return
@@ -1543,7 +1543,7 @@
   TemplateParameterList *TemplateParams
     = FunctionTemplate->getTemplateParameters();
   llvm::SmallVector<TemplateArgument, 4> Deduced;
-  Deduced.resize(TemplateParams->size());  
+  Deduced.resize(TemplateParams->size());
 
   // C++0x [temp.deduct.conv]p4:
   //   In general, the deduction process attempts to find template
@@ -1572,7 +1572,7 @@
 
   // FIXME: we need to check that the deduced A is the same as A,
   // modulo the various allowed differences.
-  
+
   // Finish template argument deduction.
   FunctionDecl *Spec = 0;
   TemplateDeductionResult Result
@@ -1591,7 +1591,7 @@
 /// \param isCallContext whether partial ordering is being performed
 /// for a function call (which ignores the return types of the
 /// functions).
-/// 
+///
 /// \returns the more specialization function template. If neither
 /// template is more specialized, returns NULL.
 FunctionTemplateDecl *
@@ -1613,21 +1613,21 @@
 #endif
 }
 
-static void 
+static void
 MarkDeducedTemplateParameters(Sema &SemaRef,
                               const TemplateArgument &TemplateArg,
                               llvm::SmallVectorImpl<bool> &Deduced);
 
 /// \brief Mark the template arguments that are deduced by the given
 /// expression.
-static void 
-MarkDeducedTemplateParameters(const Expr *E, 
+static void
+MarkDeducedTemplateParameters(const Expr *E,
                               llvm::SmallVectorImpl<bool> &Deduced) {
   const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E);
   if (!E)
     return;
 
-  const NonTypeTemplateParmDecl *NTTP 
+  const NonTypeTemplateParmDecl *NTTP
     = dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl());
   if (!NTTP)
     return;
@@ -1637,7 +1637,7 @@
 
 /// \brief Mark the template parameters that are deduced by the given
 /// type.
-static void 
+static void
 MarkDeducedTemplateParameters(Sema &SemaRef, QualType T,
                               llvm::SmallVectorImpl<bool> &Deduced) {
   // Non-dependent types have nothing deducible
@@ -1647,7 +1647,7 @@
   T = SemaRef.Context.getCanonicalType(T);
   switch (T->getTypeClass()) {
   case Type::ExtQual:
-    MarkDeducedTemplateParameters(SemaRef, 
+    MarkDeducedTemplateParameters(SemaRef,
                               QualType(cast<ExtQualType>(T)->getBaseType(), 0),
                                   Deduced);
     break;
@@ -1719,13 +1719,13 @@
     break;
 
   case Type::TemplateSpecialization: {
-    const TemplateSpecializationType *Spec 
+    const TemplateSpecializationType *Spec
       = cast<TemplateSpecializationType>(T);
     if (TemplateDecl *Template = Spec->getTemplateName().getAsTemplateDecl())
-      if (TemplateTemplateParmDecl *TTP 
+      if (TemplateTemplateParmDecl *TTP
             = dyn_cast<TemplateTemplateParmDecl>(Template))
         Deduced[TTP->getIndex()] = true;
-      
+
       for (unsigned I = 0, N = Spec->getNumArgs(); I != N; ++I)
         MarkDeducedTemplateParameters(SemaRef, Spec->getArg(I), Deduced);
 
@@ -1754,7 +1754,7 @@
 
 /// \brief Mark the template parameters that are deduced by this
 /// template argument.
-static void 
+static void
 MarkDeducedTemplateParameters(Sema &SemaRef,
                               const TemplateArgument &TemplateArg,
                               llvm::SmallVectorImpl<bool> &Deduced) {
@@ -1762,13 +1762,13 @@
   case TemplateArgument::Null:
   case TemplateArgument::Integral:
     break;
-    
+
   case TemplateArgument::Type:
     MarkDeducedTemplateParameters(SemaRef, TemplateArg.getAsType(), Deduced);
     break;
 
   case TemplateArgument::Declaration:
-    if (TemplateTemplateParmDecl *TTP 
+    if (TemplateTemplateParmDecl *TTP
         = dyn_cast<TemplateTemplateParmDecl>(TemplateArg.getAsDecl()))
       Deduced[TTP->getIndex()] = true;
     break;
@@ -1791,7 +1791,7 @@
 /// \param Deduced a bit vector whose elements will be set to \c true
 /// to indicate when the corresponding template parameter will be
 /// deduced.
-void 
+void
 Sema::MarkDeducedTemplateParameters(const TemplateArgumentList &TemplateArgs,
                                     llvm::SmallVectorImpl<bool> &Deduced) {
   for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Wed Sep  9 10:08:12 2009
@@ -32,22 +32,22 @@
 Sema::getTemplateInstantiationArgs(NamedDecl *D) {
   // Accumulate the set of template argument lists in this structure.
   MultiLevelTemplateArgumentList Result;
-  
+
   DeclContext *Ctx = dyn_cast<DeclContext>(D);
   if (!Ctx)
     Ctx = D->getDeclContext();
-  
+
   while (!Ctx->isFileContext()) {
     // Add template arguments from a class template instantiation.
-    if (ClassTemplateSpecializationDecl *Spec 
+    if (ClassTemplateSpecializationDecl *Spec
           = dyn_cast<ClassTemplateSpecializationDecl>(Ctx)) {
       // We're done when we hit an explicit specialization.
       if (Spec->getSpecializationKind() == TSK_ExplicitSpecialization)
         break;
-      
+
       Result.addOuterTemplateArguments(&Spec->getTemplateInstantiationArgs());
-    } 
-    
+    }
+
     // Add template arguments from a function template specialization.
     else if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Ctx)) {
       // FIXME: Check whether this is an explicit specialization.
@@ -67,7 +67,7 @@
 
     Ctx = Ctx->getParent();
   }
-  
+
   return Result;
 }
 
@@ -92,7 +92,7 @@
   }
 }
 
-Sema::InstantiatingTemplate::InstantiatingTemplate(Sema &SemaRef, 
+Sema::InstantiatingTemplate::InstantiatingTemplate(Sema &SemaRef,
                                          SourceLocation PointOfInstantiation,
                                          TemplateDecl *Template,
                                          const TemplateArgument *TemplateArgs,
@@ -104,7 +104,7 @@
                                     InstantiationRange);
   if (!Invalid) {
     ActiveTemplateInstantiation Inst;
-    Inst.Kind 
+    Inst.Kind
       = ActiveTemplateInstantiation::DefaultTemplateArgumentInstantiation;
     Inst.PointOfInstantiation = PointOfInstantiation;
     Inst.Entity = reinterpret_cast<uintptr_t>(Template);
@@ -116,7 +116,7 @@
   }
 }
 
-Sema::InstantiatingTemplate::InstantiatingTemplate(Sema &SemaRef, 
+Sema::InstantiatingTemplate::InstantiatingTemplate(Sema &SemaRef,
                                          SourceLocation PointOfInstantiation,
                                       FunctionTemplateDecl *FunctionTemplate,
                                         const TemplateArgument *TemplateArgs,
@@ -124,7 +124,7 @@
                          ActiveTemplateInstantiation::InstantiationKind Kind,
                                               SourceRange InstantiationRange)
 : SemaRef(SemaRef) {
-  
+
   Invalid = CheckInstantiationDepth(PointOfInstantiation,
                                     InstantiationRange);
   if (!Invalid) {
@@ -140,7 +140,7 @@
   }
 }
 
-Sema::InstantiatingTemplate::InstantiatingTemplate(Sema &SemaRef, 
+Sema::InstantiatingTemplate::InstantiatingTemplate(Sema &SemaRef,
                                          SourceLocation PointOfInstantiation,
                           ClassTemplatePartialSpecializationDecl *PartialSpec,
                                          const TemplateArgument *TemplateArgs,
@@ -152,7 +152,7 @@
                                     InstantiationRange);
   if (!Invalid) {
     ActiveTemplateInstantiation Inst;
-    Inst.Kind 
+    Inst.Kind
       = ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution;
     Inst.PointOfInstantiation = PointOfInstantiation;
     Inst.Entity = reinterpret_cast<uintptr_t>(PartialSpec);
@@ -164,14 +164,14 @@
   }
 }
 
-Sema::InstantiatingTemplate::InstantiatingTemplate(Sema &SemaRef, 
+Sema::InstantiatingTemplate::InstantiatingTemplate(Sema &SemaRef,
                                           SourceLocation PointOfInstantation,
                                           ParmVarDecl *Param,
                                           const TemplateArgument *TemplateArgs,
                                           unsigned NumTemplateArgs,
                                           SourceRange InstantiationRange)
   : SemaRef(SemaRef) {
-    
+
   Invalid = CheckInstantiationDepth(PointOfInstantation, InstantiationRange);
 
   if (!Invalid) {
@@ -198,11 +198,11 @@
 bool Sema::InstantiatingTemplate::CheckInstantiationDepth(
                                         SourceLocation PointOfInstantiation,
                                            SourceRange InstantiationRange) {
-  if (SemaRef.ActiveTemplateInstantiations.size() 
+  if (SemaRef.ActiveTemplateInstantiations.size()
        <= SemaRef.getLangOptions().InstantiationDepth)
     return false;
 
-  SemaRef.Diag(PointOfInstantiation, 
+  SemaRef.Diag(PointOfInstantiation,
                diag::err_template_recursion_depth_exceeded)
     << SemaRef.getLangOptions().InstantiationDepth
     << InstantiationRange;
@@ -227,7 +227,7 @@
         unsigned DiagID = diag::note_template_member_class_here;
         if (isa<ClassTemplateSpecializationDecl>(Record))
           DiagID = diag::note_template_class_instantiation_here;
-        Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr), 
+        Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr),
                      DiagID)
           << Context.getTypeDeclType(Record)
           << Active->InstantiationRange;
@@ -237,7 +237,7 @@
           DiagID = diag::note_function_template_spec_here;
         else
           DiagID = diag::note_template_member_function_here;
-        Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr), 
+        Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr),
                      DiagID)
           << Function
           << Active->InstantiationRange;
@@ -254,7 +254,7 @@
       TemplateDecl *Template = cast<TemplateDecl>((Decl *)Active->Entity);
       std::string TemplateArgsStr
         = TemplateSpecializationType::PrintTemplateArgumentList(
-                                                         Active->TemplateArgs, 
+                                                         Active->TemplateArgs,
                                                       Active->NumTemplateArgs,
                                                       Context.PrintingPolicy);
       Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr),
@@ -265,14 +265,14 @@
     }
 
     case ActiveTemplateInstantiation::ExplicitTemplateArgumentSubstitution: {
-      FunctionTemplateDecl *FnTmpl 
+      FunctionTemplateDecl *FnTmpl
         = cast<FunctionTemplateDecl>((Decl *)Active->Entity);
       Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr),
                    diag::note_explicit_template_arg_substitution_here)
         << FnTmpl << Active->InstantiationRange;
       break;
     }
-        
+
     case ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution:
       if (ClassTemplatePartialSpecializationDecl *PartialSpec
             = dyn_cast<ClassTemplatePartialSpecializationDecl>(
@@ -293,10 +293,10 @@
     case ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation: {
       ParmVarDecl *Param = cast<ParmVarDecl>((Decl *)Active->Entity);
       FunctionDecl *FD = cast<FunctionDecl>(Param->getDeclContext());
-      
+
       std::string TemplateArgsStr
         = TemplateSpecializationType::PrintTemplateArgumentList(
-                                                         Active->TemplateArgs, 
+                                                         Active->TemplateArgs,
                                                       Active->NumTemplateArgs,
                                                       Context.PrintingPolicy);
       Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr),
@@ -305,7 +305,7 @@
         << Active->InstantiationRange;
       break;
     }
-        
+
     }
   }
 }
@@ -324,12 +324,12 @@
 
       // This is a template instantiation, so there is no SFINAE.
       return false;
-        
+
     case ActiveTemplateInstantiation::DefaultTemplateArgumentInstantiation:
       // A default template argument instantiation may or may not be a
       // SFINAE context; look further up the stack.
       break;
-        
+
     case ActiveTemplateInstantiation::ExplicitTemplateArgumentSubstitution:
     case ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution:
       // We're either substitution explicitly-specified template arguments
@@ -345,24 +345,23 @@
 // Template Instantiation for Types
 //===----------------------------------------------------------------------===/
 namespace {
-  class VISIBILITY_HIDDEN TemplateInstantiator 
-    : public TreeTransform<TemplateInstantiator> 
-  {
+  class VISIBILITY_HIDDEN TemplateInstantiator
+    : public TreeTransform<TemplateInstantiator> {
     const MultiLevelTemplateArgumentList &TemplateArgs;
     SourceLocation Loc;
     DeclarationName Entity;
 
   public:
     typedef TreeTransform<TemplateInstantiator> inherited;
-    
-    TemplateInstantiator(Sema &SemaRef, 
+
+    TemplateInstantiator(Sema &SemaRef,
                          const MultiLevelTemplateArgumentList &TemplateArgs,
                          SourceLocation Loc,
-                         DeclarationName Entity) 
-      : inherited(SemaRef), TemplateArgs(TemplateArgs), Loc(Loc), 
+                         DeclarationName Entity)
+      : inherited(SemaRef), TemplateArgs(TemplateArgs), Loc(Loc),
         Entity(Entity) { }
 
-    /// \brief Determine whether the given type \p T has already been 
+    /// \brief Determine whether the given type \p T has already been
     /// transformed.
     ///
     /// For the purposes of template instantiation, a type has already been
@@ -370,31 +369,31 @@
     bool AlreadyTransformed(QualType T) {
       return T.isNull() || !T->isDependentType();
     }
-        
+
     /// \brief Returns the location of the entity being instantiated, if known.
     SourceLocation getBaseLocation() { return Loc; }
-    
+
     /// \brief Returns the name of the entity being instantiated, if any.
     DeclarationName getBaseEntity() { return Entity; }
-    
+
     /// \brief Transform the given declaration by instantiating a reference to
     /// this declaration.
     Decl *TransformDecl(Decl *D);
 
-    /// \brief Transform the definition of the given declaration by 
+    /// \brief Transform the definition of the given declaration by
     /// instantiating it.
     Decl *TransformDefinition(Decl *D);
-    
+
     /// \brief Rebuild the exception declaration and register the declaration
     /// as an instantiated local.
-    VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, QualType T, 
+    VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, QualType T,
                                   DeclaratorInfo *Declarator,
                                   IdentifierInfo *Name,
                                   SourceLocation Loc, SourceRange TypeRange);
-    
+
     Sema::OwningExprResult TransformDeclRefExpr(DeclRefExpr *E);
-    
-    /// \brief Transforms a template type parameter type by performing 
+
+    /// \brief Transforms a template type parameter type by performing
     /// substitution of the corresponding template type argument.
     QualType TransformTemplateTypeParmType(const TemplateTypeParmType *T);
   };
@@ -403,28 +402,28 @@
 Decl *TemplateInstantiator::TransformDecl(Decl *D) {
   if (!D)
     return 0;
-  
+
   if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(D)) {
     if (TTP->getDepth() < TemplateArgs.getNumLevels()) {
       assert(TemplateArgs(TTP->getDepth(), TTP->getPosition()).getAsDecl() &&
              "Wrong kind of template template argument");
-      return cast<TemplateDecl>(TemplateArgs(TTP->getDepth(), 
+      return cast<TemplateDecl>(TemplateArgs(TTP->getDepth(),
                                              TTP->getPosition()).getAsDecl());
     }
-    
-    // If the corresponding template argument is NULL or non-existent, it's 
-    // because we are performing instantiation from explicitly-specified 
+
+    // If the corresponding template argument is NULL or non-existent, it's
+    // because we are performing instantiation from explicitly-specified
     // template arguments in a function template, but there were some
     // arguments left unspecified.
-    if (!TemplateArgs.hasTemplateArgument(TTP->getDepth(), 
+    if (!TemplateArgs.hasTemplateArgument(TTP->getDepth(),
                                           TTP->getPosition()))
       return D;
-    
+
     // FIXME: Implement depth reduction of template template parameters
-    assert(false && 
+    assert(false &&
       "Reducing depth of template template parameters is not yet implemented");
   }
-  
+
   return SemaRef.FindInstantiatedDecl(cast<NamedDecl>(D));
 }
 
@@ -432,17 +431,17 @@
   Decl *Inst = getSema().SubstDecl(D, getSema().CurContext, TemplateArgs);
   if (!Inst)
     return 0;
-  
+
   getSema().CurrentInstantiationScope->InstantiatedLocal(D, Inst);
   return Inst;
 }
 
 VarDecl *
 TemplateInstantiator::RebuildExceptionDecl(VarDecl *ExceptionDecl,
-                                           QualType T, 
+                                           QualType T,
                                            DeclaratorInfo *Declarator,
                                            IdentifierInfo *Name,
-                                           SourceLocation Loc, 
+                                           SourceLocation Loc,
                                            SourceRange TypeRange) {
   VarDecl *Var = inherited::RebuildExceptionDecl(ExceptionDecl, T, Declarator,
                                                  Name, Loc, TypeRange);
@@ -451,7 +450,7 @@
   return Var;
 }
 
-Sema::OwningExprResult 
+Sema::OwningExprResult
 TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) {
   // FIXME: Clean this up a bit
   NamedDecl *D = E->getDecl();
@@ -460,91 +459,91 @@
       assert(false && "Cannot reduce non-type template parameter depth yet");
       return getSema().ExprError();
     }
-    
-    // If the corresponding template argument is NULL or non-existent, it's 
-    // because we are performing instantiation from explicitly-specified 
+
+    // If the corresponding template argument is NULL or non-existent, it's
+    // because we are performing instantiation from explicitly-specified
     // template arguments in a function template, but there were some
     // arguments left unspecified.
-    if (!TemplateArgs.hasTemplateArgument(NTTP->getDepth(), 
+    if (!TemplateArgs.hasTemplateArgument(NTTP->getDepth(),
                                           NTTP->getPosition()))
       return SemaRef.Owned(E->Retain());
-    
-    const TemplateArgument &Arg = TemplateArgs(NTTP->getDepth(), 
+
+    const TemplateArgument &Arg = TemplateArgs(NTTP->getDepth(),
                                                NTTP->getPosition());
-    
+
     // The template argument itself might be an expression, in which
     // case we just return that expression.
     if (Arg.getKind() == TemplateArgument::Expression)
       return SemaRef.Owned(Arg.getAsExpr()->Retain());
-    
+
     if (Arg.getKind() == TemplateArgument::Declaration) {
       ValueDecl *VD = cast<ValueDecl>(Arg.getAsDecl());
-      
+
       VD = cast_or_null<ValueDecl>(getSema().FindInstantiatedDecl(VD));
       if (!VD)
         return SemaRef.ExprError();
-      
-      return SemaRef.BuildDeclRefExpr(VD, VD->getType(), E->getLocation(), 
+
+      return SemaRef.BuildDeclRefExpr(VD, VD->getType(), E->getLocation(),
                                       /*FIXME:*/false, /*FIXME:*/false);
     }
-    
+
     assert(Arg.getKind() == TemplateArgument::Integral);
     QualType T = Arg.getIntegralType();
     if (T->isCharType() || T->isWideCharType())
       return SemaRef.Owned(new (SemaRef.Context) CharacterLiteral(
                                             Arg.getAsIntegral()->getZExtValue(),
                                             T->isWideCharType(),
-                                            T, 
+                                            T,
                                             E->getSourceRange().getBegin()));
     if (T->isBooleanType())
       return SemaRef.Owned(new (SemaRef.Context) CXXBoolLiteralExpr(
                                           Arg.getAsIntegral()->getBoolValue(),
-                                          T, 
+                                          T,
                                           E->getSourceRange().getBegin()));
-    
+
     assert(Arg.getAsIntegral()->getBitWidth() == SemaRef.Context.getIntWidth(T));
     return SemaRef.Owned(new (SemaRef.Context) IntegerLiteral(
                                               *Arg.getAsIntegral(),
-                                              T, 
+                                              T,
                                               E->getSourceRange().getBegin()));
   }
-  
+
   NamedDecl *InstD = SemaRef.FindInstantiatedDecl(D);
   if (!InstD)
     return SemaRef.ExprError();
-  
+
   // If we instantiated an UnresolvedUsingDecl and got back an UsingDecl,
-  // we need to get the underlying decl. 
+  // we need to get the underlying decl.
   // FIXME: Is this correct? Maybe FindInstantiatedDecl should do this?
   InstD = InstD->getUnderlyingDecl();
-  
+
   // FIXME: nested-name-specifier for QualifiedDeclRefExpr
-  return SemaRef.BuildDeclarationNameExpr(E->getLocation(), InstD, 
+  return SemaRef.BuildDeclarationNameExpr(E->getLocation(), InstD,
                                           /*FIXME:*/false,
-                                          /*FIXME:*/0, 
-                                          /*FIXME:*/false);  
+                                          /*FIXME:*/0,
+                                          /*FIXME:*/false);
 }
 
-QualType 
+QualType
 TemplateInstantiator::TransformTemplateTypeParmType(
                                               const TemplateTypeParmType *T) {
   if (T->getDepth() < TemplateArgs.getNumLevels()) {
     // Replace the template type parameter with its corresponding
     // template argument.
-    
-    // If the corresponding template argument is NULL or doesn't exist, it's 
-    // because we are performing instantiation from explicitly-specified 
-    // template arguments in a function template class, but there were some 
+
+    // If the corresponding template argument is NULL or doesn't exist, it's
+    // because we are performing instantiation from explicitly-specified
+    // template arguments in a function template class, but there were some
     // arguments left unspecified.
     if (!TemplateArgs.hasTemplateArgument(T->getDepth(), T->getIndex()))
       return QualType(T, 0);
-    
-    assert(TemplateArgs(T->getDepth(), T->getIndex()).getKind() 
+
+    assert(TemplateArgs(T->getDepth(), T->getIndex()).getKind()
              == TemplateArgument::Type &&
            "Template argument kind mismatch");
 
     return TemplateArgs(T->getDepth(), T->getIndex()).getAsType();
-  } 
+  }
 
   // The template type parameter comes from an inner template (e.g.,
   // the template parameter list of a member template inside the
@@ -584,7 +583,7 @@
 ///
 /// \returns If the instantiation succeeds, the instantiated
 /// type. Otherwise, produces diagnostics and returns a NULL type.
-QualType Sema::SubstType(QualType T, 
+QualType Sema::SubstType(QualType T,
                          const MultiLevelTemplateArgumentList &TemplateArgs,
                          SourceLocation Loc, DeclarationName Entity) {
   assert(!ActiveTemplateInstantiations.empty() &&
@@ -605,13 +604,13 @@
 /// Produces a diagnostic and returns true on error, returns false and
 /// attaches the instantiated base classes to the class template
 /// specialization if successful.
-bool 
+bool
 Sema::SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
                           CXXRecordDecl *Pattern,
                           const MultiLevelTemplateArgumentList &TemplateArgs) {
   bool Invalid = false;
   llvm::SmallVector<CXXBaseSpecifier*, 4> InstantiatedBases;
-  for (ClassTemplateSpecializationDecl::base_class_iterator 
+  for (ClassTemplateSpecializationDecl::base_class_iterator
          Base = Pattern->bases_begin(), BaseEnd = Pattern->bases_end();
        Base != BaseEnd; ++Base) {
     if (!Base->getType()->isDependentType()) {
@@ -619,8 +618,8 @@
       continue;
     }
 
-    QualType BaseType = SubstType(Base->getType(), 
-                                  TemplateArgs, 
+    QualType BaseType = SubstType(Base->getType(),
+                                  TemplateArgs,
                                   Base->getSourceRange().getBegin(),
                                   DeclarationName());
     if (BaseType.isNull()) {
@@ -679,7 +678,7 @@
                        bool Complain) {
   bool Invalid = false;
 
-  CXXRecordDecl *PatternDef 
+  CXXRecordDecl *PatternDef
     = cast_or_null<CXXRecordDecl>(Pattern->getDefinition(Context));
   if (!PatternDef) {
     if (!Complain) {
@@ -717,7 +716,7 @@
 
   llvm::SmallVector<DeclPtrTy, 4> Fields;
   for (RecordDecl::decl_iterator Member = Pattern->decls_begin(),
-         MemberEnd = Pattern->decls_end(); 
+         MemberEnd = Pattern->decls_end();
        Member != MemberEnd; ++Member) {
     Decl *NewMember = SubstDecl(*Member, Instantiation, TemplateArgs);
     if (NewMember) {
@@ -758,7 +757,7 @@
   return Invalid;
 }
 
-bool 
+bool
 Sema::InstantiateClassTemplateSpecialization(
                            ClassTemplateSpecializationDecl *ClassTemplateSpec,
                            TemplateSpecializationKind TSK,
@@ -787,14 +786,14 @@
   typedef std::pair<ClassTemplatePartialSpecializationDecl *,
                     TemplateArgumentList *> MatchResult;
   llvm::SmallVector<MatchResult, 4> Matched;
-  for (llvm::FoldingSet<ClassTemplatePartialSpecializationDecl>::iterator 
+  for (llvm::FoldingSet<ClassTemplatePartialSpecializationDecl>::iterator
          Partial = Template->getPartialSpecializations().begin(),
          PartialEnd = Template->getPartialSpecializations().end();
        Partial != PartialEnd;
        ++Partial) {
     TemplateDeductionInfo Info(Context);
     if (TemplateDeductionResult Result
-          = DeduceTemplateArguments(&*Partial, 
+          = DeduceTemplateArguments(&*Partial,
                                     ClassTemplateSpec->getTemplateArgs(),
                                     Info)) {
       // FIXME: Store the failed-deduction information for use in
@@ -820,14 +819,14 @@
     //      ambiguous and the program is ill-formed.
     // FIXME: Implement partial ordering of class template partial
     // specializations.
-    Diag(ClassTemplateSpec->getLocation(), 
+    Diag(ClassTemplateSpec->getLocation(),
          diag::unsup_template_partial_spec_ordering);
 
     // FIXME: Temporary hack to fall back to the primary template
     ClassTemplateDecl *OrigTemplate = Template;
     while (OrigTemplate->getInstantiatedFromMemberTemplate())
       OrigTemplate = OrigTemplate->getInstantiatedFromMemberTemplate();
-    
+
     Pattern = OrigTemplate->getTemplatedDecl();
   } else {
     //   -- If no matches are found, the instantiation is generated
@@ -835,7 +834,7 @@
     ClassTemplateDecl *OrigTemplate = Template;
     while (OrigTemplate->getInstantiatedFromMemberTemplate())
       OrigTemplate = OrigTemplate->getInstantiatedFromMemberTemplate();
-    
+
     Pattern = OrigTemplate->getTemplatedDecl();
   }
 
@@ -843,17 +842,17 @@
   ClassTemplateSpec->setSpecializationKind(TSK);
 
   bool Result = InstantiateClass(ClassTemplateSpec->getLocation(),
-                                 ClassTemplateSpec, Pattern, 
+                                 ClassTemplateSpec, Pattern,
                               getTemplateInstantiationArgs(ClassTemplateSpec),
                                  TSK,
                                  Complain);
-  
+
   for (unsigned I = 0, N = Matched.size(); I != N; ++I) {
     // FIXME: Implement TemplateArgumentList::Destroy!
     //    if (Matched[I].first != Pattern)
     //      Matched[I].second->Destroy(Context);
   }
-  
+
   return Result;
 }
 
@@ -877,7 +876,7 @@
         InstantiateStaticDataMemberDefinition(PointOfInstantiation, Var);
     } else if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(*D)) {
       if (!Record->isInjectedClassName() && !Record->getDefinition(Context)) {
-        assert(Record->getInstantiatedFromMemberClass() && 
+        assert(Record->getInstantiatedFromMemberClass() &&
                "Missing instantiated-from-template information");
         InstantiateClass(PointOfInstantiation, Record,
                          Record->getInstantiatedFromMemberClass(),
@@ -891,7 +890,7 @@
 /// \brief Instantiate the definitions of all of the members of the
 /// given class template specialization, which was named as part of an
 /// explicit instantiation.
-void 
+void
 Sema::InstantiateClassTemplateSpecializationMembers(
                                            SourceLocation PointOfInstantiation,
                             ClassTemplateSpecializationDecl *ClassTemplateSpec,
@@ -909,7 +908,7 @@
                           TSK);
 }
 
-Sema::OwningStmtResult 
+Sema::OwningStmtResult
 Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) {
   if (!S)
     return Owned(S);
@@ -920,11 +919,11 @@
   return Instantiator.TransformStmt(S);
 }
 
-Sema::OwningExprResult 
+Sema::OwningExprResult
 Sema::SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs) {
   if (!E)
     return Owned(E);
-  
+
   TemplateInstantiator Instantiator(*this, TemplateArgs,
                                     SourceLocation(),
                                     DeclarationName());
@@ -949,7 +948,7 @@
   return Instantiator.TransformTemplateName(Name);
 }
 
-TemplateArgument Sema::Subst(TemplateArgument Arg, 
+TemplateArgument Sema::Subst(TemplateArgument Arg,
                          const MultiLevelTemplateArgumentList &TemplateArgs) {
   TemplateInstantiator Instantiator(*this, TemplateArgs, SourceLocation(),
                                     DeclarationName());

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Wed Sep  9 10:08:12 2009
@@ -22,19 +22,19 @@
 using namespace clang;
 
 namespace {
-  class VISIBILITY_HIDDEN TemplateDeclInstantiator 
+  class VISIBILITY_HIDDEN TemplateDeclInstantiator
     : public DeclVisitor<TemplateDeclInstantiator, Decl *> {
     Sema &SemaRef;
     DeclContext *Owner;
     const MultiLevelTemplateArgumentList &TemplateArgs;
-    
+
   public:
     typedef Sema::OwningExprResult OwningExprResult;
 
     TemplateDeclInstantiator(Sema &SemaRef, DeclContext *Owner,
                              const MultiLevelTemplateArgumentList &TemplateArgs)
       : SemaRef(SemaRef), Owner(Owner), TemplateArgs(TemplateArgs) { }
-    
+
     // FIXME: Once we get closer to completion, replace these manually-written
     // declarations with automatically-generated ones from
     // clang/AST/DeclNodes.def.
@@ -60,9 +60,9 @@
     Decl *VisitFunctionTemplateDecl(FunctionTemplateDecl *D);
     Decl *VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D);
     Decl *VisitUnresolvedUsingDecl(UnresolvedUsingDecl *D);
-      
+
     // Base case. FIXME: Remove once we can instantiate everything.
-    Decl *VisitDecl(Decl *) { 
+    Decl *VisitDecl(Decl *) {
       assert(false && "Template instantiation of unknown declaration kind!");
       return 0;
     }
@@ -98,14 +98,14 @@
   bool Invalid = false;
   QualType T = D->getUnderlyingType();
   if (T->isDependentType()) {
-    T = SemaRef.SubstType(T, TemplateArgs, 
+    T = SemaRef.SubstType(T, TemplateArgs,
                           D->getLocation(), D->getDeclName());
     if (T.isNull()) {
       Invalid = true;
       T = SemaRef.Context.IntTy;
     }
   }
-       
+
   // Create the new typedef
   TypedefDecl *Typedef
     = TypedefDecl::Create(SemaRef.Context, Owner, D->getLocation(),
@@ -114,7 +114,7 @@
     Typedef->setInvalidDecl();
 
   Owner->addDecl(Typedef);
-    
+
   return Typedef;
 }
 
@@ -134,32 +134,32 @@
   Var->setThreadSpecified(D->isThreadSpecified());
   Var->setCXXDirectInitializer(D->hasCXXDirectInitializer());
   Var->setDeclaredInCondition(D->isDeclaredInCondition());
- 
-  // If we are instantiating a static data member defined 
+
+  // If we are instantiating a static data member defined
   // out-of-line, the instantiation will have the same lexical
   // context (which will be a namespace scope) as the template.
   if (D->isOutOfLine())
     Var->setLexicalDeclContext(D->getLexicalDeclContext());
-  
+
   // FIXME: In theory, we could have a previous declaration for variables that
   // are not static data members.
   bool Redeclaration = false;
   SemaRef.CheckVariableDeclaration(Var, 0, Redeclaration);
-  
+
   if (D->isOutOfLine()) {
     D->getLexicalDeclContext()->addDecl(Var);
     Owner->makeDeclVisibleInContext(Var);
   } else {
     Owner->addDecl(Var);
   }
-  
+
   if (D->getInit()) {
-    OwningExprResult Init 
+    OwningExprResult Init
       = SemaRef.SubstExpr(D->getInit(), TemplateArgs);
     if (Init.isInvalid())
       Var->setInvalidDecl();
     else if (ParenListExpr *PLE = dyn_cast<ParenListExpr>((Expr *)Init.get())) {
-      // FIXME: We're faking all of the comma locations, which is suboptimal. 
+      // FIXME: We're faking all of the comma locations, which is suboptimal.
       // Do we even need these comma locations?
       llvm::SmallVector<SourceLocation, 4> FakeCommaLocs;
       if (PLE->getNumExprs() > 0) {
@@ -171,16 +171,16 @@
         }
         PLE->getExpr(PLE->getNumExprs() - 1)->Retain();
       }
-      
+
       // Add the direct initializer to the declaration.
       SemaRef.AddCXXDirectInitializerToDecl(Sema::DeclPtrTy::make(Var),
-                                            PLE->getLParenLoc(), 
+                                            PLE->getLParenLoc(),
                                             Sema::MultiExprArg(SemaRef,
                                                        (void**)PLE->getExprs(),
                                                            PLE->getNumExprs()),
                                             FakeCommaLocs.data(),
                                             PLE->getRParenLoc());
-      
+
       // When Init is destroyed, it will destroy the instantiated ParenListExpr;
       // we've explicitly retained all of its subexpressions already.
     } else
@@ -193,7 +193,7 @@
   // which they were instantiated.
   if (Var->isStaticDataMember())
     SemaRef.Context.setInstantiatedFromStaticDataMember(Var, D);
-    
+
   return Var;
 }
 
@@ -223,7 +223,7 @@
   else if (BitWidth) {
     // The bit-width expression is not potentially evaluated.
     EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
-    
+
     OwningExprResult InstantiatedBitWidth
       = SemaRef.SubstExpr(BitWidth, TemplateArgs);
     if (InstantiatedBitWidth.isInvalid()) {
@@ -235,7 +235,7 @@
 
   FieldDecl *Field = SemaRef.CheckFieldDecl(D->getDeclName(), T,
                                             D->getDeclaratorInfo(),
-                                            cast<RecordDecl>(Owner), 
+                                            cast<RecordDecl>(Owner),
                                             D->getLocation(),
                                             D->isMutable(),
                                             BitWidth,
@@ -244,15 +244,15 @@
                                             0);
   if (!Field)
     return 0;
-  
+
   if (Invalid)
     Field->setInvalidDecl();
-    
+
   if (!Field->getDeclName()) {
     // Keep track of where this decl came from.
     SemaRef.Context.setInstantiatedFromUnnamedFieldDecl(Field, D);
   }
-    
+
   Field->setImplicit(D->isImplicit());
   Owner->addDecl(Field);
 
@@ -282,7 +282,7 @@
 
     FU = cast<NamedDecl>(NewND);
   }
-  
+
   FriendDecl *FD =
     FriendDecl::Create(SemaRef.Context, Owner, D->getLocation(), FU,
                        D->getFriendLoc());
@@ -293,10 +293,10 @@
 
 Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) {
   Expr *AssertExpr = D->getAssertExpr();
-      
+
   // The expression in a static assertion is not potentially evaluated.
   EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
-  
+
   OwningExprResult InstantiatedAssertExpr
     = SemaRef.SubstExpr(AssertExpr, TemplateArgs);
   if (InstantiatedAssertExpr.isInvalid())
@@ -304,15 +304,15 @@
 
   OwningExprResult Message(SemaRef, D->getMessage());
   D->getMessage()->Retain();
-  Decl *StaticAssert 
-    = SemaRef.ActOnStaticAssertDeclaration(D->getLocation(), 
+  Decl *StaticAssert
+    = SemaRef.ActOnStaticAssertDeclaration(D->getLocation(),
                                            move(InstantiatedAssertExpr),
                                            move(Message)).getAs<Decl>();
   return StaticAssert;
 }
 
 Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
-  EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner, 
+  EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner,
                                     D->getLocation(), D->getIdentifier(),
                                     D->getTagKeywordLoc(),
                                     /*PrevDecl=*/0);
@@ -331,9 +331,9 @@
     OwningExprResult Value = SemaRef.Owned((Expr *)0);
     if (Expr *UninstValue = EC->getInitExpr()) {
       // The enumerator's value expression is not potentially evaluated.
-      EnterExpressionEvaluationContext Unevaluated(SemaRef, 
+      EnterExpressionEvaluationContext Unevaluated(SemaRef,
                                                    Action::Unevaluated);
-      
+
       Value = SemaRef.SubstExpr(UninstValue, TemplateArgs);
     }
 
@@ -344,7 +344,7 @@
       isInvalid = true;
     }
 
-    EnumConstantDecl *EnumConst 
+    EnumConstantDecl *EnumConst
       = SemaRef.CheckEnumConstant(Enum, LastEnumConst,
                                   EC->getLocation(), EC->getIdentifier(),
                                   move(Value));
@@ -361,7 +361,7 @@
       LastEnumConst = EnumConst;
     }
   }
-      
+
   // FIXME: Fixup LBraceLoc and RBraceLoc
   // FIXME: Empty Scope and AttributeList (required to handle attribute packed).
   SemaRef.ActOnEnumBody(Enum->getLocation(), SourceLocation(), SourceLocation(),
@@ -380,7 +380,7 @@
 Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
   TemplateParameterList *TempParams = D->getTemplateParameters();
   TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
-  if (!InstParams) 
+  if (!InstParams)
     return NULL;
 
   CXXRecordDecl *Pattern = D->getTemplatedDecl();
@@ -403,23 +403,23 @@
 Decl *
 TemplateDeclInstantiator::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
   // FIXME: Dig out the out-of-line definition of this function template?
-  
+
   TemplateParameterList *TempParams = D->getTemplateParameters();
   TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
-  if (!InstParams) 
+  if (!InstParams)
     return NULL;
-  
-  // FIXME: Handle instantiation of nested function templates that aren't 
+
+  // FIXME: Handle instantiation of nested function templates that aren't
   // member function templates. This could happen inside a FriendDecl.
   assert(isa<CXXMethodDecl>(D->getTemplatedDecl()));
-  CXXMethodDecl *InstMethod 
+  CXXMethodDecl *InstMethod
     = cast_or_null<CXXMethodDecl>(
-                 VisitCXXMethodDecl(cast<CXXMethodDecl>(D->getTemplatedDecl()), 
+                 VisitCXXMethodDecl(cast<CXXMethodDecl>(D->getTemplatedDecl()),
                                     InstParams));
   if (!InstMethod)
     return 0;
 
-  // Link the instantiated function template declaration to the function 
+  // Link the instantiated function template declaration to the function
   // template from which it was instantiated.
   FunctionTemplateDecl *InstTemplate = InstMethod->getDescribedFunctionTemplate();
   assert(InstTemplate && "VisitCXXMethodDecl didn't create a template!");
@@ -434,7 +434,7 @@
     PrevDecl = cast<CXXRecordDecl>(Owner);
 
   CXXRecordDecl *Record
-    = CXXRecordDecl::Create(SemaRef.Context, D->getTagKind(), Owner, 
+    = CXXRecordDecl::Create(SemaRef.Context, D->getTagKind(), Owner,
                             D->getLocation(), D->getIdentifier(),
                             D->getTagKeywordLoc(), PrevDecl);
   Record->setImplicit(D->isImplicit());
@@ -469,22 +469,22 @@
   void *InsertPos = 0;
   if (FunctionTemplate) {
     llvm::FoldingSetNodeID ID;
-    FunctionTemplateSpecializationInfo::Profile(ID, 
+    FunctionTemplateSpecializationInfo::Profile(ID,
                              TemplateArgs.getInnermost().getFlatArgumentList(),
                                        TemplateArgs.getInnermost().flat_size(),
                                                 SemaRef.Context);
-    
-    FunctionTemplateSpecializationInfo *Info 
-      = FunctionTemplate->getSpecializations().FindNodeOrInsertPos(ID, 
+
+    FunctionTemplateSpecializationInfo *Info
+      = FunctionTemplate->getSpecializations().FindNodeOrInsertPos(ID,
                                                                    InsertPos);
-    
+
     // If we already have a function template specialization, return it.
     if (Info)
       return Info->Function;
   }
-  
+
   Sema::LocalInstantiationScope Scope(SemaRef);
-  
+
   llvm::SmallVector<ParmVarDecl *, 4> Params;
   QualType T = SubstFunctionType(D, Params);
   if (T.isNull())
@@ -493,12 +493,12 @@
   // Build the instantiated method declaration.
   DeclContext *DC = SemaRef.FindInstantiatedContext(D->getDeclContext());
   FunctionDecl *Function =
-      FunctionDecl::Create(SemaRef.Context, DC, D->getLocation(), 
+      FunctionDecl::Create(SemaRef.Context, DC, D->getLocation(),
                            D->getDeclName(), T, D->getDeclaratorInfo(),
                            D->getStorageClass(),
                            D->isInline(), D->hasWrittenPrototype());
   Function->setLexicalDeclContext(Owner);
-  
+
   // Attach the parameters
   for (unsigned P = 0; P < Params.size(); ++P)
     Params[P]->setOwningFunction(Function);
@@ -514,10 +514,10 @@
 
     Function->setInstantiationOfMemberFunction(D);
   }
-  
+
   if (InitFunctionInstantiation(Function, D))
     Function->setInvalidDecl();
-  
+
   bool Redeclaration = false;
   bool OverloadableAttrRequired = false;
   NamedDecl *PrevDecl = 0;
@@ -541,19 +541,19 @@
   FunctionTemplateDecl *FunctionTemplate = D->getDescribedFunctionTemplate();
   void *InsertPos = 0;
   if (FunctionTemplate && !TemplateParams) {
-    // We are creating a function template specialization from a function 
-    // template. Check whether there is already a function template 
+    // We are creating a function template specialization from a function
+    // template. Check whether there is already a function template
     // specialization for this particular set of template arguments.
     llvm::FoldingSetNodeID ID;
-    FunctionTemplateSpecializationInfo::Profile(ID, 
+    FunctionTemplateSpecializationInfo::Profile(ID,
                             TemplateArgs.getInnermost().getFlatArgumentList(),
                                       TemplateArgs.getInnermost().flat_size(),
                                                 SemaRef.Context);
-    
-    FunctionTemplateSpecializationInfo *Info 
-      = FunctionTemplate->getSpecializations().FindNodeOrInsertPos(ID, 
+
+    FunctionTemplateSpecializationInfo *Info
+      = FunctionTemplate->getSpecializations().FindNodeOrInsertPos(ID,
                                                                    InsertPos);
-    
+
     // If we already have a function template specialization, return it.
     if (Info)
       return Info->Function;
@@ -569,17 +569,17 @@
   // Build the instantiated method declaration.
   CXXRecordDecl *Record = cast<CXXRecordDecl>(Owner);
   CXXMethodDecl *Method = 0;
-  
+
   DeclarationName Name = D->getDeclName();
   if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
     QualType ClassTy = SemaRef.Context.getTypeDeclType(Record);
     Name = SemaRef.Context.DeclarationNames.getCXXConstructorName(
                                     SemaRef.Context.getCanonicalType(ClassTy));
-    Method = CXXConstructorDecl::Create(SemaRef.Context, Record, 
-                                        Constructor->getLocation(), 
-                                        Name, T, 
+    Method = CXXConstructorDecl::Create(SemaRef.Context, Record,
+                                        Constructor->getLocation(),
+                                        Name, T,
                                         Constructor->getDeclaratorInfo(),
-                                        Constructor->isExplicit(), 
+                                        Constructor->isExplicit(),
                                         Constructor->isInline(), false);
   } else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) {
     QualType ClassTy = SemaRef.Context.getTypeDeclType(Record);
@@ -589,7 +589,7 @@
                                        Destructor->getLocation(), Name,
                                        T, Destructor->isInline(), false);
   } else if (CXXConversionDecl *Conversion = dyn_cast<CXXConversionDecl>(D)) {
-    CanQualType ConvTy 
+    CanQualType ConvTy
       = SemaRef.Context.getCanonicalType(
                                       T->getAsFunctionType()->getResultType());
     Name = SemaRef.Context.DeclarationNames.getCXXConversionFunctionName(
@@ -597,10 +597,10 @@
     Method = CXXConversionDecl::Create(SemaRef.Context, Record,
                                        Conversion->getLocation(), Name,
                                        T, Conversion->getDeclaratorInfo(),
-                                       Conversion->isInline(), 
+                                       Conversion->isInline(),
                                        Conversion->isExplicit());
   } else {
-    Method = CXXMethodDecl::Create(SemaRef.Context, Record, D->getLocation(), 
+    Method = CXXMethodDecl::Create(SemaRef.Context, Record, D->getLocation(),
                                    D->getDeclName(), T, D->getDeclaratorInfo(),
                                    D->isStatic(), D->isInline());
   }
@@ -608,7 +608,7 @@
   if (TemplateParams) {
     // Our resulting instantiation is actually a function template, since we
     // are substituting only the outer template parameters. For example, given
-    // 
+    //
     //   template<typename T>
     //   struct X {
     //     template<typename U> void f(T, U);
@@ -621,20 +621,20 @@
     // Build the function template itself.
     FunctionTemplate = FunctionTemplateDecl::Create(SemaRef.Context, Record,
                                                     Method->getLocation(),
-                                                    Method->getDeclName(), 
+                                                    Method->getDeclName(),
                                                     TemplateParams, Method);
     if (D->isOutOfLine())
-      FunctionTemplate->setLexicalDeclContext(D->getLexicalDeclContext());    
+      FunctionTemplate->setLexicalDeclContext(D->getLexicalDeclContext());
     Method->setDescribedFunctionTemplate(FunctionTemplate);
   } else if (!FunctionTemplate)
     Method->setInstantiationOfMemberFunction(D);
 
-  // If we are instantiating a member function defined 
+  // If we are instantiating a member function defined
   // out-of-line, the instantiation will have the same lexical
   // context (which will be a namespace scope) as the template.
   if (D->isOutOfLine())
     Method->setLexicalDeclContext(D->getLexicalDeclContext());
-  
+
   // Attach the parameters
   for (unsigned P = 0; P < Params.size(); ++P)
     Params[P]->setOwningFunction(Method);
@@ -644,11 +644,11 @@
     Method->setInvalidDecl();
 
   NamedDecl *PrevDecl = 0;
-  
+
   if (!FunctionTemplate || TemplateParams) {
-    PrevDecl = SemaRef.LookupQualifiedName(Owner, Name, 
+    PrevDecl = SemaRef.LookupQualifiedName(Owner, Name,
                                            Sema::LookupOrdinaryName, true);
-  
+
     // In C++, the previous declaration we find might be a tag type
     // (class or enum). In this case, the new declaration will hide the
     // tag type. Note that this does does not apply if we're declaring a
@@ -663,7 +663,7 @@
                                               FunctionTemplate,
                                               &TemplateArgs.getInnermost(),
                                               InsertPos);
-  
+
   bool Redeclaration = false;
   bool OverloadableAttrRequired = false;
   SemaRef.CheckFunctionDeclaration(Method, PrevDecl, Redeclaration,
@@ -671,7 +671,7 @@
 
   if (!FunctionTemplate && (!Method->isInvalidDecl() || !PrevDecl))
     Owner->addDecl(Method);
-  
+
   return Method;
 }
 
@@ -702,7 +702,7 @@
                                 D->getIdentifier(), T, D->getDeclaratorInfo(),
                                 D->getStorageClass(), 0);
   else
-    Param = OriginalParmVarDecl::Create(SemaRef.Context, Owner, 
+    Param = OriginalParmVarDecl::Create(SemaRef.Context, Owner,
                                         D->getLocation(), D->getIdentifier(),
                                         T, D->getDeclaratorInfo(), OrigT,
                                         D->getStorageClass(), 0);
@@ -710,7 +710,7 @@
   // Mark the default argument as being uninstantiated.
   if (Expr *Arg = D->getDefaultArg())
     Param->setUninstantiatedDefaultArg(Arg);
-  
+
   // Note: we don't try to instantiate function parameters until after
   // we've instantiated the function's type. Therefore, we don't have
   // to check for 'void' parameter types here.
@@ -733,7 +733,7 @@
   const Type* T = D->getTypeForDecl();
   assert(T->isTemplateTypeParmType());
   const TemplateTypeParmType *TTPT = T->getAs<TemplateTypeParmType>();
-  
+
   TemplateTypeParmDecl *Inst =
     TemplateTypeParmDecl::Create(SemaRef.Context, Owner, D->getLocation(),
                                  TTPT->getDepth(), TTPT->getIndex(),
@@ -747,7 +747,7 @@
       = SemaRef.SubstType(DefaultPattern, TemplateArgs,
                           D->getDefaultArgumentLoc(),
                           D->getDeclName());
-    
+
     Inst->setDefaultArgument(DefaultInst,
                              D->getDefaultArgumentLoc(),
                              D->defaultArgumentWasInherited() /* preserve? */);
@@ -758,23 +758,23 @@
 
 Decl *
 TemplateDeclInstantiator::VisitUnresolvedUsingDecl(UnresolvedUsingDecl *D) {
-  NestedNameSpecifier *NNS = 
-    SemaRef.SubstNestedNameSpecifier(D->getTargetNestedNameSpecifier(), 
-                                     D->getTargetNestedNameRange(), 
+  NestedNameSpecifier *NNS =
+    SemaRef.SubstNestedNameSpecifier(D->getTargetNestedNameSpecifier(),
+                                     D->getTargetNestedNameRange(),
                                      TemplateArgs);
   if (!NNS)
     return 0;
-  
+
   CXXScopeSpec SS;
   SS.setRange(D->getTargetNestedNameRange());
   SS.setScopeRep(NNS);
-  
-  NamedDecl *UD = 
-    SemaRef.BuildUsingDeclaration(D->getLocation(), SS, 
-                                  D->getTargetNameLocation(), 
+
+  NamedDecl *UD =
+    SemaRef.BuildUsingDeclaration(D->getLocation(), SS,
+                                  D->getTargetNameLocation(),
                                   D->getTargetName(), 0, D->isTypeName());
   if (UD)
-    SemaRef.Context.setInstantiatedFromUnresolvedUsingDecl(cast<UsingDecl>(UD), 
+    SemaRef.Context.setInstantiatedFromUnresolvedUsingDecl(cast<UsingDecl>(UD),
                                                            D);
   return UD;
 }
@@ -821,7 +821,7 @@
                                     L->getLAngleLoc(), &Params.front(), N,
                                     L->getRAngleLoc());
   return InstL;
-} 
+}
 
 /// \brief Does substitution on the type of the given function, including
 /// all of the function parameters.
@@ -832,7 +832,7 @@
 
 /// \returns the instantiated function's type if successful, a NULL
 /// type if there was an error.
-QualType 
+QualType
 TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D,
                               llvm::SmallVectorImpl<ParmVarDecl *> &Params) {
   bool InvalidDecl = false;
@@ -840,14 +840,14 @@
   // Substitute all of the function's formal parameter types.
   TemplateDeclInstantiator ParamInstantiator(SemaRef, 0, TemplateArgs);
   llvm::SmallVector<QualType, 4> ParamTys;
-  for (FunctionDecl::param_iterator P = D->param_begin(), 
+  for (FunctionDecl::param_iterator P = D->param_begin(),
                                  PEnd = D->param_end();
        P != PEnd; ++P) {
     if (ParmVarDecl *PInst = ParamInstantiator.VisitParmVarDecl(*P)) {
       if (PInst->getType()->isVoidType()) {
         SemaRef.Diag(PInst->getLocation(), diag::err_param_with_void_type);
         PInst->setInvalidDecl();
-      } else if (SemaRef.RequireNonAbstractType(PInst->getLocation(), 
+      } else if (SemaRef.RequireNonAbstractType(PInst->getLocation(),
                                                 PInst->getType(),
                                                 diag::err_abstract_type_in_decl,
                                                 Sema::AbstractParamType))
@@ -858,7 +858,7 @@
 
       if (PInst->isInvalidDecl())
         InvalidDecl = true;
-    } else 
+    } else
       InvalidDecl = true;
   }
 
@@ -868,7 +868,7 @@
 
   const FunctionProtoType *Proto = D->getType()->getAsFunctionProtoType();
   assert(Proto && "Missing prototype?");
-  QualType ResultType 
+  QualType ResultType
     = SemaRef.SubstType(Proto->getResultType(), TemplateArgs,
                         D->getLocation(), D->getDeclName());
   if (ResultType.isNull())
@@ -879,21 +879,21 @@
                                    D->getLocation(), D->getDeclName());
 }
 
-/// \brief Initializes the common fields of an instantiation function 
+/// \brief Initializes the common fields of an instantiation function
 /// declaration (New) from the corresponding fields of its template (Tmpl).
 ///
 /// \returns true if there was an error
-bool 
-TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, 
+bool
+TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
                                                     FunctionDecl *Tmpl) {
   if (Tmpl->isDeleted())
     New->setDeleted();
-  
+
   // If we are performing substituting explicitly-specified template arguments
   // or deduced template arguments into a function template and we reach this
   // point, we are now past the point where SFINAE applies and have committed
-  // to keeping the new function template specialization. We therefore 
-  // convert the active template instantiation for the function template 
+  // to keeping the new function template specialization. We therefore
+  // convert the active template instantiation for the function template
   // into a template instantiation for this specific function template
   // specialization, which is not a SFINAE context, so that we diagnose any
   // further errors in the declaration itself.
@@ -901,16 +901,16 @@
   ActiveInstType &ActiveInst = SemaRef.ActiveTemplateInstantiations.back();
   if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
       ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
-    if (FunctionTemplateDecl *FunTmpl 
+    if (FunctionTemplateDecl *FunTmpl
           = dyn_cast<FunctionTemplateDecl>((Decl *)ActiveInst.Entity)) {
-      assert(FunTmpl->getTemplatedDecl() == Tmpl && 
+      assert(FunTmpl->getTemplatedDecl() == Tmpl &&
              "Deduction from the wrong function template?");
       (void) FunTmpl;
       ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
       ActiveInst.Entity = reinterpret_cast<uintptr_t>(New);
     }
   }
-    
+
   return false;
 }
 
@@ -919,12 +919,12 @@
 /// (Tmpl).
 ///
 /// \returns true if there was an error
-bool 
-TemplateDeclInstantiator::InitMethodInstantiation(CXXMethodDecl *New, 
+bool
+TemplateDeclInstantiator::InitMethodInstantiation(CXXMethodDecl *New,
                                                   CXXMethodDecl *Tmpl) {
   if (InitFunctionInstantiation(New, Tmpl))
     return true;
-  
+
   CXXRecordDecl *Record = cast<CXXRecordDecl>(Owner);
   New->setAccess(Tmpl->getAccess());
   if (Tmpl->isVirtualAsWritten()) {
@@ -964,15 +964,15 @@
     return;
 
   assert(!Function->getBody() && "Already instantiated!");
-  
+
   // Find the function body that we'll be substituting.
   const FunctionDecl *PatternDecl = 0;
   if (FunctionTemplateDecl *Primary = Function->getPrimaryTemplate()) {
     while (Primary->getInstantiatedFromMemberTemplate())
       Primary = Primary->getInstantiatedFromMemberTemplate();
-    
+
     PatternDecl = Primary->getTemplatedDecl();
-  } else 
+  } else
     PatternDecl = Function->getInstantiatedFromMemberFunction();
   Stmt *Pattern = 0;
   if (PatternDecl)
@@ -983,13 +983,13 @@
 
   // C++0x [temp.explicit]p9:
   //   Except for inline functions, other explicit instantiation declarations
-  //   have the effect of suppressing the implicit instantiation of the entity 
+  //   have the effect of suppressing the implicit instantiation of the entity
   //   to which they refer.
-  if (Function->getTemplateSpecializationKind() 
+  if (Function->getTemplateSpecializationKind()
         == TSK_ExplicitInstantiationDeclaration &&
       PatternDecl->isOutOfLine() && !PatternDecl->isInline())
     return;
-  
+
   InstantiatingTemplate Inst(*this, PointOfInstantiation, Function);
   if (Inst)
     return;
@@ -1000,13 +1000,13 @@
   std::deque<PendingImplicitInstantiation> SavedPendingImplicitInstantiations;
   if (Recursive)
     PendingImplicitInstantiations.swap(SavedPendingImplicitInstantiations);
-  
+
   ActOnStartOfFunctionDef(0, DeclPtrTy::make(Function));
 
   // Introduce a new scope where local variable instantiations will be
   // recorded.
   LocalInstantiationScope Scope(*this);
-  
+
   // Introduce the instantiated function parameters into the local
   // instantiation scope.
   for (unsigned I = 0, N = PatternDecl->getNumParams(); I != N; ++I)
@@ -1018,32 +1018,32 @@
   DeclContext *PreviousContext = CurContext;
   CurContext = Function;
 
-  MultiLevelTemplateArgumentList TemplateArgs = 
+  MultiLevelTemplateArgumentList TemplateArgs =
     getTemplateInstantiationArgs(Function);
 
   // If this is a constructor, instantiate the member initializers.
-  if (const CXXConstructorDecl *Ctor = 
+  if (const CXXConstructorDecl *Ctor =
         dyn_cast<CXXConstructorDecl>(PatternDecl)) {
     InstantiateMemInitializers(cast<CXXConstructorDecl>(Function), Ctor,
                                TemplateArgs);
-  }      
-  
+  }
+
   // Instantiate the function body.
   OwningStmtResult Body = SubstStmt(Pattern, TemplateArgs);
 
-  ActOnFinishFunctionBody(DeclPtrTy::make(Function), move(Body), 
+  ActOnFinishFunctionBody(DeclPtrTy::make(Function), move(Body),
                           /*IsInstantiation=*/true);
 
   CurContext = PreviousContext;
 
   DeclGroupRef DG(Function);
   Consumer.HandleTopLevelDecl(DG);
-  
+
   if (Recursive) {
     // Instantiate any pending implicit instantiations found during the
-    // instantiation of this template. 
+    // instantiation of this template.
     PerformPendingImplicitInstantiations();
-    
+
     // Restore the set of pending implicit instantiations.
     PendingImplicitInstantiations.swap(SavedPendingImplicitInstantiations);
   }
@@ -1067,14 +1067,14 @@
                                                  bool Recursive) {
   if (Var->isInvalidDecl())
     return;
-  
+
   // Find the out-of-line definition of this static data member.
   // FIXME: Do we have to look for specializations separately?
   VarDecl *Def = Var->getInstantiatedFromStaticDataMember();
   bool FoundOutOfLineDef = false;
   assert(Def && "This data member was not instantiated from a template?");
-  assert(Def->isStaticDataMember() && "Not a static data member?"); 
-  for (VarDecl::redecl_iterator RD = Def->redecls_begin(), 
+  assert(Def->isStaticDataMember() && "Not a static data member?");
+  for (VarDecl::redecl_iterator RD = Def->redecls_begin(),
                              RDEnd = Def->redecls_end();
        RD != RDEnd; ++RD) {
     if (RD->getLexicalDeclContext()->isFileContext()) {
@@ -1082,58 +1082,58 @@
       FoundOutOfLineDef = true;
     }
   }
-  
+
   if (!FoundOutOfLineDef) {
     // We did not find an out-of-line definition of this static data member,
     // so we won't perform any instantiation. Rather, we rely on the user to
-    // instantiate this definition (or provide a specialization for it) in 
-    // another translation unit. 
+    // instantiate this definition (or provide a specialization for it) in
+    // another translation unit.
     return;
   }
 
   // FIXME: extern templates
-  
+
   InstantiatingTemplate Inst(*this, PointOfInstantiation, Var);
   if (Inst)
     return;
-  
+
   // If we're performing recursive template instantiation, create our own
   // queue of pending implicit instantiations that we will instantiate later,
   // while we're still within our own instantiation context.
   std::deque<PendingImplicitInstantiation> SavedPendingImplicitInstantiations;
   if (Recursive)
     PendingImplicitInstantiations.swap(SavedPendingImplicitInstantiations);
-    
+
   // Enter the scope of this instantiation. We don't use
   // PushDeclContext because we don't have a scope.
   DeclContext *PreviousContext = CurContext;
   CurContext = Var->getDeclContext();
-  
+
   Var = cast_or_null<VarDecl>(SubstDecl(Def, Var->getDeclContext(),
                                           getTemplateInstantiationArgs(Var)));
-  
+
   CurContext = PreviousContext;
 
   if (Var) {
     DeclGroupRef DG(Var);
     Consumer.HandleTopLevelDecl(DG);
   }
-  
+
   if (Recursive) {
     // Instantiate any pending implicit instantiations found during the
-    // instantiation of this template. 
+    // instantiation of this template.
     PerformPendingImplicitInstantiations();
-    
+
     // Restore the set of pending implicit instantiations.
     PendingImplicitInstantiations.swap(SavedPendingImplicitInstantiations);
-  }  
+  }
 }
 
 void
 Sema::InstantiateMemInitializers(CXXConstructorDecl *New,
                                  const CXXConstructorDecl *Tmpl,
                            const MultiLevelTemplateArgumentList &TemplateArgs) {
-  
+
   llvm::SmallVector<MemInitTy*, 4> NewInits;
 
   // Instantiate all the initializers.
@@ -1143,7 +1143,7 @@
     CXXBaseOrMemberInitializer *Init = *Inits;
 
     ASTOwningVector<&ActionBase::DeleteExpr> NewArgs(*this);
-    
+
     // Instantiate all the arguments.
     for (ExprIterator Args = Init->arg_begin(), ArgsEnd = Init->arg_end();
          Args != ArgsEnd; ++Args) {
@@ -1163,21 +1163,21 @@
                            New->getDeclName());
 
       NewInit = BuildBaseInitializer(BaseType,
-                                     (Expr **)NewArgs.data(), 
+                                     (Expr **)NewArgs.data(),
                                      NewArgs.size(),
                                      Init->getSourceLocation(),
                                      Init->getRParenLoc(),
                                      New->getParent());
     } else if (Init->isMemberInitializer()) {
       FieldDecl *Member;
-      
+
       // Is this an anonymous union?
       if (FieldDecl *UnionInit = Init->getAnonUnionMember())
         Member = cast<FieldDecl>(FindInstantiatedDecl(UnionInit));
       else
         Member = cast<FieldDecl>(FindInstantiatedDecl(Init->getMember()));
-      
-      NewInit = BuildMemberInitializer(Member, (Expr **)NewArgs.data(), 
+
+      NewInit = BuildMemberInitializer(Member, (Expr **)NewArgs.data(),
                                        NewArgs.size(),
                                        Init->getSourceLocation(),
                                        Init->getRParenLoc());
@@ -1188,16 +1188,16 @@
     else {
       // FIXME: It would be nice if ASTOwningVector had a release function.
       NewArgs.take();
-      
+
       NewInits.push_back((MemInitTy *)NewInit.get());
     }
   }
-  
+
   // Assign all the initializers to the new constructor.
-  ActOnMemInitializers(DeclPtrTy::make(New), 
+  ActOnMemInitializers(DeclPtrTy::make(New),
                        /*FIXME: ColonLoc */
                        SourceLocation(),
-                       NewInits.data(), NewInits.size()); 
+                       NewInits.data(), NewInits.size());
 }
 
 // TODO: this could be templated if the various decl types used the
@@ -1285,10 +1285,10 @@
 
     return false;
   }
-  
+
   if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(Other))
     return isInstantiationOf(cast<CXXRecordDecl>(D), Record);
-  
+
   if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
     return isInstantiationOf(cast<FunctionDecl>(D), Function);
 
@@ -1305,17 +1305,17 @@
   if (FieldDecl *Field = dyn_cast<FieldDecl>(Other)) {
     if (!Field->getDeclName()) {
       // This is an unnamed field.
-      return Ctx.getInstantiatedFromUnnamedFieldDecl(Field) == 
+      return Ctx.getInstantiatedFromUnnamedFieldDecl(Field) ==
         cast<FieldDecl>(D);
     }
   }
-  
+
   return D->getDeclName() && isa<NamedDecl>(Other) &&
     D->getDeclName() == cast<NamedDecl>(Other)->getDeclName();
 }
 
 template<typename ForwardIterator>
-static NamedDecl *findInstantiationOf(ASTContext &Ctx, 
+static NamedDecl *findInstantiationOf(ASTContext &Ctx,
                                       NamedDecl *D,
                                       ForwardIterator first,
                                       ForwardIterator last) {
@@ -1366,19 +1366,19 @@
 NamedDecl *Sema::FindInstantiatedDecl(NamedDecl *D) {
   if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) {
     // Transform all of the elements of the overloaded function set.
-    OverloadedFunctionDecl *Result 
+    OverloadedFunctionDecl *Result
       = OverloadedFunctionDecl::Create(Context, CurContext, Ovl->getDeclName());
-    
+
     for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(),
                                                 FEnd = Ovl->function_end();
          F != FEnd; ++F) {
       Result->addOverload(
                   AnyFunctionDecl::getFromNamedDecl(FindInstantiatedDecl(*F)));
     }
-    
+
     return Result;
-  }  
-  
+  }
+
   DeclContext *ParentDC = D->getDeclContext();
   if (isa<ParmVarDecl>(D) || ParentDC->isFunctionOrMethod()) {
     // D is a local of some kind. Look into the map of local
@@ -1387,7 +1387,7 @@
   }
 
   if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(D))
-    if (ClassTemplateDecl *ClassTemplate 
+    if (ClassTemplateDecl *ClassTemplate
           = Record->getDescribedClassTemplate()) {
       // When the declaration D was parsed, it referred to the current
       // instantiation. Therefore, look through the current context,
@@ -1396,22 +1396,22 @@
       // to. Alternatively, we could just instantiate the
       // injected-class-name with the current template arguments, but
       // such an instantiation is far more expensive.
-      for (DeclContext *DC = CurContext; !DC->isFileContext(); 
+      for (DeclContext *DC = CurContext; !DC->isFileContext();
            DC = DC->getParent()) {
-        if (ClassTemplateSpecializationDecl *Spec 
+        if (ClassTemplateSpecializationDecl *Spec
               = dyn_cast<ClassTemplateSpecializationDecl>(DC))
           if (isInstantiationOf(ClassTemplate, Spec->getSpecializedTemplate()))
             return Spec;
       }
 
-      assert(false && 
+      assert(false &&
              "Unable to find declaration for the current instantiation");
     }
 
   ParentDC = FindInstantiatedContext(ParentDC);
-  if (!ParentDC) 
+  if (!ParentDC)
     return 0;
-  
+
   if (ParentDC != D->getDeclContext()) {
     // We performed some kind of instantiation in the parent context,
     // so now we need to look into the instantiated parent context to
@@ -1429,11 +1429,11 @@
       //   - unnamed class/struct/union/enum within a template
       //
       // FIXME: Find a better way to find these instantiations!
-      Result = findInstantiationOf(Context, D, 
+      Result = findInstantiationOf(Context, D,
                                    ParentDC->decls_begin(),
                                    ParentDC->decls_end());
     }
-    
+
     assert(Result && "Unable to find instantiation of declaration!");
     D = Result;
   }
@@ -1441,35 +1441,35 @@
   return D;
 }
 
-/// \brief Performs template instantiation for all implicit template 
+/// \brief Performs template instantiation for all implicit template
 /// instantiations we have seen until this point.
 void Sema::PerformPendingImplicitInstantiations() {
   while (!PendingImplicitInstantiations.empty()) {
     PendingImplicitInstantiation Inst = PendingImplicitInstantiations.front();
     PendingImplicitInstantiations.pop_front();
-    
+
     // Instantiate function definitions
     if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
-      PrettyStackTraceActionsDecl CrashInfo(DeclPtrTy::make(Function), 
+      PrettyStackTraceActionsDecl CrashInfo(DeclPtrTy::make(Function),
                                             Function->getLocation(), *this,
                                             Context.getSourceManager(),
                                            "instantiating function definition");
-      
+
       if (!Function->getBody())
         InstantiateFunctionDefinition(/*FIXME:*/Inst.second, Function, true);
       continue;
     }
-    
+
     // Instantiate static data member definitions.
     VarDecl *Var = cast<VarDecl>(Inst.first);
     assert(Var->isStaticDataMember() && "Not a static data member?");
 
-    PrettyStackTraceActionsDecl CrashInfo(DeclPtrTy::make(Var), 
+    PrettyStackTraceActionsDecl CrashInfo(DeclPtrTy::make(Var),
                                           Var->getLocation(), *this,
                                           Context.getSourceManager(),
                                           "instantiating static data member "
                                           "definition");
-    
+
     InstantiateStaticDataMemberDefinition(/*FIXME:*/Inst.second, Var, true);
   }
 }

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Sep  9 10:08:12 2009
@@ -26,8 +26,8 @@
 /// \brief Perform adjustment on the parameter type of a function.
 ///
 /// This routine adjusts the given parameter type @p T to the actual
-/// parameter type used by semantic analysis (C99 6.7.5.3p[7,8], 
-/// C++ [dcl.fct]p3). The adjusted parameter type is returned. 
+/// parameter type used by semantic analysis (C99 6.7.5.3p[7,8],
+/// C++ [dcl.fct]p3). The adjusted parameter type is returned.
 QualType Sema::adjustParameterType(QualType T) {
   // C99 6.7.5.3p7:
   if (T->isArrayType()) {
@@ -59,7 +59,7 @@
   // FIXME: Should move the logic from DeclSpec::Finish to here for validity
   // checking.
   QualType Result;
-  
+
   switch (DS.getTypeSpecType()) {
   case DeclSpec::TST_void:
     Result = Context.VoidTy;
@@ -103,12 +103,12 @@
   case DeclSpec::TST_unspecified:
     // "<proto1,proto2>" is an objc qualified ID with a missing id.
     if (DeclSpec::ProtocolQualifierListTy PQ = DS.getProtocolQualifiers()) {
-      Result = Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy, 
+      Result = Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy,
                                                 (ObjCProtocolDecl**)PQ,
                                                 DS.getNumProtocolQualifiers());
       break;
     }
-      
+
     // Unspecified typespec defaults to int in C90.  However, the C90 grammar
     // [C90 6.5] only allows a decl-spec if there was *some* type-specifier,
     // type-qualifier, or storage-class-specifier.  If not, emit an extwarn.
@@ -139,7 +139,7 @@
       if (getLangOptions().CPlusPlus && !getLangOptions().Microsoft) {
         Diag(DeclLoc, diag::err_missing_type_specifier)
           << DS.getSourceRange();
-        
+
         // When this occurs in C++ code, often something is very broken with the
         // value being declared, poison it as invalid so we don't get chains of
         // errors.
@@ -149,8 +149,8 @@
           << DS.getSourceRange();
       }
     }
-      
-    // FALL THROUGH.  
+
+    // FALL THROUGH.
   case DeclSpec::TST_int: {
     if (DS.getTypeSpecSign() != DeclSpec::TSS_unsigned) {
       switch (DS.getTypeSpecWidth()) {
@@ -202,11 +202,11 @@
         = TagDecl::getTagKindForTypeSpec(DS.getTypeSpecType());
       Result = Context.getElaboratedType(Result, Tag);
     }
-    
+
     if (D->isInvalidDecl())
       isInvalid = true;
     break;
-  }    
+  }
   case DeclSpec::TST_typename: {
     assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 &&
            DS.getTypeSpecSign() == 0 &&
@@ -218,7 +218,7 @@
         // It would be nice if protocol qualifiers were only stored with the
         // ObjCObjectPointerType. Unfortunately, this isn't possible due
         // to the following typedef idiom (which is uncommon, but allowed):
-        // 
+        //
         // typedef Foo<P> T;
         // static void func() {
         //   Foo<P> *yy;
@@ -229,13 +229,13 @@
                                               DS.getNumProtocolQualifiers());
       else if (Result->isObjCIdType())
         // id<protocol-list>
-        Result = Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy, 
+        Result = Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy,
                         (ObjCProtocolDecl**)PQ, DS.getNumProtocolQualifiers());
       else if (Result->isObjCClassType()) {
         if (DeclLoc.isInvalid())
           DeclLoc = DS.getSourceRange().getBegin();
         // Class<protocol-list>
-        Result = Context.getObjCObjectPointerType(Context.ObjCBuiltinClassTy, 
+        Result = Context.getObjCObjectPointerType(Context.ObjCBuiltinClassTy,
                         (ObjCProtocolDecl**)PQ, DS.getNumProtocolQualifiers());
       } else {
         if (DeclLoc.isInvalid())
@@ -245,12 +245,12 @@
         isInvalid = true;
       }
     }
-    
+
     // If this is a reference to an invalid typedef, propagate the invalidity.
     if (TypedefType *TDT = dyn_cast<TypedefType>(Result))
       if (TDT->getDecl()->isInvalidDecl())
         isInvalid = true;
-    
+
     // TypeQuals handled by caller.
     break;
   }
@@ -284,28 +284,28 @@
     Result = Context.UndeducedAutoTy;
     break;
   }
-    
+
   case DeclSpec::TST_error:
     Result = Context.IntTy;
     isInvalid = true;
     break;
   }
-  
+
   // Handle complex types.
   if (DS.getTypeSpecComplex() == DeclSpec::TSC_complex) {
     if (getLangOptions().Freestanding)
       Diag(DS.getTypeSpecComplexLoc(), diag::ext_freestanding_complex);
     Result = Context.getComplexType(Result);
   }
-  
+
   assert(DS.getTypeSpecComplex() != DeclSpec::TSC_imaginary &&
          "FIXME: imaginary types not supported yet!");
-  
+
   // See if there are any attributes on the declspec that apply to the type (as
   // opposed to the decl).
   if (const AttributeList *AL = DS.getAttributes())
     ProcessTypeAttributeList(Result, AL);
-    
+
   // Apply const/volatile/restrict qualifiers to T.
   if (unsigned TypeQuals = DS.getTypeQualifiers()) {
 
@@ -314,10 +314,10 @@
     // restrict-qualified references.
     if (TypeQuals & QualType::Restrict) {
       if (Result->isPointerType() || Result->isReferenceType()) {
-        QualType EltTy = Result->isPointerType() ? 
+        QualType EltTy = Result->isPointerType() ?
           Result->getAs<PointerType>()->getPointeeType() :
           Result->getAs<ReferenceType>()->getPointeeType();
-      
+
         // If we have a pointer or reference, the pointee must have an object
         // incomplete type.
         if (!EltTy->isIncompleteOrObjectType()) {
@@ -333,7 +333,7 @@
         TypeQuals &= ~QualType::Restrict; // Remove the restrict qualifier.
       }
     }
-    
+
     // Warn about CV qualifiers on functions: C99 6.7.3p8: "If the specification
     // of a function type includes any type qualifiers, the behavior is
     // undefined."
@@ -350,7 +350,7 @@
       Diag(Loc, diag::warn_typecheck_function_qualifiers)
         << Result << DS.getSourceRange();
     }
-    
+
     // C++ [dcl.ref]p1:
     //   Cv-qualified references are ill-formed except when the
     //   cv-qualifiers are introduced through the use of a typedef
@@ -361,8 +361,8 @@
         TypeQuals && Result->isReferenceType()) {
       TypeQuals &= ~QualType::Const;
       TypeQuals &= ~QualType::Volatile;
-    }      
-    
+    }
+
     Result = Result.getQualifiedType(TypeQuals);
   }
   return Result;
@@ -371,7 +371,7 @@
 static std::string getPrintableNameForEntity(DeclarationName Entity) {
   if (Entity)
     return Entity.getAsString();
-  
+
   return "type name";
 }
 
@@ -390,7 +390,7 @@
 ///
 /// \returns A suitable pointer type, if there are no
 /// errors. Otherwise, returns a NULL type.
-QualType Sema::BuildPointerType(QualType T, unsigned Quals, 
+QualType Sema::BuildPointerType(QualType T, unsigned Quals,
                                 SourceLocation Loc, DeclarationName Entity) {
   if (T->isReferenceType()) {
     // C++ 8.3.2p4: There shall be no ... pointers to references ...
@@ -441,7 +441,7 @@
   }
   if (T->isReferenceType()) {
     // C++ [dcl.ref]p4: There shall be no references to references.
-    // 
+    //
     // According to C++ DR 106, references to references are only
     // diagnosed when they are written directly (e.g., "int & &"),
     // but not when they happen via a typedef:
@@ -495,8 +495,8 @@
 /// \param T The type of each element in the array.
 ///
 /// \param ASM C99 array size modifier (e.g., '*', 'static').
-///  
-/// \param ArraySize Expression describing the size of the array. 
+///
+/// \param ArraySize Expression describing the size of the array.
 ///
 /// \param Quals The cvr-qualifiers to be applied to the array's
 /// element type.
@@ -514,9 +514,9 @@
                               Expr *ArraySize, unsigned Quals,
                               SourceRange Brackets, DeclarationName Entity) {
   SourceLocation Loc = Brackets.getBegin();
-  // C99 6.7.5.2p1: If the element type is an incomplete or function type, 
+  // C99 6.7.5.2p1: If the element type is an incomplete or function type,
   // reject it (e.g. void ary[7], struct foo ary[7], void ary[7]())
-  if (RequireCompleteType(Loc, T, 
+  if (RequireCompleteType(Loc, T,
                              diag::err_illegal_decl_array_incomplete_type))
     return QualType();
 
@@ -525,20 +525,20 @@
       << getPrintableNameForEntity(Entity);
     return QualType();
   }
-    
+
   // C++ 8.3.2p4: There shall be no ... arrays of references ...
   if (T->isReferenceType()) {
     Diag(Loc, diag::err_illegal_decl_array_of_references)
       << getPrintableNameForEntity(Entity);
     return QualType();
-  } 
+  }
 
   if (Context.getCanonicalType(T) == Context.UndeducedAutoTy) {
-    Diag(Loc,  diag::err_illegal_decl_array_of_auto) 
+    Diag(Loc,  diag::err_illegal_decl_array_of_auto)
       << getPrintableNameForEntity(Entity);
     return QualType();
   }
-  
+
   if (const RecordType *EltTy = T->getAs<RecordType>()) {
     // If the element type is a struct or union that contains a variadic
     // array, accept it as a GNU extension: C99 6.7.2.1p2.
@@ -548,7 +548,7 @@
     Diag(Loc, diag::err_objc_array_of_interfaces) << T;
     return QualType();
   }
-      
+
   // C99 6.7.5.2p1: The size expression shall have integer type.
   if (ArraySize && !ArraySize->isTypeDependent() &&
       !ArraySize->getType()->isIntegerType()) {
@@ -584,14 +584,14 @@
         Diag(ArraySize->getLocStart(), diag::ext_typecheck_zero_array_size)
           << ArraySize->getSourceRange();
       }
-    } 
+    }
     T = Context.getConstantArrayWithExprType(T, ConstVal, ArraySize,
                                              ASM, Quals, Brackets);
   }
   // If this is not C99, extwarn about VLA's and C99 array size modifiers.
   if (!getLangOptions().C99) {
-    if (ArraySize && !ArraySize->isTypeDependent() && 
-        !ArraySize->isValueDependent() && 
+    if (ArraySize && !ArraySize->isTypeDependent() &&
+        !ArraySize->isValueDependent() &&
         !ArraySize->isIntegerConstantExpr(Context))
       Diag(Loc, diag::ext_vla);
     else if (ASM != ArrayType::Normal || Quals != 0)
@@ -604,14 +604,14 @@
 /// \brief Build an ext-vector type.
 ///
 /// Run the required checks for the extended vector type.
-QualType Sema::BuildExtVectorType(QualType T, ExprArg ArraySize, 
+QualType Sema::BuildExtVectorType(QualType T, ExprArg ArraySize,
                                   SourceLocation AttrLoc) {
 
   Expr *Arg = (Expr *)ArraySize.get();
 
   // unlike gcc's vector_size attribute, we do not allow vectors to be defined
   // in conjunction with complex types (pointers, arrays, functions, etc.).
-  if (!T->isDependentType() && 
+  if (!T->isDependentType() &&
       !T->isIntegerType() && !T->isRealFloatingType()) {
     Diag(AttrLoc, diag::err_attribute_invalid_vector_type) << T;
     return QualType();
@@ -624,25 +624,25 @@
       << "ext_vector_type" << Arg->getSourceRange();
       return QualType();
     }
-    
-    // unlike gcc's vector_size attribute, the size is specified as the 
+
+    // unlike gcc's vector_size attribute, the size is specified as the
     // number of elements, not the number of bytes.
-    unsigned vectorSize = static_cast<unsigned>(vecSize.getZExtValue()); 
-    
+    unsigned vectorSize = static_cast<unsigned>(vecSize.getZExtValue());
+
     if (vectorSize == 0) {
       Diag(AttrLoc, diag::err_attribute_zero_size)
       << Arg->getSourceRange();
       return QualType();
     }
-    
+
     if (!T->isDependentType())
       return Context.getExtVectorType(T, vectorSize);
-  } 
-  
-  return Context.getDependentSizedExtVectorType(T, ArraySize.takeAs<Expr>(), 
+  }
+
+  return Context.getDependentSizedExtVectorType(T, ArraySize.takeAs<Expr>(),
                                                 AttrLoc);
 }
-                              
+
 /// \brief Build a function type.
 ///
 /// This routine checks the function type according to C++ rules and
@@ -673,7 +673,7 @@
 /// \returns A suitable function type, if there are no
 /// errors. Otherwise, returns a NULL type.
 QualType Sema::BuildFunctionType(QualType T,
-                                 QualType *ParamTypes, 
+                                 QualType *ParamTypes,
                                  unsigned NumParamTypes,
                                  bool Variadic, unsigned Quals,
                                  SourceLocation Loc, DeclarationName Entity) {
@@ -681,7 +681,7 @@
     Diag(Loc, diag::err_func_returning_array_function) << T;
     return QualType();
   }
-  
+
   bool Invalid = false;
   for (unsigned Idx = 0; Idx < NumParamTypes; ++Idx) {
     QualType ParamType = adjustParameterType(ParamTypes[Idx]);
@@ -696,10 +696,10 @@
   if (Invalid)
     return QualType();
 
-  return Context.getFunctionType(T, ParamTypes, NumParamTypes, Variadic, 
+  return Context.getFunctionType(T, ParamTypes, NumParamTypes, Variadic,
                                  Quals);
 }
- 
+
 /// \brief Build a member pointer type \c T Class::*.
 ///
 /// \param T the type to which the member pointer refers.
@@ -710,8 +710,8 @@
 ///
 /// \returns a member pointer type, if successful, or a NULL type if there was
 /// an error.
-QualType Sema::BuildMemberPointerType(QualType T, QualType Class, 
-                                      unsigned Quals, SourceLocation Loc, 
+QualType Sema::BuildMemberPointerType(QualType T, QualType Class,
+                                      unsigned Quals, SourceLocation Loc,
                                       DeclarationName Entity) {
   // Verify that we're not building a pointer to pointer to function with
   // exception specification.
@@ -757,9 +757,9 @@
   }
 
   return Context.getMemberPointerType(T, Class.getTypePtr())
-           .getQualifiedType(Quals);  
+           .getQualifiedType(Quals);
 }
- 
+
 /// \brief Build a block pointer type.
 ///
 /// \param T The type to which we'll be building a block pointer.
@@ -776,13 +776,13 @@
 /// \returns A suitable block pointer type, if there are no
 /// errors. Otherwise, returns a NULL type.
 QualType Sema::BuildBlockPointerType(QualType T, unsigned Quals,
-                                     SourceLocation Loc, 
+                                     SourceLocation Loc,
                                      DeclarationName Entity) {
   if (!T.getTypePtr()->isFunctionType()) {
     Diag(Loc, diag::err_nonfunction_block_type);
     return QualType();
   }
-  
+
   return Context.getBlockPointerType(T).getQualifiedType(Quals);
 }
 
@@ -793,7 +793,7 @@
     QT = LIT->getType();
     DI = LIT->getDeclaratorInfo();
   }
-  
+
   if (DInfo) *DInfo = DI;
   return QT;
 }
@@ -858,7 +858,7 @@
 
   if (T == Context.UndeducedAutoTy) {
     int Error = -1;
-    
+
     switch (D.getContext()) {
     case Declarator::KNRTypeListContext:
       assert(0 && "K&R type lists aren't allowed in C++");
@@ -872,7 +872,7 @@
       case TagDecl::TK_struct: Error = 1; /* Struct member */ break;
       case TagDecl::TK_union:  Error = 2; /* Union member */ break;
       case TagDecl::TK_class:  Error = 3; /* Class member */ break;
-      }  
+      }
       break;
     case Declarator::CXXCatchContext:
       Error = 4; // Exception declaration
@@ -898,12 +898,12 @@
       D.setInvalidType(true);
     }
   }
-  
+
   // The name we're declaring, if any.
   DeclarationName Name;
   if (D.getIdentifier())
     Name = D.getIdentifier();
-  
+
   bool ShouldBuildInfo = DInfo != 0;
   // The QualType referring to the type as written in source code. We can't use
   // T because it can change due to semantic analysis.
@@ -930,8 +930,8 @@
       // If blocks are disabled, emit an error.
       if (!LangOpts.Blocks)
         Diag(DeclType.Loc, diag::err_blocks_disable);
-        
-      T = BuildBlockPointerType(T, DeclType.Cls.TypeQuals, D.getIdentifierLoc(), 
+
+      T = BuildBlockPointerType(T, DeclType.Cls.TypeQuals, D.getIdentifierLoc(),
                                 Name);
       break;
     case DeclaratorChunk::Pointer:
@@ -961,7 +961,7 @@
           SourceTy = Context.getLValueReferenceType(SourceTy);
         else
           SourceTy = Context.getRValueReferenceType(SourceTy);
-        unsigned Quals = DeclType.Ref.HasRestrict ? QualType::Restrict : 0; 
+        unsigned Quals = DeclType.Ref.HasRestrict ? QualType::Restrict : 0;
         SourceTy = SourceTy.getQualifiedType(Quals);
       }
 
@@ -1015,7 +1015,7 @@
       if (ShouldBuildInfo) {
         const DeclaratorChunk::FunctionTypeInfo &FTI = DeclType.Fun;
         llvm::SmallVector<QualType, 16> ArgTys;
-        
+
         for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
           ParmVarDecl *Param = FTI.ArgInfo[i].Param.getAs<ParmVarDecl>();
           if (Param)
@@ -1059,7 +1059,7 @@
           // function takes no arguments.
           llvm::SmallVector<QualType, 4> Exceptions;
           Exceptions.reserve(FTI.NumExceptions);
-          for(unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) {
+          for (unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) {
             // FIXME: Preserve type source info.
             QualType ET = GetTypeFromParser(FTI.Exceptions[ei].Ty);
             // Check that the type is valid for an exception spec, and drop it
@@ -1093,12 +1093,12 @@
         }
       } else if (FTI.ArgInfo[0].Param == 0) {
         // C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function definition.
-        Diag(FTI.ArgInfo[0].IdentLoc, diag::err_ident_list_in_fn_declaration);        
+        Diag(FTI.ArgInfo[0].IdentLoc, diag::err_ident_list_in_fn_declaration);
       } else {
         // Otherwise, we have a function with an argument list that is
         // potentially variadic.
         llvm::SmallVector<QualType, 16> ArgTys;
-        
+
         for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
           ParmVarDecl *Param =
             cast<ParmVarDecl>(FTI.ArgInfo[i].Param.getAs<Decl>());
@@ -1129,7 +1129,7 @@
               // Reject, but continue to parse 'float(const void)'.
               if (ArgTy.getCVRQualifiers())
                 Diag(DeclType.Loc, diag::err_void_param_qualified);
-              
+
               // Do not add 'void' to the ArgTys list.
               break;
             }
@@ -1141,13 +1141,13 @@
                 ArgTy = Context.DoubleTy;
             }
           }
-          
+
           ArgTys.push_back(ArgTy);
         }
 
         llvm::SmallVector<QualType, 4> Exceptions;
         Exceptions.reserve(FTI.NumExceptions);
-        for(unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) {
+        for (unsigned ei = 0, ee = FTI.NumExceptions; ei != ee; ++ei) {
           // FIXME: Preserve type source info.
           QualType ET = GetTypeFromParser(FTI.Exceptions[ei].Ty);
           // Check that the type is valid for an exception spec, and drop it if
@@ -1175,11 +1175,11 @@
       // The scope spec must refer to a class, or be dependent.
       QualType ClsType;
       if (isDependentScopeSpecifier(DeclType.Mem.Scope())) {
-        NestedNameSpecifier *NNS 
+        NestedNameSpecifier *NNS
           = (NestedNameSpecifier *)DeclType.Mem.Scope().getScopeRep();
         assert(NNS->getAsType() && "Nested-name-specifier must name a type");
         ClsType = QualType(NNS->getAsType(), 0);
-      } else if (CXXRecordDecl *RD 
+      } else if (CXXRecordDecl *RD
                    = dyn_cast_or_null<CXXRecordDecl>(
                                     computeDeclContext(DeclType.Mem.Scope()))) {
         ClsType = Context.getTagDeclType(RD);
@@ -1243,7 +1243,7 @@
                                   FnTy->getNumArgs(), FnTy->isVariadic(), 0);
     }
   }
-  
+
   // If there were any type attributes applied to the decl itself (not the
   // type, apply the type attribute to the type!)
   if (const AttributeList *Attrs = D.getAttributes())
@@ -1315,12 +1315,12 @@
       //FIXME: Class location.
       break;
     }
-      
+
     }
 
     CurrTL = CurrTL.getNextTypeLoc();
   }
-  
+
   if (TypedefLoc *TL = dyn_cast<TypedefLoc>(&CurrTL)) {
     TL->setNameLoc(D.getDeclSpec().getTypeSpecTypeLoc());
   } else {
@@ -1446,8 +1446,7 @@
 /// type. This is used by override and pointer assignment checks.
 bool Sema::CheckExceptionSpecSubset(unsigned DiagID, unsigned NoteID,
     const FunctionProtoType *Superset, SourceLocation SuperLoc,
-    const FunctionProtoType *Subset, SourceLocation SubLoc)
-{
+    const FunctionProtoType *Subset, SourceLocation SubLoc) {
   // FIXME: As usual, we could be more specific in our error messages, but
   // that better waits until we've got types with source locations.
 
@@ -1537,7 +1536,7 @@
   ObjCMethodDecl *MDecl = cast<ObjCMethodDecl>(D.getAs<Decl>());
   QualType T = MDecl->getResultType();
   llvm::SmallVector<QualType, 16> ArgTys;
-  
+
   // Add the first two invisible argument types for self and _cmd.
   if (MDecl->isInstanceMethod()) {
     QualType selfTy = Context.getObjCInterfaceType(MDecl->getClassInterface());
@@ -1546,7 +1545,7 @@
   } else
     ArgTys.push_back(Context.getObjCIdType());
   ArgTys.push_back(Context.getObjCSelType());
-      
+
   for (ObjCMethodDecl::param_iterator PI = MDecl->param_begin(),
        E = MDecl->param_end(); PI != E; ++PI) {
     QualType ArgTy = (*PI)->getType();
@@ -1592,7 +1591,7 @@
   // C99 6.7.6: Type names have no identifier.  This is already validated by
   // the parser.
   assert(D.getIdentifier() == 0 && "Type name should have no identifier!");
-  
+
   DeclaratorInfo *DInfo = 0;
   TagDecl *OwnedTag = 0;
   QualType T = GetTypeForDeclarator(D, S, &DInfo, /*Skip=*/0, &OwnedTag);
@@ -1627,7 +1626,7 @@
 /// HandleAddressSpaceTypeAttribute - Process an address_space attribute on the
 /// specified type.  The attribute contains 1 argument, the id of the address
 /// space for the type.
-static void HandleAddressSpaceTypeAttribute(QualType &Type, 
+static void HandleAddressSpaceTypeAttribute(QualType &Type,
                                             const AttributeList &Attr, Sema &S){
   // If this type is already address space qualified, reject it.
   // Clause 6.7.3 - Type qualifiers: "No type shall be qualified by qualifiers
@@ -1636,7 +1635,7 @@
     S.Diag(Attr.getLoc(), diag::err_attribute_address_multiple_qualifiers);
     return;
   }
-  
+
   // Check the attribute arguments.
   if (Attr.getNumArgs() != 1) {
     S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
@@ -1667,21 +1666,21 @@
     return;
   }
 
-  unsigned ASIdx = static_cast<unsigned>(addrSpace.getZExtValue()); 
+  unsigned ASIdx = static_cast<unsigned>(addrSpace.getZExtValue());
   Type = S.Context.getAddrSpaceQualType(Type, ASIdx);
 }
 
 /// HandleObjCGCTypeAttribute - Process an objc's gc attribute on the
 /// specified type.  The attribute contains 1 argument, weak or strong.
-static void HandleObjCGCTypeAttribute(QualType &Type, 
+static void HandleObjCGCTypeAttribute(QualType &Type,
                                       const AttributeList &Attr, Sema &S) {
   if (Type.getObjCGCAttr() != QualType::GCNone) {
     S.Diag(Attr.getLoc(), diag::err_attribute_multiple_objc_gc);
     return;
   }
-  
+
   // Check the attribute arguments.
-  if (!Attr.getParameterName()) {    
+  if (!Attr.getParameterName()) {
     S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string)
       << "objc_gc" << 1;
     return;
@@ -1691,7 +1690,7 @@
     S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
     return;
   }
-  if (Attr.getParameterName()->isStr("weak")) 
+  if (Attr.getParameterName()->isStr("weak"))
     GCAttr = QualType::Weak;
   else if (Attr.getParameterName()->isStr("strong"))
     GCAttr = QualType::Strong;
@@ -1700,13 +1699,13 @@
       << "objc_gc" << Attr.getParameterName();
     return;
   }
-  
+
   Type = S.Context.getObjCGCQualType(Type, GCAttr);
 }
 
 /// HandleNoReturnTypeAttribute - Process the noreturn attribute on the
 /// specified type.  The attribute contains 0 arguments.
-static void HandleNoReturnTypeAttribute(QualType &Type, 
+static void HandleNoReturnTypeAttribute(QualType &Type,
                                         const AttributeList &Attr, Sema &S) {
   if (Attr.getNumArgs() != 0)
     return;
@@ -1743,7 +1742,7 @@
   }
 }
 
-/// @brief Ensure that the type T is a complete type. 
+/// @brief Ensure that the type T is a complete type.
 ///
 /// This routine checks whether the type @p T is complete in any
 /// context where a complete type is required. If @p T is a complete
@@ -1758,7 +1757,7 @@
 ///
 /// @param T  The type that this routine is examining for completeness.
 ///
-/// @param PD The partial diagnostic that will be printed out if T is not a 
+/// @param PD The partial diagnostic that will be printed out if T is not a
 /// complete type.
 ///
 /// @returns @c true if @p T is incomplete and a diagnostic was emitted,
@@ -1766,11 +1765,11 @@
 bool Sema::RequireCompleteType(SourceLocation Loc, QualType T,
                                const PartialDiagnostic &PD) {
   unsigned diag = PD.getDiagID();
-  
+
   // FIXME: Add this assertion to help us flush out problems with
   // checking for dependent types and type-dependent expressions.
   //
-  //  assert(!T->isDependentType() && 
+  //  assert(!T->isDependentType() &&
   //         "Can't ask whether a dependent type is complete");
 
   // If we have a complete type, we're done.
@@ -1791,11 +1790,11 @@
                                                       TSK_ImplicitInstantiation,
                                                       /*Complain=*/diag != 0);
       }
-    } else if (CXXRecordDecl *Rec 
+    } else if (CXXRecordDecl *Rec
                  = dyn_cast<CXXRecordDecl>(Record->getDecl())) {
       if (CXXRecordDecl *Pattern = Rec->getInstantiatedFromMemberClass()) {
         // This record was instantiated from a class within a template.
-        return InstantiateClass(Loc, Rec, Pattern, 
+        return InstantiateClass(Loc, Rec, Pattern,
                                 getTemplateInstantiationArgs(Rec),
                                 TSK_ImplicitInstantiation,
                                 /*Complain=*/diag != 0);
@@ -1805,12 +1804,12 @@
 
   if (diag == 0)
     return true;
-  
+
   // We have an incomplete type. Produce a diagnostic.
   Diag(Loc, PD) << T;
 
   // If the type was a forward declaration of a class/struct/union
-  // type, produce 
+  // type, produce
   const TagType *Tag = 0;
   if (const RecordType *Record = T->getAs<RecordType>())
     Tag = Record;
@@ -1818,7 +1817,7 @@
     Tag = Enum;
 
   if (Tag && !Tag->getDecl()->isInvalidDecl())
-    Diag(Tag->getDecl()->getLocation(), 
+    Diag(Tag->getDecl()->getLocation(),
          Tag->isBeingDefined() ? diag::note_type_being_defined
                                : diag::note_forward_declaration)
         << QualType(Tag, 0);
@@ -1831,7 +1830,7 @@
 QualType Sema::getQualifiedNameType(const CXXScopeSpec &SS, QualType T) {
   if (!SS.isSet() || SS.isInvalid() || T.isNull())
     return T;
-  
+
   NestedNameSpecifier *NNS
     = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
   return Context.getQualifiedNameType(NNS, T);
@@ -1843,7 +1842,7 @@
 
 QualType Sema::BuildDecltypeType(Expr *E) {
   if (E->getType() == Context.OverloadTy) {
-    Diag(E->getLocStart(), 
+    Diag(E->getLocStart(),
          diag::err_cannot_determine_declared_type_of_overloaded_function);
     return QualType();
   }

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Wed Sep  9 10:08:12 2009
@@ -28,13 +28,13 @@
 #include <algorithm>
 
 namespace clang {
-  
+
 /// \brief A semantic tree transformation that allows one to transform one
 /// abstract syntax tree into another.
 ///
-/// A new tree transformation is defined by creating a new subclass \c X of 
-/// \c TreeTransform<X> and then overriding certain operations to provide 
-/// behavior specific to that transformation. For example, template 
+/// A new tree transformation is defined by creating a new subclass \c X of
+/// \c TreeTransform<X> and then overriding certain operations to provide
+/// behavior specific to that transformation. For example, template
 /// instantiation is implemented as a tree transformation where the
 /// transformation of TemplateTypeParmType nodes involves substituting the
 /// template arguments for their corresponding template parameters; a similar
@@ -42,7 +42,7 @@
 /// template template parameters.
 ///
 /// This tree-transformation template uses static polymorphism to allow
-/// subclasses to customize any of its operations. Thus, a subclass can 
+/// subclasses to customize any of its operations. Thus, a subclass can
 /// override any of the transformation or rebuild operators by providing an
 /// operation with the same signature as the default implementation. The
 /// overridding function should not be virtual.
@@ -57,7 +57,7 @@
 /// were changed by the transformation, invokes the rebuild operation to create
 /// a new AST node.
 ///
-/// Subclasses can customize the transformation at various levels. The 
+/// Subclasses can customize the transformation at various levels. The
 /// most coarse-grained transformations involve replacing TransformType(),
 /// TransformExpr(), TransformDecl(), TransformNestedNameSpecifier(),
 /// TransformTemplateName(), or TransformTemplateArgument() with entirely
@@ -67,7 +67,7 @@
 /// \c TransformXXX functions (where XXX is the name of an AST node, e.g.,
 /// PointerType, StmtExpr) to alter the transformation. As mentioned previously,
 /// replacing TransformTemplateTypeParmType() allows template instantiation
-/// to substitute template arguments for their corresponding template 
+/// to substitute template arguments for their corresponding template
 /// parameters. Additionally, subclasses can override the \c RebuildXXX
 /// functions to control how AST nodes are rebuilt when their operands change.
 /// By default, \c TreeTransform will invoke semantic analysis to rebuild
@@ -75,7 +75,7 @@
 /// be able to use more efficient rebuild steps.
 ///
 /// There are a handful of other functions that can be overridden, allowing one
-/// to avoid traversing nodes that don't need any transformation 
+/// to avoid traversing nodes that don't need any transformation
 /// (\c AlreadyTransformed()), force rebuilding AST nodes even when their
 /// operands have not changed (\c AlwaysRebuild()), and customize the
 /// default locations and entity names used for type-checking
@@ -84,45 +84,45 @@
 class TreeTransform {
 protected:
   Sema &SemaRef;
-  
-public:  
+
+public:
   typedef Sema::OwningStmtResult OwningStmtResult;
   typedef Sema::OwningExprResult OwningExprResult;
   typedef Sema::StmtArg StmtArg;
   typedef Sema::ExprArg ExprArg;
   typedef Sema::MultiExprArg MultiExprArg;
   typedef Sema::MultiStmtArg MultiStmtArg;
-  
+
   /// \brief Initializes a new tree transformer.
   TreeTransform(Sema &SemaRef) : SemaRef(SemaRef) { }
-          
+
   /// \brief Retrieves a reference to the derived class.
   Derived &getDerived() { return static_cast<Derived&>(*this); }
 
   /// \brief Retrieves a reference to the derived class.
-  const Derived &getDerived() const { 
-    return static_cast<const Derived&>(*this); 
+  const Derived &getDerived() const {
+    return static_cast<const Derived&>(*this);
   }
 
   /// \brief Retrieves a reference to the semantic analysis object used for
   /// this tree transform.
   Sema &getSema() const { return SemaRef; }
-  
+
   /// \brief Whether the transformation should always rebuild AST nodes, even
   /// if none of the children have changed.
   ///
   /// Subclasses may override this function to specify when the transformation
   /// should rebuild all AST nodes.
   bool AlwaysRebuild() { return false; }
-  
+
   /// \brief Returns the location of the entity being transformed, if that
   /// information was not available elsewhere in the AST.
   ///
-  /// By default, returns no source-location information. Subclasses can 
+  /// By default, returns no source-location information. Subclasses can
   /// provide an alternative implementation that provides better location
   /// information.
   SourceLocation getBaseLocation() { return SourceLocation(); }
-  
+
   /// \brief Returns the name of the entity being transformed, if that
   /// information was not available elsewhere in the AST.
   ///
@@ -136,33 +136,32 @@
   /// By default, the source location and entity are ignored. Subclasses can
   /// override this function to provide a customized implementation.
   void setBase(SourceLocation Loc, DeclarationName Entity) { }
-  
+
   /// \brief RAII object that temporarily sets the base location and entity
   /// used for reporting diagnostics in types.
   class TemporaryBase {
     TreeTransform &Self;
     SourceLocation OldLocation;
     DeclarationName OldEntity;
-    
+
   public:
     TemporaryBase(TreeTransform &Self, SourceLocation Location,
-                  DeclarationName Entity) : Self(Self) 
-    {
+                  DeclarationName Entity) : Self(Self) {
       OldLocation = Self.getDerived().getBaseLocation();
       OldEntity = Self.getDerived().getBaseEntity();
       Self.getDerived().setBase(Location, Entity);
     }
-    
+
     ~TemporaryBase() {
       Self.getDerived().setBase(OldLocation, OldEntity);
     }
   };
-  
-  /// \brief Determine whether the given type \p T has already been 
+
+  /// \brief Determine whether the given type \p T has already been
   /// transformed.
   ///
   /// Subclasses can provide an alternative implementation of this routine
-  /// to short-circuit evaluation when it is known that a given type will 
+  /// to short-circuit evaluation when it is known that a given type will
   /// not change. For example, template instantiation need not traverse
   /// non-dependent types.
   bool AlreadyTransformed(QualType T) {
@@ -172,15 +171,15 @@
   /// \brief Transforms the given type into another type.
   ///
   /// By default, this routine transforms a type by delegating to the
-  /// appropriate TransformXXXType to build a new type, then applying 
-  /// the qualifiers on \p T to the resulting type with AddTypeQualifiers. 
-  /// Subclasses may override this function (to take over all type 
+  /// appropriate TransformXXXType to build a new type, then applying
+  /// the qualifiers on \p T to the resulting type with AddTypeQualifiers.
+  /// Subclasses may override this function (to take over all type
   /// transformations), some set of the TransformXXXType functions, or
   /// the AddTypeQualifiers function to alter the transformation.
   ///
   /// \returns the transformed type.
   QualType TransformType(QualType T);
-  
+
   /// \brief Transform the given type by adding the given set of qualifiers
   /// and returning the result.
   ///
@@ -190,10 +189,10 @@
   /// is the right thing for template instantiation, but probably not for
   /// other clients.
   QualType AddTypeQualifiers(QualType T, unsigned CVRQualifiers);
-       
+
   /// \brief Transform the given statement.
   ///
-  /// By default, this routine transforms a statement by delegating to the 
+  /// By default, this routine transforms a statement by delegating to the
   /// appropriate TransformXXXStmt function to transform a specific kind of
   /// statement or the TransformExpr() function to transform an expression.
   /// Subclasses may override this function to transform statements using some
@@ -201,7 +200,7 @@
   ///
   /// \returns the transformed statement.
   OwningStmtResult TransformStmt(Stmt *S);
-  
+
   /// \brief Transform the given expression.
   ///
   /// By default, this routine transforms an expression by delegating to the
@@ -223,7 +222,7 @@
   ///
   /// \returns the transformed expression.
   OwningExprResult TransformExpr(Expr *E, bool isAddressOfOperand);
-  
+
   /// \brief Transform the given declaration, which is referenced from a type
   /// or expression.
   ///
@@ -233,20 +232,20 @@
 
   /// \brief Transform the definition of the given declaration.
   ///
-  /// By default, invokes TransformDecl() to transform the declaration. 
+  /// By default, invokes TransformDecl() to transform the declaration.
   /// Subclasses may override this function to provide alternate behavior.
   Decl *TransformDefinition(Decl *D) { return getDerived().TransformDecl(D); }
-  
+
   /// \brief Transform the given nested-name-specifier.
   ///
-  /// By default, transforms all of the types and declarations within the 
+  /// By default, transforms all of the types and declarations within the
   /// nested-name-specifier. Subclasses may override this function to provide
   /// alternate behavior.
   NestedNameSpecifier *TransformNestedNameSpecifier(NestedNameSpecifier *NNS,
                                                     SourceRange Range,
                                               QualType ObjectType = QualType(),
                                           NamedDecl *FirstQualifierInScope = 0);
-  
+
   /// \brief Transform the given declaration name.
   ///
   /// By default, transforms the types of conversion function, constructor,
@@ -255,37 +254,37 @@
   /// override this function to provide alternate behavior.
   DeclarationName TransformDeclarationName(DeclarationName Name,
                                            SourceLocation Loc);
-  
+
   /// \brief Transform the given template name.
-  /// 
+  ///
   /// By default, transforms the template name by transforming the declarations
-  /// and nested-name-specifiers that occur within the template name. 
+  /// and nested-name-specifiers that occur within the template name.
   /// Subclasses may override this function to provide alternate behavior.
   TemplateName TransformTemplateName(TemplateName Name,
                                      QualType ObjectType = QualType());
-  
+
   /// \brief Transform the given template argument.
   ///
-  /// By default, this operation transforms the type, expression, or 
-  /// declaration stored within the template argument and constructs a 
+  /// By default, this operation transforms the type, expression, or
+  /// declaration stored within the template argument and constructs a
   /// new template argument from the transformed result. Subclasses may
   /// override this function to provide alternate behavior.
   TemplateArgument TransformTemplateArgument(const TemplateArgument &Arg);
-  
+
 #define ABSTRACT_TYPE(CLASS, PARENT)
 #define TYPE(CLASS, PARENT)                                   \
   QualType Transform##CLASS##Type(const CLASS##Type *T);
-#include "clang/AST/TypeNodes.def"      
+#include "clang/AST/TypeNodes.def"
 
   OwningStmtResult TransformCompoundStmt(CompoundStmt *S, bool IsStmtExpr);
-                                         
+
 #define STMT(Node, Parent)                        \
   OwningStmtResult Transform##Node(Node *S);
 #define EXPR(Node, Parent)                        \
   OwningExprResult Transform##Node(Node *E);
 #define ABSTRACT_EXPR(Node, Parent)
 #include "clang/AST/StmtNodes.def"
-  
+
   /// \brief Build a new pointer type given its pointee type.
   ///
   /// By default, performs semantic analysis when building the pointer type.
@@ -294,7 +293,7 @@
 
   /// \brief Build a new block pointer type given its pointee type.
   ///
-  /// By default, performs semantic analysis when building the block pointer 
+  /// By default, performs semantic analysis when building the block pointer
   /// type. Subclasses may override this routine to provide different behavior.
   QualType RebuildBlockPointerType(QualType PointeeType);
 
@@ -309,45 +308,45 @@
   /// By default, performs semantic analysis when building the rvalue reference
   /// type. Subclasses may override this routine to provide different behavior.
   QualType RebuildRValueReferenceType(QualType ReferentType);
-  
+
   /// \brief Build a new member pointer type given the pointee type and the
   /// class type it refers into.
   ///
   /// By default, performs semantic analysis when building the member pointer
   /// type. Subclasses may override this routine to provide different behavior.
   QualType RebuildMemberPointerType(QualType PointeeType, QualType ClassType);
-  
+
   /// \brief Build a new array type given the element type, size
   /// modifier, size of the array (if known), size expression, and index type
   /// qualifiers.
   ///
   /// By default, performs semantic analysis when building the array type.
   /// Subclasses may override this routine to provide different behavior.
-  /// Also by default, all of the other Rebuild*Array 
+  /// Also by default, all of the other Rebuild*Array
   QualType RebuildArrayType(QualType ElementType,
                             ArrayType::ArraySizeModifier SizeMod,
                             const llvm::APInt *Size,
                             Expr *SizeExpr,
                             unsigned IndexTypeQuals,
                             SourceRange BracketsRange);
-  
+
   /// \brief Build a new constant array type given the element type, size
   /// modifier, (known) size of the array, and index type qualifiers.
   ///
   /// By default, performs semantic analysis when building the array type.
   /// Subclasses may override this routine to provide different behavior.
-  QualType RebuildConstantArrayType(QualType ElementType, 
+  QualType RebuildConstantArrayType(QualType ElementType,
                                     ArrayType::ArraySizeModifier SizeMod,
                                     const llvm::APInt &Size,
                                     unsigned IndexTypeQuals);
 
   /// \brief Build a new constant array type given the element type, size
-  /// modifier, (known) size of the array, size expression, and index type 
+  /// modifier, (known) size of the array, size expression, and index type
   /// qualifiers.
   ///
   /// By default, performs semantic analysis when building the array type.
   /// Subclasses may override this routine to provide different behavior.
-  QualType RebuildConstantArrayWithExprType(QualType ElementType, 
+  QualType RebuildConstantArrayWithExprType(QualType ElementType,
                                             ArrayType::ArraySizeModifier SizeMod,
                                             const llvm::APInt &Size,
                                             Expr *SizeExpr,
@@ -359,7 +358,7 @@
   ///
   /// By default, performs semantic analysis when building the array type.
   /// Subclasses may override this routine to provide different behavior.
-  QualType RebuildConstantArrayWithoutExprType(QualType ElementType, 
+  QualType RebuildConstantArrayWithoutExprType(QualType ElementType,
                                                ArrayType::ArraySizeModifier SizeMod,
                                                const llvm::APInt &Size,
                                                unsigned IndexTypeQuals);
@@ -369,27 +368,27 @@
   ///
   /// By default, performs semantic analysis when building the array type.
   /// Subclasses may override this routine to provide different behavior.
-  QualType RebuildIncompleteArrayType(QualType ElementType, 
+  QualType RebuildIncompleteArrayType(QualType ElementType,
                                       ArrayType::ArraySizeModifier SizeMod,
                                       unsigned IndexTypeQuals);
 
-  /// \brief Build a new variable-length array type given the element type, 
+  /// \brief Build a new variable-length array type given the element type,
   /// size modifier, size expression, and index type qualifiers.
   ///
   /// By default, performs semantic analysis when building the array type.
   /// Subclasses may override this routine to provide different behavior.
-  QualType RebuildVariableArrayType(QualType ElementType, 
+  QualType RebuildVariableArrayType(QualType ElementType,
                                     ArrayType::ArraySizeModifier SizeMod,
                                     ExprArg SizeExpr,
                                     unsigned IndexTypeQuals,
                                     SourceRange BracketsRange);
 
-  /// \brief Build a new dependent-sized array type given the element type, 
+  /// \brief Build a new dependent-sized array type given the element type,
   /// size modifier, size expression, and index type qualifiers.
   ///
   /// By default, performs semantic analysis when building the array type.
   /// Subclasses may override this routine to provide different behavior.
-  QualType RebuildDependentSizedArrayType(QualType ElementType, 
+  QualType RebuildDependentSizedArrayType(QualType ElementType,
                                           ArrayType::ArraySizeModifier SizeMod,
                                           ExprArg SizeExpr,
                                           unsigned IndexTypeQuals,
@@ -401,7 +400,7 @@
   /// By default, performs semantic analysis when building the vector type.
   /// Subclasses may override this routine to provide different behavior.
   QualType RebuildVectorType(QualType ElementType, unsigned NumElements);
-  
+
   /// \brief Build a new extended vector type given the element type and
   /// number of elements.
   ///
@@ -409,25 +408,25 @@
   /// Subclasses may override this routine to provide different behavior.
   QualType RebuildExtVectorType(QualType ElementType, unsigned NumElements,
                                 SourceLocation AttributeLoc);
-  
-  /// \brief Build a new potentially dependently-sized extended vector type 
+
+  /// \brief Build a new potentially dependently-sized extended vector type
   /// given the element type and number of elements.
   ///
   /// By default, performs semantic analysis when building the vector type.
   /// Subclasses may override this routine to provide different behavior.
-  QualType RebuildDependentSizedExtVectorType(QualType ElementType, 
+  QualType RebuildDependentSizedExtVectorType(QualType ElementType,
                                               ExprArg SizeExpr,
                                               SourceLocation AttributeLoc);
-    
+
   /// \brief Build a new function type.
   ///
   /// By default, performs semantic analysis when building the function type.
   /// Subclasses may override this routine to provide different behavior.
   QualType RebuildFunctionProtoType(QualType T,
-                                    QualType *ParamTypes, 
+                                    QualType *ParamTypes,
                                     unsigned NumParamTypes,
                                     bool Variadic, unsigned Quals);
-    
+
   /// \brief Build a new typedef type.
   QualType RebuildTypedefType(TypedefDecl *Typedef) {
     return SemaRef.Context.getTypeDeclType(Typedef);
@@ -447,24 +446,24 @@
   QualType RebuildElaboratedType(QualType T, ElaboratedType::TagKind Tag) {
     return SemaRef.Context.getElaboratedType(T, Tag);
   }
-  
-  /// \brief Build a new typeof(expr) type. 
+
+  /// \brief Build a new typeof(expr) type.
   ///
   /// By default, performs semantic analysis when building the typeof type.
   /// Subclasses may override this routine to provide different behavior.
   QualType RebuildTypeOfExprType(ExprArg Underlying);
 
-  /// \brief Build a new typeof(type) type. 
+  /// \brief Build a new typeof(type) type.
   ///
   /// By default, builds a new TypeOfType with the given underlying type.
   QualType RebuildTypeOfType(QualType Underlying);
 
-  /// \brief Build a new C++0x decltype type. 
+  /// \brief Build a new C++0x decltype type.
   ///
   /// By default, performs semantic analysis when building the decltype type.
   /// Subclasses may override this routine to provide different behavior.
   QualType RebuildDecltypeType(ExprArg Underlying);
-  
+
   /// \brief Build a new template specialization type.
   ///
   /// By default, performs semantic analysis when building the template
@@ -473,40 +472,40 @@
   QualType RebuildTemplateSpecializationType(TemplateName Template,
                                              const TemplateArgument *Args,
                                              unsigned NumArgs);
-  
+
   /// \brief Build a new qualified name type.
   ///
-  /// By default, builds a new QualifiedNameType type from the 
-  /// nested-name-specifier and the named type. Subclasses may override 
+  /// By default, builds a new QualifiedNameType type from the
+  /// nested-name-specifier and the named type. Subclasses may override
   /// this routine to provide different behavior.
   QualType RebuildQualifiedNameType(NestedNameSpecifier *NNS, QualType Named) {
     return SemaRef.Context.getQualifiedNameType(NNS, Named);
-  }  
+  }
 
   /// \brief Build a new typename type that refers to a template-id.
   ///
   /// By default, builds a new TypenameType type from the nested-name-specifier
-  /// and the given type. Subclasses may override this routine to provide 
+  /// and the given type. Subclasses may override this routine to provide
   /// different behavior.
   QualType RebuildTypenameType(NestedNameSpecifier *NNS, QualType T) {
     if (NNS->isDependent())
-      return SemaRef.Context.getTypenameType(NNS, 
+      return SemaRef.Context.getTypenameType(NNS,
                                           cast<TemplateSpecializationType>(T));
-    
+
     return SemaRef.Context.getQualifiedNameType(NNS, T);
-  }  
+  }
 
   /// \brief Build a new typename type that refers to an identifier.
   ///
   /// By default, performs semantic analysis when building the typename type
-  /// (or qualified name type). Subclasses may override this routine to provide 
+  /// (or qualified name type). Subclasses may override this routine to provide
   /// different behavior.
-  QualType RebuildTypenameType(NestedNameSpecifier *NNS, 
+  QualType RebuildTypenameType(NestedNameSpecifier *NNS,
                                const IdentifierInfo *Id) {
     return SemaRef.CheckTypenameType(NNS, *Id,
                                   SourceRange(getDerived().getBaseLocation()));
   }
-  
+
   /// \brief Build a new nested-name-specifier given the prefix and an
   /// identifier that names the next step in the nested-name-specifier.
   ///
@@ -559,7 +558,7 @@
   TemplateName RebuildTemplateName(NestedNameSpecifier *Qualifier,
                                    bool TemplateKW,
                                    OverloadedFunctionDecl *Ovl);
-  
+
   /// \brief Build a new template name given a nested name specifier and the
   /// name that is referred to as a template.
   ///
@@ -570,8 +569,8 @@
   TemplateName RebuildTemplateName(NestedNameSpecifier *Qualifier,
                                    const IdentifierInfo &II,
                                    QualType ObjectType);
-  
-  
+
+
   /// \brief Build a new compound statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -593,10 +592,10 @@
                                    SourceLocation EllipsisLoc,
                                    ExprArg RHS,
                                    SourceLocation ColonLoc) {
-    return getSema().ActOnCaseStmt(CaseLoc, move(LHS), EllipsisLoc, move(RHS), 
+    return getSema().ActOnCaseStmt(CaseLoc, move(LHS), EllipsisLoc, move(RHS),
                                    ColonLoc);
   }
-  
+
   /// \brief Attach the body to a new case statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -605,39 +604,39 @@
     getSema().ActOnCaseStmtBody(S.get(), move(Body));
     return move(S);
   }
-  
+
   /// \brief Build a new default statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
-  OwningStmtResult RebuildDefaultStmt(SourceLocation DefaultLoc, 
+  OwningStmtResult RebuildDefaultStmt(SourceLocation DefaultLoc,
                                       SourceLocation ColonLoc,
                                       StmtArg SubStmt) {
-    return getSema().ActOnDefaultStmt(DefaultLoc, ColonLoc, move(SubStmt), 
+    return getSema().ActOnDefaultStmt(DefaultLoc, ColonLoc, move(SubStmt),
                                       /*CurScope=*/0);
   }
-  
+
   /// \brief Build a new label statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
-  OwningStmtResult RebuildLabelStmt(SourceLocation IdentLoc, 
+  OwningStmtResult RebuildLabelStmt(SourceLocation IdentLoc,
                                     IdentifierInfo *Id,
                                     SourceLocation ColonLoc,
                                     StmtArg SubStmt) {
     return SemaRef.ActOnLabelStmt(IdentLoc, Id, ColonLoc, move(SubStmt));
   }
-  
+
   /// \brief Build a new "if" statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
-  OwningStmtResult RebuildIfStmt(SourceLocation IfLoc, Sema::FullExprArg Cond, 
-                                 StmtArg Then, SourceLocation ElseLoc, 
+  OwningStmtResult RebuildIfStmt(SourceLocation IfLoc, Sema::FullExprArg Cond,
+                                 StmtArg Then, SourceLocation ElseLoc,
                                  StmtArg Else) {
     return getSema().ActOnIfStmt(IfLoc, Cond, move(Then), ElseLoc, move(Else));
   }
-  
+
   /// \brief Start building a new switch statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -645,12 +644,12 @@
   OwningStmtResult RebuildSwitchStmtStart(ExprArg Cond) {
     return getSema().ActOnStartOfSwitchStmt(move(Cond));
   }
-  
+
   /// \brief Attach the body to the switch statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
-  OwningStmtResult RebuildSwitchStmtBody(SourceLocation SwitchLoc, 
+  OwningStmtResult RebuildSwitchStmtBody(SourceLocation SwitchLoc,
                                          StmtArg Switch, StmtArg Body) {
     return getSema().ActOnFinishSwitchStmt(SwitchLoc, move(Switch),
                                          move(Body));
@@ -665,7 +664,7 @@
                                     StmtArg Body) {
     return getSema().ActOnWhileStmt(WhileLoc, Cond, move(Body));
   }
-  
+
   /// \brief Build a new do-while statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -675,7 +674,7 @@
                                  SourceLocation LParenLoc,
                                  ExprArg Cond,
                                  SourceLocation RParenLoc) {
-    return getSema().ActOnDoStmt(DoLoc, move(Body), WhileLoc, LParenLoc, 
+    return getSema().ActOnDoStmt(DoLoc, move(Body), WhileLoc, LParenLoc,
                                  move(Cond), RParenLoc);
   }
 
@@ -683,14 +682,14 @@
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
-  OwningStmtResult RebuildForStmt(SourceLocation ForLoc, 
+  OwningStmtResult RebuildForStmt(SourceLocation ForLoc,
                                   SourceLocation LParenLoc,
                                   StmtArg Init, ExprArg Cond, ExprArg Inc,
                                   SourceLocation RParenLoc, StmtArg Body) {
-    return getSema().ActOnForStmt(ForLoc, LParenLoc, move(Init), move(Cond), 
+    return getSema().ActOnForStmt(ForLoc, LParenLoc, move(Init), move(Cond),
                                   move(Inc), RParenLoc, move(Body));
   }
-  
+
   /// \brief Build a new goto statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -710,23 +709,23 @@
                                            ExprArg Target) {
     return getSema().ActOnIndirectGotoStmt(GotoLoc, StarLoc, move(Target));
   }
-  
+
   /// \brief Build a new return statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   OwningStmtResult RebuildReturnStmt(SourceLocation ReturnLoc,
                                      ExprArg Result) {
-    
+
     return getSema().ActOnReturnStmt(ReturnLoc, move(Result));
   }
-  
+
   /// \brief Build a new declaration statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
   /// Subclasses may override this routine to provide different behavior.
   OwningStmtResult RebuildDeclStmt(Decl **Decls, unsigned NumDecls,
-                                   SourceLocation StartLoc, 
+                                   SourceLocation StartLoc,
                                    SourceLocation EndLoc) {
     return getSema().Owned(
              new (getSema().Context) DeclStmt(
@@ -734,17 +733,17 @@
                                                              Decls, NumDecls),
                                               StartLoc, EndLoc));
   }
-  
+
   /// \brief Build a new C++ exception declaration.
   ///
   /// By default, performs semantic analysis to build the new decaration.
   /// Subclasses may override this routine to provide different behavior.
-  VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, QualType T, 
+  VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, QualType T,
                                 DeclaratorInfo *Declarator,
                                 IdentifierInfo *Name,
                                 SourceLocation Loc,
                                 SourceRange TypeRange) {
-    return getSema().BuildExceptionDeclaration(0, T, Declarator, Name, Loc, 
+    return getSema().BuildExceptionDeclaration(0, T, Declarator, Name, Loc,
                                                TypeRange);
   }
 
@@ -756,10 +755,10 @@
                                        VarDecl *ExceptionDecl,
                                        StmtArg Handler) {
     return getSema().Owned(
-             new (getSema().Context) CXXCatchStmt(CatchLoc, ExceptionDecl, 
+             new (getSema().Context) CXXCatchStmt(CatchLoc, ExceptionDecl,
                                                   Handler.takeAs<Stmt>()));
   }
-  
+
   /// \brief Build a new C++ try statement.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -769,7 +768,7 @@
                                      MultiStmtArg Handlers) {
     return getSema().ActOnCXXTryBlock(TryLoc, move(TryBlock), move(Handlers));
   }
-  
+
   /// \brief Build a new expression that references a declaration.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -780,9 +779,9 @@
                                               /*SS=*/0,
                                               /*FIXME:*/false);
   }
-  
+
   /// \brief Build a new expression in parentheses.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildParenExpr(ExprArg SubExpr, SourceLocation LParen,
@@ -791,7 +790,7 @@
   }
 
   /// \brief Build a new pseudo-destructor expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildCXXPseudoDestructorExpr(ExprArg Base,
@@ -807,21 +806,21 @@
       SS.setScopeRep(Qualifier);
     }
 
-    DeclarationName Name 
+    DeclarationName Name
       = SemaRef.Context.DeclarationNames.getCXXDestructorName(
                                SemaRef.Context.getCanonicalType(DestroyedType));
-    
-    return getSema().BuildMemberReferenceExpr(/*Scope=*/0, move(Base), 
+
+    return getSema().BuildMemberReferenceExpr(/*Scope=*/0, move(Base),
                                               OperatorLoc,
                                               isArrow? tok::arrow : tok::period,
                                               DestroyedTypeLoc,
                                               Name,
                                               Sema::DeclPtrTy::make((Decl *)0),
                                               &SS);
-  }                                              
-  
+  }
+
   /// \brief Build a new unary operator expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildUnaryOperator(SourceLocation OpLoc,
@@ -829,9 +828,9 @@
                                         ExprArg SubExpr) {
     return getSema().CreateBuiltinUnaryOp(OpLoc, Opc, move(SubExpr));
   }
-  
+
   /// \brief Build a new sizeof or alignof expression with a type argument.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildSizeOfAlignOf(QualType T, SourceLocation OpLoc,
@@ -839,38 +838,38 @@
     return getSema().CreateSizeOfAlignOfExpr(T, OpLoc, isSizeOf, R);
   }
 
-  /// \brief Build a new sizeof or alignof expression with an expression 
+  /// \brief Build a new sizeof or alignof expression with an expression
   /// argument.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildSizeOfAlignOf(ExprArg SubExpr, SourceLocation OpLoc,
                                         bool isSizeOf, SourceRange R) {
-    OwningExprResult Result 
+    OwningExprResult Result
       = getSema().CreateSizeOfAlignOfExpr((Expr *)SubExpr.get(),
                                           OpLoc, isSizeOf, R);
     if (Result.isInvalid())
       return getSema().ExprError();
-    
+
     SubExpr.release();
     return move(Result);
   }
-  
+
   /// \brief Build a new array subscript expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
-  OwningExprResult RebuildArraySubscriptExpr(ExprArg LHS, 
+  OwningExprResult RebuildArraySubscriptExpr(ExprArg LHS,
                                              SourceLocation LBracketLoc,
                                              ExprArg RHS,
                                              SourceLocation RBracketLoc) {
     return getSema().ActOnArraySubscriptExpr(/*Scope=*/0, move(LHS),
-                                             LBracketLoc, move(RHS), 
+                                             LBracketLoc, move(RHS),
                                              RBracketLoc);
   }
 
   /// \brief Build a new call expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildCallExpr(ExprArg Callee, SourceLocation LParenLoc,
@@ -882,11 +881,11 @@
   }
 
   /// \brief Build a new member access expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildMemberExpr(ExprArg Base, SourceLocation OpLoc,
-                                     bool isArrow, 
+                                     bool isArrow,
                                      NestedNameSpecifier *Qualifier,
                                      SourceRange QualifierRange,
                                      SourceLocation MemberLoc,
@@ -894,14 +893,14 @@
     if (!Member->getDeclName()) {
       // We have a reference to an unnamed field.
       assert(!Qualifier && "Can't have an unnamed field with a qualifier!");
-      
-      MemberExpr *ME = 
+
+      MemberExpr *ME =
         new (getSema().Context) MemberExpr(Base.takeAs<Expr>(), isArrow,
                                            Member, MemberLoc,
                                            cast<FieldDecl>(Member)->getType());
       return getSema().Owned(ME);
     }
-      
+
     CXXScopeSpec SS;
     if (Qualifier) {
       SS.setRange(QualifierRange);
@@ -915,27 +914,27 @@
                                      /*FIXME?*/Sema::DeclPtrTy::make((Decl*)0),
                                               &SS);
   }
-  
+
   /// \brief Build a new binary operator expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildBinaryOperator(SourceLocation OpLoc,
                                          BinaryOperator::Opcode Opc,
                                          ExprArg LHS, ExprArg RHS) {
     OwningExprResult Result
-      = getSema().CreateBuiltinBinOp(OpLoc, Opc, (Expr *)LHS.get(), 
+      = getSema().CreateBuiltinBinOp(OpLoc, Opc, (Expr *)LHS.get(),
                                      (Expr *)RHS.get());
     if (Result.isInvalid())
       return SemaRef.ExprError();
-    
+
     LHS.release();
     RHS.release();
     return move(Result);
   }
 
   /// \brief Build a new conditional operator expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildConditionalOperator(ExprArg Cond,
@@ -943,25 +942,25 @@
                                               ExprArg LHS,
                                               SourceLocation ColonLoc,
                                               ExprArg RHS) {
-    return getSema().ActOnConditionalOp(QuestionLoc, ColonLoc, move(Cond), 
+    return getSema().ActOnConditionalOp(QuestionLoc, ColonLoc, move(Cond),
                                         move(LHS), move(RHS));
   }
 
   /// \brief Build a new implicit cast expression.
-  /// 
+  ///
   /// By default, builds a new implicit cast without any semantic analysis.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildImplicitCastExpr(QualType T, CastExpr::CastKind Kind,
                                            ExprArg SubExpr, bool isLvalue) {
     ImplicitCastExpr *ICE
-      = new (getSema().Context) ImplicitCastExpr(T, Kind, 
+      = new (getSema().Context) ImplicitCastExpr(T, Kind,
                                                  (Expr *)SubExpr.release(),
                                                  isLvalue);
     return getSema().Owned(ICE);
   }
 
   /// \brief Build a new C-style cast expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildCStyleCaseExpr(SourceLocation LParenLoc,
@@ -974,9 +973,9 @@
                                    RParenLoc,
                                    move(SubExpr));
   }
-  
+
   /// \brief Build a new compound literal expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildCompoundLiteralExpr(SourceLocation LParenLoc,
@@ -986,12 +985,12 @@
     return getSema().ActOnCompoundLiteral(LParenLoc, T.getAsOpaquePtr(),
                                           RParenLoc, move(Init));
   }
-            
+
   /// \brief Build a new extended vector element access expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
-  OwningExprResult RebuildExtVectorElementExpr(ExprArg Base, 
+  OwningExprResult RebuildExtVectorElementExpr(ExprArg Base,
                                                SourceLocation OpLoc,
                                                SourceLocation AccessorLoc,
                                                IdentifierInfo &Accessor) {
@@ -1000,9 +999,9 @@
                                               Accessor,
                                      /*FIXME?*/Sema::DeclPtrTy::make((Decl*)0));
   }
-  
+
   /// \brief Build a new initializer list expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildInitList(SourceLocation LBraceLoc,
@@ -1010,9 +1009,9 @@
                                    SourceLocation RBraceLoc) {
     return SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc);
   }
-  
+
   /// \brief Build a new designated initializer expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildDesignatedInitExpr(Designation &Desig,
@@ -1025,32 +1024,32 @@
                                            move(Init));
     if (Result.isInvalid())
       return SemaRef.ExprError();
-    
+
     ArrayExprs.release();
     return move(Result);
   }
-  
+
   /// \brief Build a new value-initialized expression.
-  /// 
+  ///
   /// By default, builds the implicit value initialization without performing
   /// any semantic analysis. Subclasses may override this routine to provide
   /// different behavior.
   OwningExprResult RebuildImplicitValueInitExpr(QualType T) {
     return SemaRef.Owned(new (SemaRef.Context) ImplicitValueInitExpr(T));
   }
-  
+
   /// \brief Build a new \c va_arg expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildVAArgExpr(SourceLocation BuiltinLoc, ExprArg SubExpr,
                                     QualType T, SourceLocation RParenLoc) {
-    return getSema().ActOnVAArg(BuiltinLoc, move(SubExpr), T.getAsOpaquePtr(), 
+    return getSema().ActOnVAArg(BuiltinLoc, move(SubExpr), T.getAsOpaquePtr(),
                                 RParenLoc);
   }
 
   /// \brief Build a new expression list in parentheses.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildParenListExpr(SourceLocation LParenLoc,
@@ -1058,10 +1057,10 @@
                                         SourceLocation RParenLoc) {
     return getSema().ActOnParenListExpr(LParenLoc, RParenLoc, move(SubExprs));
   }
-  
+
   /// \brief Build a new address-of-label expression.
-  /// 
-  /// By default, performs semantic analysis, using the name of the label 
+  ///
+  /// By default, performs semantic analysis, using the name of the label
   /// rather than attempting to map the label statement itself.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildAddrLabelExpr(SourceLocation AmpAmpLoc,
@@ -1069,9 +1068,9 @@
                                         LabelStmt *Label) {
     return getSema().ActOnAddrLabel(AmpAmpLoc, LabelLoc, Label->getID());
   }
-  
+
   /// \brief Build a new GNU statement expression.
-  /// 
+  ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildStmtExpr(SourceLocation LParenLoc,
@@ -1079,7 +1078,7 @@
                                    SourceLocation RParenLoc) {
     return getSema().ActOnStmtExpr(LParenLoc, move(SubStmt), RParenLoc);
   }
-  
+
   /// \brief Build a new __builtin_types_compatible_p expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1092,7 +1091,7 @@
                                               T2.getAsOpaquePtr(),
                                               RParenLoc);
   }
-  
+
   /// \brief Build a new __builtin_choose_expr expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1104,13 +1103,13 @@
                                    move(Cond), move(LHS), move(RHS),
                                    RParenLoc);
   }
-  
+
   /// \brief Build a new overloaded operator call expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
   /// The semantic analysis provides the behavior of template instantiation,
   /// copying with transformations that turn what looks like an overloaded
-  /// operator call into a use of a builtin operator, performing 
+  /// operator call into a use of a builtin operator, performing
   /// argument-dependent lookup, etc. Subclasses may override this routine to
   /// provide different behavior.
   OwningExprResult RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
@@ -1118,12 +1117,12 @@
                                               ExprArg Callee,
                                               ExprArg First,
                                               ExprArg Second);
-  
-  /// \brief Build a new C++ "named" cast expression, such as static_cast or 
+
+  /// \brief Build a new C++ "named" cast expression, such as static_cast or
   /// reinterpret_cast.
   ///
   /// By default, this routine dispatches to one of the more-specific routines
-  /// for a particular named case, e.g., RebuildCXXStaticCastExpr().  
+  /// for a particular named case, e.g., RebuildCXXStaticCastExpr().
   /// Subclasses may override this routine to provide different behavior.
   OwningExprResult RebuildCXXNamedCastExpr(SourceLocation OpLoc,
                                            Stmt::StmtClass Class,
@@ -1135,34 +1134,34 @@
                                            SourceLocation RParenLoc) {
     switch (Class) {
     case Stmt::CXXStaticCastExprClass:
-      return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, T, 
-                                                   RAngleLoc, LParenLoc, 
+      return getDerived().RebuildCXXStaticCastExpr(OpLoc, LAngleLoc, T,
+                                                   RAngleLoc, LParenLoc,
                                                    move(SubExpr), RParenLoc);
 
     case Stmt::CXXDynamicCastExprClass:
-      return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, T, 
-                                                    RAngleLoc, LParenLoc, 
+      return getDerived().RebuildCXXDynamicCastExpr(OpLoc, LAngleLoc, T,
+                                                    RAngleLoc, LParenLoc,
                                                     move(SubExpr), RParenLoc);
-        
+
     case Stmt::CXXReinterpretCastExprClass:
-      return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, T, 
-                                                        RAngleLoc, LParenLoc, 
-                                                        move(SubExpr), 
+      return getDerived().RebuildCXXReinterpretCastExpr(OpLoc, LAngleLoc, T,
+                                                        RAngleLoc, LParenLoc,
+                                                        move(SubExpr),
                                                         RParenLoc);
-        
+
     case Stmt::CXXConstCastExprClass:
-      return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, T, 
-                                                   RAngleLoc, LParenLoc, 
+      return getDerived().RebuildCXXConstCastExpr(OpLoc, LAngleLoc, T,
+                                                   RAngleLoc, LParenLoc,
                                                    move(SubExpr), RParenLoc);
-        
+
     default:
       assert(false && "Invalid C++ named cast");
       break;
     }
-    
+
     return getSema().ExprError();
   }
-  
+
   /// \brief Build a new C++ static_cast expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1175,7 +1174,7 @@
                                             ExprArg SubExpr,
                                             SourceLocation RParenLoc) {
     return getSema().ActOnCXXNamedCast(OpLoc, tok::kw_static_cast,
-                                       LAngleLoc, T.getAsOpaquePtr(), RAngleLoc, 
+                                       LAngleLoc, T.getAsOpaquePtr(), RAngleLoc,
                                        LParenLoc, move(SubExpr), RParenLoc);
   }
 
@@ -1191,7 +1190,7 @@
                                              ExprArg SubExpr,
                                              SourceLocation RParenLoc) {
     return getSema().ActOnCXXNamedCast(OpLoc, tok::kw_dynamic_cast,
-                                       LAngleLoc, T.getAsOpaquePtr(), RAngleLoc, 
+                                       LAngleLoc, T.getAsOpaquePtr(), RAngleLoc,
                                        LParenLoc, move(SubExpr), RParenLoc);
   }
 
@@ -1223,10 +1222,10 @@
                                            ExprArg SubExpr,
                                            SourceLocation RParenLoc) {
     return getSema().ActOnCXXNamedCast(OpLoc, tok::kw_const_cast,
-                                       LAngleLoc, T.getAsOpaquePtr(), RAngleLoc, 
+                                       LAngleLoc, T.getAsOpaquePtr(), RAngleLoc,
                                        LParenLoc, move(SubExpr), RParenLoc);
   }
-  
+
   /// \brief Build a new C++ functional-style cast expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1241,10 +1240,10 @@
                                                T.getAsOpaquePtr(),
                                                LParenLoc,
                                          Sema::MultiExprArg(getSema(), &Sub, 1),
-                                               /*CommaLocs=*/0, 
+                                               /*CommaLocs=*/0,
                                                RParenLoc);
   }
-  
+
   /// \brief Build a new C++ typeid(type) expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1253,10 +1252,10 @@
                                         SourceLocation LParenLoc,
                                         QualType T,
                                         SourceLocation RParenLoc) {
-    return getSema().ActOnCXXTypeid(TypeidLoc, LParenLoc, true, 
+    return getSema().ActOnCXXTypeid(TypeidLoc, LParenLoc, true,
                                     T.getAsOpaquePtr(), RParenLoc);
   }
-  
+
   /// \brief Build a new C++ typeid(expr) expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1265,22 +1264,22 @@
                                         SourceLocation LParenLoc,
                                         ExprArg Operand,
                                         SourceLocation RParenLoc) {
-    OwningExprResult Result 
+    OwningExprResult Result
       = getSema().ActOnCXXTypeid(TypeidLoc, LParenLoc, false, Operand.get(),
                                  RParenLoc);
     if (Result.isInvalid())
       return getSema().ExprError();
-    
+
     Operand.release(); // FIXME: since ActOnCXXTypeid silently took ownership
     return move(Result);
-  }  
-  
+  }
+
   /// \brief Build a new C++ "this" expression.
   ///
   /// By default, builds a new "this" expression without performing any
-  /// semantic analysis. Subclasses may override this routine to provide 
+  /// semantic analysis. Subclasses may override this routine to provide
   /// different behavior.
-  OwningExprResult RebuildCXXThisExpr(SourceLocation ThisLoc, 
+  OwningExprResult RebuildCXXThisExpr(SourceLocation ThisLoc,
                                       QualType ThisType) {
     return getSema().Owned(
                       new (getSema().Context) CXXThisExpr(ThisLoc, ThisType));
@@ -1307,38 +1306,38 @@
   ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
-  OwningExprResult RebuildCXXZeroInitValueExpr(SourceLocation TypeStartLoc, 
+  OwningExprResult RebuildCXXZeroInitValueExpr(SourceLocation TypeStartLoc,
                                                SourceLocation LParenLoc,
                                                QualType T,
                                                SourceLocation RParenLoc) {
-    return getSema().ActOnCXXTypeConstructExpr(SourceRange(TypeStartLoc), 
-                                               T.getAsOpaquePtr(), LParenLoc, 
-                                               MultiExprArg(getSema(), 0, 0), 
+    return getSema().ActOnCXXTypeConstructExpr(SourceRange(TypeStartLoc),
+                                               T.getAsOpaquePtr(), LParenLoc,
+                                               MultiExprArg(getSema(), 0, 0),
                                                0, RParenLoc);
   }
-  
+
   /// \brief Build a new C++ conditional declaration expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
-  OwningExprResult RebuildCXXConditionDeclExpr(SourceLocation StartLoc, 
+  OwningExprResult RebuildCXXConditionDeclExpr(SourceLocation StartLoc,
                                                SourceLocation EqLoc,
                                                VarDecl *Var) {
     return SemaRef.Owned(new (SemaRef.Context) CXXConditionDeclExpr(StartLoc,
                                                                     EqLoc,
                                                                     Var));
   }
-  
+
   /// \brief Build a new C++ "new" expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
   /// Subclasses may override this routine to provide different behavior.
-  OwningExprResult RebuildCXXNewExpr(SourceLocation StartLoc, 
+  OwningExprResult RebuildCXXNewExpr(SourceLocation StartLoc,
                                      bool UseGlobal,
                                      SourceLocation PlacementLParen,
                                      MultiExprArg PlacementArgs,
                                      SourceLocation PlacementRParen,
-                                     bool ParenTypeId, 
+                                     bool ParenTypeId,
                                      QualType AllocType,
                                      SourceLocation TypeLoc,
                                      SourceRange TypeRange,
@@ -1346,7 +1345,7 @@
                                      SourceLocation ConstructorLParen,
                                      MultiExprArg ConstructorArgs,
                                      SourceLocation ConstructorRParen) {
-    return getSema().BuildCXXNew(StartLoc, UseGlobal, 
+    return getSema().BuildCXXNew(StartLoc, UseGlobal,
                                  PlacementLParen,
                                  move(PlacementArgs),
                                  PlacementRParen,
@@ -1359,7 +1358,7 @@
                                  move(ConstructorArgs),
                                  ConstructorRParen);
   }
-  
+
   /// \brief Build a new C++ "delete" expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1371,7 +1370,7 @@
     return getSema().ActOnCXXDelete(StartLoc, IsGlobalDelete, IsArrayForm,
                                     move(Operand));
   }
-  
+
   /// \brief Build a new unary type trait expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1381,7 +1380,7 @@
                                          SourceLocation LParenLoc,
                                          QualType T,
                                          SourceLocation RParenLoc) {
-    return getSema().ActOnUnaryTypeTrait(Trait, StartLoc, LParenLoc, 
+    return getSema().ActOnUnaryTypeTrait(Trait, StartLoc, LParenLoc,
                                          T.getAsOpaquePtr(), RParenLoc);
   }
 
@@ -1397,7 +1396,7 @@
     CXXScopeSpec SS;
     SS.setRange(QualifierRange);
     SS.setScopeRep(NNS);
-    return getSema().ActOnDeclarationNameExpr(/*Scope=*/0, 
+    return getSema().ActOnDeclarationNameExpr(/*Scope=*/0,
                                               Location,
                                               ND->getDeclName(),
                                               /*Trailing lparen=*/false,
@@ -1405,7 +1404,7 @@
                                               IsAddressOfOperand);
   }
 
-  /// \brief Build a new (previously unresolved) declaration reference 
+  /// \brief Build a new (previously unresolved) declaration reference
   /// expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1418,7 +1417,7 @@
     CXXScopeSpec SS;
     SS.setRange(QualifierRange);
     SS.setScopeRep(NNS);
-    return getSema().ActOnDeclarationNameExpr(/*Scope=*/0, 
+    return getSema().ActOnDeclarationNameExpr(/*Scope=*/0,
                                               Location,
                                               Name,
                                               /*Trailing lparen=*/false,
@@ -1492,7 +1491,7 @@
                                                Commas,
                                                RParenLoc);
   }
-  
+
   /// \brief Build a new member reference expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1511,7 +1510,7 @@
     CXXScopeSpec SS;
     SS.setRange(QualifierRange);
     SS.setScopeRep(Qualifier);
-        
+
     return SemaRef.BuildMemberReferenceExpr(/*Scope=*/0,
                                             move(Base), OperatorLoc, OpKind,
                                             MemberLoc,
@@ -1540,30 +1539,30 @@
                                                   SourceLocation RAngleLoc) {
     OwningExprResult Base = move(BaseE);
     tok::TokenKind OpKind = IsArrow? tok::arrow : tok::period;
-    
+
     CXXScopeSpec SS;
     SS.setRange(QualifierRange);
     SS.setScopeRep(Qualifier);
-    
+
     // FIXME: We're going to end up looking up the template based on its name,
     // twice! Also, duplicates part of Sema::ActOnMemberTemplateIdReferenceExpr.
     DeclarationName Name;
     if (TemplateDecl *ActualTemplate = Template.getAsTemplateDecl())
       Name = ActualTemplate->getDeclName();
-    else if (OverloadedFunctionDecl *Ovl 
+    else if (OverloadedFunctionDecl *Ovl
                = Template.getAsOverloadedFunctionDecl())
       Name = Ovl->getDeclName();
     else
       Name = Template.getAsDependentTemplateName()->getName();
-          
-      return SemaRef.BuildMemberReferenceExpr(/*Scope=*/0, move(Base), 
+
+      return SemaRef.BuildMemberReferenceExpr(/*Scope=*/0, move(Base),
                                               OperatorLoc, OpKind,
                                               TemplateNameLoc, Name, true,
                                               LAngleLoc, TemplateArgs,
                                               NumTemplateArgs, RAngleLoc,
                                               Sema::DeclPtrTy(), &SS);
   }
-  
+
   /// \brief Build a new Objective-C @encode expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1573,7 +1572,7 @@
                                          SourceLocation RParenLoc) {
     return SemaRef.Owned(SemaRef.BuildObjCEncodeExpression(AtLoc, T,
                                                            RParenLoc));
-  }    
+  }
 
   /// \brief Build a new Objective-C protocol expression.
   ///
@@ -1589,9 +1588,9 @@
                                                              AtLoc,
                                                              ProtoLoc,
                                                              LParenLoc,
-                                                             RParenLoc));                                                             
+                                                             RParenLoc));
   }
-                                           
+
   /// \brief Build a new shuffle vector expression.
   ///
   /// By default, performs semantic analysis to build the new expression.
@@ -1600,20 +1599,20 @@
                                             MultiExprArg SubExprs,
                                             SourceLocation RParenLoc) {
     // Find the declaration for __builtin_shufflevector
-    const IdentifierInfo &Name 
+    const IdentifierInfo &Name
       = SemaRef.Context.Idents.get("__builtin_shufflevector");
     TranslationUnitDecl *TUDecl = SemaRef.Context.getTranslationUnitDecl();
     DeclContext::lookup_result Lookup = TUDecl->lookup(DeclarationName(&Name));
     assert(Lookup.first != Lookup.second && "No __builtin_shufflevector?");
-    
+
     // Build a reference to the __builtin_shufflevector builtin
     FunctionDecl *Builtin = cast<FunctionDecl>(*Lookup.first);
-    Expr *Callee 
+    Expr *Callee
       = new (SemaRef.Context) DeclRefExpr(Builtin, Builtin->getType(),
                                           BuiltinLoc, false, false);
     SemaRef.UsualUnaryConversions(Callee);
-    
-    // Build the CallExpr 
+
+    // Build the CallExpr
     unsigned NumSubExprs = SubExprs.size();
     Expr **Subs = (Expr **)SubExprs.release();
     CallExpr *TheCall = new (SemaRef.Context) CallExpr(SemaRef.Context, Callee,
@@ -1621,14 +1620,14 @@
                                                        Builtin->getResultType(),
                                                        RParenLoc);
     OwningExprResult OwnedCall(SemaRef.Owned(TheCall));
-    
+
     // Type-check the __builtin_shufflevector expression.
     OwningExprResult Result = SemaRef.SemaBuiltinShuffleVector(TheCall);
     if (Result.isInvalid())
       return SemaRef.ExprError();
-    
+
     OwnedCall.release();
-    return move(Result);    
+    return move(Result);
   }
 };
 
@@ -1636,16 +1635,16 @@
 Sema::OwningStmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) {
   if (!S)
     return SemaRef.Owned(S);
-  
+
   switch (S->getStmtClass()) {
   case Stmt::NoStmtClass: break;
-      
+
   // Transform individual statement nodes
 #define STMT(Node, Parent)                                              \
   case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S));
 #define EXPR(Node, Parent)
 #include "clang/AST/StmtNodes.def"
-      
+
   // Transform expressions by calling TransformExpr.
 #define STMT(Node, Parent)
 #define EXPR(Node, Parent) case Stmt::Node##Class:
@@ -1654,15 +1653,15 @@
       Sema::OwningExprResult E = getDerived().TransformExpr(cast<Expr>(S));
       if (E.isInvalid())
         return getSema().StmtError();
-      
+
       return getSema().Owned(E.takeAs<Stmt>());
     }
-  }  
-  
+  }
+
   return SemaRef.Owned(S->Retain());
 }
-  
-  
+
+
 template<typename Derived>
 Sema::OwningExprResult TreeTransform<Derived>::TransformExpr(Expr *E,
                                                     bool isAddressOfOperand) {
@@ -1675,8 +1674,8 @@
 #define EXPR(Node, Parent)                                              \
     case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(E));
 #include "clang/AST/StmtNodes.def"
-  }  
-      
+  }
+
   return SemaRef.Owned(E->Retain());
 }
 
@@ -1688,75 +1687,75 @@
                                              NamedDecl *FirstQualifierInScope) {
   if (!NNS)
     return 0;
-  
+
   // Transform the prefix of this nested name specifier.
   NestedNameSpecifier *Prefix = NNS->getPrefix();
   if (Prefix) {
-    Prefix = getDerived().TransformNestedNameSpecifier(Prefix, Range, 
+    Prefix = getDerived().TransformNestedNameSpecifier(Prefix, Range,
                                                        ObjectType,
                                                        FirstQualifierInScope);
     if (!Prefix)
       return 0;
-    
-    // Clear out the object type and the first qualifier in scope; they only 
+
+    // Clear out the object type and the first qualifier in scope; they only
     // apply to the first element in the nested-name-specifier.
     ObjectType = QualType();
     FirstQualifierInScope = 0;
   }
-  
+
   switch (NNS->getKind()) {
   case NestedNameSpecifier::Identifier:
-    assert((Prefix || !ObjectType.isNull()) && 
+    assert((Prefix || !ObjectType.isNull()) &&
             "Identifier nested-name-specifier with no prefix or object type");
     if (!getDerived().AlwaysRebuild() && Prefix == NNS->getPrefix() &&
         ObjectType.isNull())
       return NNS;
-      
-    return getDerived().RebuildNestedNameSpecifier(Prefix, Range, 
+
+    return getDerived().RebuildNestedNameSpecifier(Prefix, Range,
                                                    *NNS->getAsIdentifier(),
                                                    ObjectType,
                                                    FirstQualifierInScope);
-      
+
   case NestedNameSpecifier::Namespace: {
-    NamespaceDecl *NS 
+    NamespaceDecl *NS
       = cast_or_null<NamespaceDecl>(
                             getDerived().TransformDecl(NNS->getAsNamespace()));
-    if (!getDerived().AlwaysRebuild() && 
+    if (!getDerived().AlwaysRebuild() &&
         Prefix == NNS->getPrefix() &&
         NS == NNS->getAsNamespace())
       return NNS;
-    
+
     return getDerived().RebuildNestedNameSpecifier(Prefix, Range, NS);
   }
-      
+
   case NestedNameSpecifier::Global:
     // There is no meaningful transformation that one could perform on the
     // global scope.
     return NNS;
-      
+
   case NestedNameSpecifier::TypeSpecWithTemplate:
   case NestedNameSpecifier::TypeSpec: {
     QualType T = getDerived().TransformType(QualType(NNS->getAsType(), 0));
     if (T.isNull())
       return 0;
-    
+
     if (!getDerived().AlwaysRebuild() &&
         Prefix == NNS->getPrefix() &&
         T == QualType(NNS->getAsType(), 0))
       return NNS;
-    
-    return getDerived().RebuildNestedNameSpecifier(Prefix, Range, 
-                  NNS->getKind() == NestedNameSpecifier::TypeSpecWithTemplate,    
+
+    return getDerived().RebuildNestedNameSpecifier(Prefix, Range,
+                  NNS->getKind() == NestedNameSpecifier::TypeSpecWithTemplate,
                                                    T);
   }
   }
-  
+
   // Required to silence a GCC warning
-  return 0;  
+  return 0;
 }
 
 template<typename Derived>
-DeclarationName 
+DeclarationName
 TreeTransform<Derived>::TransformDeclarationName(DeclarationName Name,
                                                  SourceLocation Loc) {
   if (!Name)
@@ -1770,7 +1769,7 @@
   case DeclarationName::CXXOperatorName:
   case DeclarationName::CXXUsingDirective:
     return Name;
-      
+
   case DeclarationName::CXXConstructorName:
   case DeclarationName::CXXDestructorName:
   case DeclarationName::CXXConversionFunctionName: {
@@ -1778,151 +1777,151 @@
     QualType T = getDerived().TransformType(Name.getCXXNameType());
     if (T.isNull())
       return DeclarationName();
-    
+
     return SemaRef.Context.DeclarationNames.getCXXSpecialName(
-                                                           Name.getNameKind(), 
+                                                           Name.getNameKind(),
                                           SemaRef.Context.getCanonicalType(T));
-  }      
   }
-  
+  }
+
   return DeclarationName();
 }
 
 template<typename Derived>
-TemplateName 
+TemplateName
 TreeTransform<Derived>::TransformTemplateName(TemplateName Name,
                                               QualType ObjectType) {
   if (QualifiedTemplateName *QTN = Name.getAsQualifiedTemplateName()) {
-    NestedNameSpecifier *NNS 
+    NestedNameSpecifier *NNS
       = getDerived().TransformNestedNameSpecifier(QTN->getQualifier(),
                       /*FIXME:*/SourceRange(getDerived().getBaseLocation()));
     if (!NNS)
       return TemplateName();
-    
+
     if (TemplateDecl *Template = QTN->getTemplateDecl()) {
-      TemplateDecl *TransTemplate 
+      TemplateDecl *TransTemplate
         = cast_or_null<TemplateDecl>(getDerived().TransformDecl(Template));
       if (!TransTemplate)
         return TemplateName();
-      
+
       if (!getDerived().AlwaysRebuild() &&
           NNS == QTN->getQualifier() &&
           TransTemplate == Template)
         return Name;
-      
+
       return getDerived().RebuildTemplateName(NNS, QTN->hasTemplateKeyword(),
                                               TransTemplate);
     }
-      
+
     OverloadedFunctionDecl *Ovl = QTN->getOverloadedFunctionDecl();
     assert(Ovl && "Not a template name or an overload set?");
-    OverloadedFunctionDecl *TransOvl 
+    OverloadedFunctionDecl *TransOvl
       = cast_or_null<OverloadedFunctionDecl>(getDerived().TransformDecl(Ovl));
     if (!TransOvl)
       return TemplateName();
-    
+
     if (!getDerived().AlwaysRebuild() &&
         NNS == QTN->getQualifier() &&
         TransOvl == Ovl)
       return Name;
-    
+
     return getDerived().RebuildTemplateName(NNS, QTN->hasTemplateKeyword(),
                                             TransOvl);
   }
-  
+
   if (DependentTemplateName *DTN = Name.getAsDependentTemplateName()) {
-    NestedNameSpecifier *NNS 
+    NestedNameSpecifier *NNS
       = getDerived().TransformNestedNameSpecifier(DTN->getQualifier(),
                         /*FIXME:*/SourceRange(getDerived().getBaseLocation()));
     if (!NNS && DTN->getQualifier())
       return TemplateName();
-    
+
     if (!getDerived().AlwaysRebuild() &&
         NNS == DTN->getQualifier())
       return Name;
-    
+
     return getDerived().RebuildTemplateName(NNS, *DTN->getName(), ObjectType);
   }
-  
+
   if (TemplateDecl *Template = Name.getAsTemplateDecl()) {
-    TemplateDecl *TransTemplate 
+    TemplateDecl *TransTemplate
       = cast_or_null<TemplateDecl>(getDerived().TransformDecl(Template));
     if (!TransTemplate)
       return TemplateName();
-    
+
     if (!getDerived().AlwaysRebuild() &&
         TransTemplate == Template)
       return Name;
-    
+
     return TemplateName(TransTemplate);
   }
-  
+
   OverloadedFunctionDecl *Ovl = Name.getAsOverloadedFunctionDecl();
   assert(Ovl && "Not a template name or an overload set?");
-  OverloadedFunctionDecl *TransOvl 
+  OverloadedFunctionDecl *TransOvl
     = cast_or_null<OverloadedFunctionDecl>(getDerived().TransformDecl(Ovl));
   if (!TransOvl)
     return TemplateName();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       TransOvl == Ovl)
     return Name;
-  
+
   return TemplateName(TransOvl);
 }
 
 template<typename Derived>
-TemplateArgument 
+TemplateArgument
 TreeTransform<Derived>::TransformTemplateArgument(const TemplateArgument &Arg) {
   switch (Arg.getKind()) {
   case TemplateArgument::Null:
   case TemplateArgument::Integral:
     return Arg;
-      
+
   case TemplateArgument::Type: {
     QualType T = getDerived().TransformType(Arg.getAsType());
     if (T.isNull())
       return TemplateArgument();
     return TemplateArgument(Arg.getLocation(), T);
   }
-      
+
   case TemplateArgument::Declaration: {
     Decl *D = getDerived().TransformDecl(Arg.getAsDecl());
     if (!D)
       return TemplateArgument();
     return TemplateArgument(Arg.getLocation(), D);
   }
-      
+
   case TemplateArgument::Expression: {
     // Template argument expressions are not potentially evaluated.
-    EnterExpressionEvaluationContext Unevaluated(getSema(), 
+    EnterExpressionEvaluationContext Unevaluated(getSema(),
                                                  Action::Unevaluated);
-    
+
     Sema::OwningExprResult E = getDerived().TransformExpr(Arg.getAsExpr());
     if (E.isInvalid())
       return TemplateArgument();
     return TemplateArgument(E.takeAs<Expr>());
   }
-      
+
   case TemplateArgument::Pack: {
     llvm::SmallVector<TemplateArgument, 4> TransformedArgs;
     TransformedArgs.reserve(Arg.pack_size());
-    for (TemplateArgument::pack_iterator A = Arg.pack_begin(), 
+    for (TemplateArgument::pack_iterator A = Arg.pack_begin(),
                                       AEnd = Arg.pack_end();
          A != AEnd; ++A) {
       TemplateArgument TA = getDerived().TransformTemplateArgument(*A);
       if (TA.isNull())
         return TA;
-      
+
       TransformedArgs.push_back(TA);
     }
     TemplateArgument Result;
-    Result.setArgumentPack(TransformedArgs.data(), TransformedArgs.size(), 
+    Result.setArgumentPack(TransformedArgs.data(), TransformedArgs.size(),
                            true);
     return Result;
   }
   }
-  
+
   // Work around bogus GCC warning
   return TemplateArgument();
 }
@@ -1935,126 +1934,126 @@
 QualType TreeTransform<Derived>::TransformType(QualType T) {
   if (getDerived().AlreadyTransformed(T))
     return T;
-  
+
   QualType Result;
   switch (T->getTypeClass()) {
-#define ABSTRACT_TYPE(CLASS, PARENT) 
+#define ABSTRACT_TYPE(CLASS, PARENT)
 #define TYPE(CLASS, PARENT)                                                  \
     case Type::CLASS:                                                        \
       Result = getDerived().Transform##CLASS##Type(                          \
                                   static_cast<CLASS##Type*>(T.getTypePtr())); \
       break;
-#include "clang/AST/TypeNodes.def"      
+#include "clang/AST/TypeNodes.def"
   }
-  
+
   if (Result.isNull() || T == Result)
     return Result;
-  
+
   return getDerived().AddTypeQualifiers(Result, T.getCVRQualifiers());
 }
-  
+
 template<typename Derived>
-QualType 
+QualType
 TreeTransform<Derived>::AddTypeQualifiers(QualType T, unsigned CVRQualifiers) {
   if (CVRQualifiers && !T->isFunctionType() && !T->isReferenceType())
     return T.getWithAdditionalQualifiers(CVRQualifiers);
-  
+
   return T;
 }
 
-template<typename Derived> 
-QualType TreeTransform<Derived>::TransformExtQualType(const ExtQualType *T) { 
+template<typename Derived>
+QualType TreeTransform<Derived>::TransformExtQualType(const ExtQualType *T) {
   // FIXME: Implement
-  return QualType(T, 0); 
+  return QualType(T, 0);
 }
-  
+
 template<typename Derived>
-QualType TreeTransform<Derived>::TransformBuiltinType(const BuiltinType *T) { 
+QualType TreeTransform<Derived>::TransformBuiltinType(const BuiltinType *T) {
   // Nothing to do
-  return QualType(T, 0); 
+  return QualType(T, 0);
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformFixedWidthIntType(
-                                                  const FixedWidthIntType *T) { 
+                                                  const FixedWidthIntType *T) {
   // FIXME: Implement
-  return QualType(T, 0); 
+  return QualType(T, 0);
 }
-  
+
 template<typename Derived>
-QualType TreeTransform<Derived>::TransformComplexType(const ComplexType *T) { 
+QualType TreeTransform<Derived>::TransformComplexType(const ComplexType *T) {
   // FIXME: Implement
-  return QualType(T, 0); 
+  return QualType(T, 0);
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformPointerType(const PointerType *T) {
   QualType PointeeType = getDerived().TransformType(T->getPointeeType());
   if (PointeeType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       PointeeType == T->getPointeeType())
     return QualType(T, 0);
 
   return getDerived().RebuildPointerType(PointeeType);
 }
-  
-template<typename Derived> 
-QualType 
-TreeTransform<Derived>::TransformBlockPointerType(const BlockPointerType *T) { 
+
+template<typename Derived>
+QualType
+TreeTransform<Derived>::TransformBlockPointerType(const BlockPointerType *T) {
   QualType PointeeType = getDerived().TransformType(T->getPointeeType());
   if (PointeeType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       PointeeType == T->getPointeeType())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildBlockPointerType(PointeeType);
 }
 
-template<typename Derived> 
-QualType 
+template<typename Derived>
+QualType
 TreeTransform<Derived>::TransformLValueReferenceType(
-                                               const LValueReferenceType *T) { 
+                                               const LValueReferenceType *T) {
   QualType PointeeType = getDerived().TransformType(T->getPointeeType());
   if (PointeeType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       PointeeType == T->getPointeeType())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildLValueReferenceType(PointeeType);
 }
 
-template<typename Derived> 
-QualType 
+template<typename Derived>
+QualType
 TreeTransform<Derived>::TransformRValueReferenceType(
-                                              const RValueReferenceType *T) { 
+                                              const RValueReferenceType *T) {
   QualType PointeeType = getDerived().TransformType(T->getPointeeType());
   if (PointeeType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       PointeeType == T->getPointeeType())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildRValueReferenceType(PointeeType);
 }
-  
+
 template<typename Derived>
-QualType 
-TreeTransform<Derived>::TransformMemberPointerType(const MemberPointerType *T) { 
+QualType
+TreeTransform<Derived>::TransformMemberPointerType(const MemberPointerType *T) {
   QualType PointeeType = getDerived().TransformType(T->getPointeeType());
   if (PointeeType.isNull())
     return QualType();
-  
+
   QualType ClassType = getDerived().TransformType(QualType(T->getClass(), 0));
   if (ClassType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       PointeeType == T->getPointeeType() &&
       ClassType == QualType(T->getClass(), 0))
@@ -2063,76 +2062,76 @@
   return getDerived().RebuildMemberPointerType(PointeeType, ClassType);
 }
 
-template<typename Derived> 
-QualType 
-TreeTransform<Derived>::TransformConstantArrayType(const ConstantArrayType *T) { 
+template<typename Derived>
+QualType
+TreeTransform<Derived>::TransformConstantArrayType(const ConstantArrayType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType())
     return QualType(T, 0);
-  
-  return getDerived().RebuildConstantArrayType(ElementType, 
+
+  return getDerived().RebuildConstantArrayType(ElementType,
                                                T->getSizeModifier(),
                                                T->getSize(),
                                                T->getIndexTypeQualifier());
 }
-  
+
 template<typename Derived>
-QualType 
+QualType
 TreeTransform<Derived>::TransformConstantArrayWithExprType(
-                                      const ConstantArrayWithExprType *T) { 
+                                      const ConstantArrayWithExprType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
-  
+
   // Array bounds are not potentially evaluated contexts
   EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
-  
+
   Sema::OwningExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
   if (Size.isInvalid())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType() &&
       Size.get() == T->getSizeExpr())
     return QualType(T, 0);
-  
-  return getDerived().RebuildConstantArrayWithExprType(ElementType, 
+
+  return getDerived().RebuildConstantArrayWithExprType(ElementType,
                                                        T->getSizeModifier(),
                                                        T->getSize(),
                                                        Size.takeAs<Expr>(),
                                                    T->getIndexTypeQualifier(),
                                                        T->getBracketsRange());
 }
-  
-template<typename Derived> 
-QualType 
+
+template<typename Derived>
+QualType
 TreeTransform<Derived>::TransformConstantArrayWithoutExprType(
-                                      const ConstantArrayWithoutExprType *T) { 
+                                      const ConstantArrayWithoutExprType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType())
     return QualType(T, 0);
-  
-  return getDerived().RebuildConstantArrayWithoutExprType(ElementType, 
+
+  return getDerived().RebuildConstantArrayWithoutExprType(ElementType,
                                                        T->getSizeModifier(),
                                                        T->getSize(),
                                                     T->getIndexTypeQualifier());
 }
 
-template<typename Derived> 
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformIncompleteArrayType(
-                                              const IncompleteArrayType *T) { 
+                                              const IncompleteArrayType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType())
     return QualType(T, 0);
@@ -2141,91 +2140,91 @@
                                                  T->getSizeModifier(),
                                                  T->getIndexTypeQualifier());
 }
-  
+
 template<typename Derived>
 QualType TreeTransform<Derived>::TransformVariableArrayType(
-                                                  const VariableArrayType *T) { 
+                                                  const VariableArrayType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
-  
+
   // Array bounds are not potentially evaluated contexts
   EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
 
   Sema::OwningExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
   if (Size.isInvalid())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType() &&
       Size.get() == T->getSizeExpr()) {
     Size.take();
     return QualType(T, 0);
   }
-  
-  return getDerived().RebuildVariableArrayType(ElementType, 
+
+  return getDerived().RebuildVariableArrayType(ElementType,
                                                T->getSizeModifier(),
                                                move(Size),
                                                T->getIndexTypeQualifier(),
                                                T->getBracketsRange());
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformDependentSizedArrayType(
-                                          const DependentSizedArrayType *T) { 
+                                          const DependentSizedArrayType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
-  
+
   // Array bounds are not potentially evaluated contexts
   EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
-  
+
   Sema::OwningExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
   if (Size.isInvalid())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType() &&
       Size.get() == T->getSizeExpr()) {
     Size.take();
     return QualType(T, 0);
   }
-  
-  return getDerived().RebuildDependentSizedArrayType(ElementType, 
+
+  return getDerived().RebuildDependentSizedArrayType(ElementType,
                                                      T->getSizeModifier(),
                                                      move(Size),
                                                      T->getIndexTypeQualifier(),
                                                      T->getBracketsRange());
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType(
-                                      const DependentSizedExtVectorType *T) { 
+                                      const DependentSizedExtVectorType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
-  
+
   // Vector sizes are not potentially evaluated contexts
   EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
 
   Sema::OwningExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
   if (Size.isInvalid())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType() &&
       Size.get() == T->getSizeExpr()) {
     Size.take();
     return QualType(T, 0);
   }
-  
-  return getDerived().RebuildDependentSizedExtVectorType(ElementType, 
+
+  return getDerived().RebuildDependentSizedExtVectorType(ElementType,
                                                          move(Size),
                                                          T->getAttributeLoc());
 }
-  
-template<typename Derived> 
-QualType TreeTransform<Derived>::TransformVectorType(const VectorType *T) { 
+
+template<typename Derived>
+QualType TreeTransform<Derived>::TransformVectorType(const VectorType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
@@ -2233,80 +2232,80 @@
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildVectorType(ElementType, T->getNumElements());
 }
-  
-template<typename Derived> 
-QualType 
-TreeTransform<Derived>::TransformExtVectorType(const ExtVectorType *T) { 
+
+template<typename Derived>
+QualType
+TreeTransform<Derived>::TransformExtVectorType(const ExtVectorType *T) {
   QualType ElementType = getDerived().TransformType(T->getElementType());
   if (ElementType.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ElementType == T->getElementType())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildExtVectorType(ElementType, T->getNumElements(),
                                            /*FIXME*/SourceLocation());
 }
 
-template<typename Derived> 
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformFunctionProtoType(
-                                                  const FunctionProtoType *T) { 
+                                                  const FunctionProtoType *T) {
   QualType ResultType = getDerived().TransformType(T->getResultType());
   if (ResultType.isNull())
     return QualType();
-  
+
   llvm::SmallVector<QualType, 4> ParamTypes;
   for (FunctionProtoType::arg_type_iterator Param = T->arg_type_begin(),
-                                         ParamEnd = T->arg_type_end(); 
+                                         ParamEnd = T->arg_type_end();
        Param != ParamEnd; ++Param) {
     QualType P = getDerived().TransformType(*Param);
     if (P.isNull())
       return QualType();
-    
+
     ParamTypes.push_back(P);
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ResultType == T->getResultType() &&
       std::equal(T->arg_type_begin(), T->arg_type_end(), ParamTypes.begin()))
     return QualType(T, 0);
-  
-  return getDerived().RebuildFunctionProtoType(ResultType, ParamTypes.data(), 
+
+  return getDerived().RebuildFunctionProtoType(ResultType, ParamTypes.data(),
                                                ParamTypes.size(), T->isVariadic(),
                                                T->getTypeQuals());
 }
-  
+
 template<typename Derived>
 QualType TreeTransform<Derived>::TransformFunctionNoProtoType(
-                                                const FunctionNoProtoType *T) { 
+                                                const FunctionNoProtoType *T) {
   // FIXME: Implement
-  return QualType(T, 0); 
+  return QualType(T, 0);
 }
-  
+
 template<typename Derived>
-QualType TreeTransform<Derived>::TransformTypedefType(const TypedefType *T) { 
+QualType TreeTransform<Derived>::TransformTypedefType(const TypedefType *T) {
   TypedefDecl *Typedef
     = cast_or_null<TypedefDecl>(getDerived().TransformDecl(T->getDecl()));
   if (!Typedef)
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Typedef == T->getDecl())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildTypedefType(Typedef);
 }
-  
+
 template<typename Derived>
 QualType TreeTransform<Derived>::TransformTypeOfExprType(
-                                                    const TypeOfExprType *T) { 
+                                                    const TypeOfExprType *T) {
   // typeof expressions are not potentially evaluated contexts
   EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
-  
+
   Sema::OwningExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
   if (E.isInvalid())
     return QualType();
@@ -2316,66 +2315,66 @@
     E.take();
     return QualType(T, 0);
   }
-  
+
   return getDerived().RebuildTypeOfExprType(move(E));
 }
-  
-template<typename Derived> 
-QualType TreeTransform<Derived>::TransformTypeOfType(const TypeOfType *T) { 
+
+template<typename Derived>
+QualType TreeTransform<Derived>::TransformTypeOfType(const TypeOfType *T) {
   QualType Underlying = getDerived().TransformType(T->getUnderlyingType());
   if (Underlying.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Underlying == T->getUnderlyingType())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildTypeOfType(Underlying);
 }
-  
-template<typename Derived> 
-QualType TreeTransform<Derived>::TransformDecltypeType(const DecltypeType *T) { 
+
+template<typename Derived>
+QualType TreeTransform<Derived>::TransformDecltypeType(const DecltypeType *T) {
   // decltype expressions are not potentially evaluated contexts
   EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
-  
+
   Sema::OwningExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
   if (E.isInvalid())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       E.get() == T->getUnderlyingExpr()) {
     E.take();
     return QualType(T, 0);
   }
-  
+
   return getDerived().RebuildDecltypeType(move(E));
 }
 
 template<typename Derived>
-QualType TreeTransform<Derived>::TransformRecordType(const RecordType *T) { 
+QualType TreeTransform<Derived>::TransformRecordType(const RecordType *T) {
   RecordDecl *Record
   = cast_or_null<RecordDecl>(getDerived().TransformDecl(T->getDecl()));
   if (!Record)
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Record == T->getDecl())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildRecordType(Record);
 }
-  
-template<typename Derived> 
-QualType TreeTransform<Derived>::TransformEnumType(const EnumType *T) { 
+
+template<typename Derived>
+QualType TreeTransform<Derived>::TransformEnumType(const EnumType *T) {
   EnumDecl *Enum
   = cast_or_null<EnumDecl>(getDerived().TransformDecl(T->getDecl()));
   if (!Enum)
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Enum == T->getDecl())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildEnumType(Enum);
 }
 
@@ -2385,30 +2384,30 @@
   QualType Underlying = getDerived().TransformType(T->getUnderlyingType());
   if (Underlying.isNull())
     return QualType();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Underlying == T->getUnderlyingType())
     return QualType(T, 0);
-  
+
   return getDerived().RebuildElaboratedType(Underlying, T->getTagKind());
 }
-                                                 
-  
+
+
 template<typename Derived>
 QualType TreeTransform<Derived>::TransformTemplateTypeParmType(
-                                              const TemplateTypeParmType *T) { 
+                                              const TemplateTypeParmType *T) {
   // Nothing to do
-  return QualType(T, 0); 
+  return QualType(T, 0);
 }
 
-template<typename Derived> 
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformTemplateSpecializationType(
-                                        const TemplateSpecializationType *T) { 
-  TemplateName Template 
+                                        const TemplateSpecializationType *T) {
+  TemplateName Template
     = getDerived().TransformTemplateName(T->getTemplateName());
   if (Template.isNull())
     return QualType();
-  
+
   llvm::SmallVector<TemplateArgument, 4> NewTemplateArgs;
   NewTemplateArgs.reserve(T->getNumArgs());
   for (TemplateSpecializationType::iterator Arg = T->begin(), ArgEnd = T->end();
@@ -2416,20 +2415,20 @@
     TemplateArgument NewArg = getDerived().TransformTemplateArgument(*Arg);
     if (NewArg.isNull())
       return QualType();
-    
+
     NewTemplateArgs.push_back(NewArg);
   }
-  
+
   // FIXME: early abort if all of the template arguments and such are the
   // same.
-  
+
   // FIXME: We're missing the locations of the template name, '<', and '>'.
   return getDerived().RebuildTemplateSpecializationType(Template,
                                                         NewTemplateArgs.data(),
                                                         NewTemplateArgs.size());
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformQualifiedNameType(
                                                   const QualifiedNameType *T) {
   NestedNameSpecifier *NNS
@@ -2437,11 +2436,11 @@
                                                 SourceRange());
   if (!NNS)
     return QualType();
-  
+
   QualType Named = getDerived().TransformType(T->getNamedType());
   if (Named.isNull())
     return QualType();
-                      
+
   if (!getDerived().AlwaysRebuild() &&
       NNS == T->getQualifier() &&
       Named == T->getNamedType())
@@ -2449,44 +2448,44 @@
 
   return getDerived().RebuildQualifiedNameType(NNS, Named);
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformTypenameType(const TypenameType *T) {
   NestedNameSpecifier *NNS
     = getDerived().TransformNestedNameSpecifier(T->getQualifier(),
                         SourceRange(/*FIXME:*/getDerived().getBaseLocation()));
   if (!NNS)
     return QualType();
-  
+
   if (const TemplateSpecializationType *TemplateId = T->getTemplateId()) {
-    QualType NewTemplateId 
+    QualType NewTemplateId
       = getDerived().TransformType(QualType(TemplateId, 0));
     if (NewTemplateId.isNull())
       return QualType();
-    
+
     if (!getDerived().AlwaysRebuild() &&
         NNS == T->getQualifier() &&
         NewTemplateId == QualType(TemplateId, 0))
       return QualType(T, 0);
-    
+
     return getDerived().RebuildTypenameType(NNS, NewTemplateId);
   }
 
   return getDerived().RebuildTypenameType(NNS, T->getIdentifier());
 }
-  
+
 template<typename Derived>
 QualType TreeTransform<Derived>::TransformObjCInterfaceType(
-                                                  const ObjCInterfaceType *T) { 
+                                                  const ObjCInterfaceType *T) {
   // FIXME: Implement
-  return QualType(T, 0); 
+  return QualType(T, 0);
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 QualType TreeTransform<Derived>::TransformObjCObjectPointerType(
-                                             const ObjCObjectPointerType *T) { 
+                                             const ObjCObjectPointerType *T) {
   // FIXME: Implement
-  return QualType(T, 0); 
+  return QualType(T, 0);
 }
 
 //===----------------------------------------------------------------------===//
@@ -2494,8 +2493,8 @@
 //===----------------------------------------------------------------------===//
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformNullStmt(NullStmt *S) { 
-  return SemaRef.Owned(S->Retain()); 
+TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
+  return SemaRef.Owned(S->Retain());
 }
 
 template<typename Derived>
@@ -2506,7 +2505,7 @@
 
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S, 
+TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S,
                                               bool IsStmtExpr) {
   bool SubStmtChanged = false;
   ASTOwningVector<&ActionBase::DeleteStmt> Statements(getSema());
@@ -2515,37 +2514,37 @@
     OwningStmtResult Result = getDerived().TransformStmt(*B);
     if (Result.isInvalid())
       return getSema().StmtError();
-    
+
     SubStmtChanged = SubStmtChanged || Result.get() != *B;
     Statements.push_back(Result.takeAs<Stmt>());
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       !SubStmtChanged)
-    return SemaRef.Owned(S->Retain()); 
+    return SemaRef.Owned(S->Retain());
 
   return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
                                           move_arg(Statements),
                                           S->getRBracLoc(),
                                           IsStmtExpr);
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) { 
+TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
   // The case value expressions are not potentially evaluated.
   EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
-  
+
   // Transform the left-hand case value.
   OwningExprResult LHS = getDerived().TransformExpr(S->getLHS());
   if (LHS.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the right-hand case value (for the GNU case-range extension).
   OwningExprResult RHS = getDerived().TransformExpr(S->getRHS());
   if (RHS.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Build the case statement.
   // Case statements are always rebuilt so that they will attached to their
   // transformed switch statement.
@@ -2556,118 +2555,118 @@
                                                        S->getColonLoc());
   if (Case.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the statement following the case
   OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
   if (SubStmt.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Attach the body to the case statement
   return getDerived().RebuildCaseStmtBody(move(Case), move(SubStmt));
 }
 
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) { 
+TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
   // Transform the statement following the default case
   OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
   if (SubStmt.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Default statements are always rebuilt
   return getDerived().RebuildDefaultStmt(S->getDefaultLoc(), S->getColonLoc(),
                                          move(SubStmt));
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S) { 
+TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S) {
   OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
   if (SubStmt.isInvalid())
     return SemaRef.StmtError();
-  
+
   // FIXME: Pass the real colon location in.
   SourceLocation ColonLoc = SemaRef.PP.getLocForEndOfToken(S->getIdentLoc());
   return getDerived().RebuildLabelStmt(S->getIdentLoc(), S->getID(), ColonLoc,
                                        move(SubStmt));
 }
-  
+
 template<typename Derived>
-Sema::OwningStmtResult 
-TreeTransform<Derived>::TransformIfStmt(IfStmt *S) { 
+Sema::OwningStmtResult
+TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
   // Transform the condition
   OwningExprResult Cond = getDerived().TransformExpr(S->getCond());
   if (Cond.isInvalid())
     return SemaRef.StmtError();
-  
+
   Sema::FullExprArg FullCond(getSema().FullExpr(Cond));
-  
+
   // Transform the "then" branch.
   OwningStmtResult Then = getDerived().TransformStmt(S->getThen());
   if (Then.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the "else" branch.
   OwningStmtResult Else = getDerived().TransformStmt(S->getElse());
   if (Else.isInvalid())
     return SemaRef.StmtError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       FullCond->get() == S->getCond() &&
       Then.get() == S->getThen() &&
       Else.get() == S->getElse())
-    return SemaRef.Owned(S->Retain()); 
-  
+    return SemaRef.Owned(S->Retain());
+
   return getDerived().RebuildIfStmt(S->getIfLoc(), FullCond, move(Then),
-                                    S->getElseLoc(), move(Else));  
+                                    S->getElseLoc(), move(Else));
 }
 
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) { 
+TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
   // Transform the condition.
   OwningExprResult Cond = getDerived().TransformExpr(S->getCond());
   if (Cond.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Rebuild the switch statement.
   OwningStmtResult Switch = getDerived().RebuildSwitchStmtStart(move(Cond));
   if (Switch.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the body of the switch statement.
   OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
   if (Body.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Complete the switch statement.
   return getDerived().RebuildSwitchStmtBody(S->getSwitchLoc(), move(Switch),
                                             move(Body));
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) { 
+TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
   // Transform the condition
   OwningExprResult Cond = getDerived().TransformExpr(S->getCond());
   if (Cond.isInvalid())
     return SemaRef.StmtError();
-  
+
   Sema::FullExprArg FullCond(getSema().FullExpr(Cond));
-  
+
   // Transform the body
   OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
   if (Body.isInvalid())
     return SemaRef.StmtError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       FullCond->get() == S->getCond() &&
       Body.get() == S->getBody())
-    return SemaRef.Owned(S->Retain()); 
-  
+    return SemaRef.Owned(S->Retain());
+
   return getDerived().RebuildWhileStmt(S->getWhileLoc(), FullCond, move(Body));
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
 TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
@@ -2675,75 +2674,75 @@
   OwningExprResult Cond = getDerived().TransformExpr(S->getCond());
   if (Cond.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the body
   OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
   if (Body.isInvalid())
     return SemaRef.StmtError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Cond.get() == S->getCond() &&
       Body.get() == S->getBody())
-    return SemaRef.Owned(S->Retain()); 
-  
+    return SemaRef.Owned(S->Retain());
+
   return getDerived().RebuildDoStmt(S->getDoLoc(), move(Body), S->getWhileLoc(),
                                     /*FIXME:*/S->getWhileLoc(), move(Cond),
                                     S->getRParenLoc());
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformForStmt(ForStmt *S) { 
+TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
   // Transform the initialization statement
   OwningStmtResult Init = getDerived().TransformStmt(S->getInit());
   if (Init.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the condition
   OwningExprResult Cond = getDerived().TransformExpr(S->getCond());
   if (Cond.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the increment
   OwningExprResult Inc = getDerived().TransformExpr(S->getInc());
   if (Inc.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the body
   OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
   if (Body.isInvalid())
     return SemaRef.StmtError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Init.get() == S->getInit() &&
       Cond.get() == S->getCond() &&
       Inc.get() == S->getInc() &&
       Body.get() == S->getBody())
-    return SemaRef.Owned(S->Retain()); 
-  
+    return SemaRef.Owned(S->Retain());
+
   return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
                                      move(Init), move(Cond), move(Inc),
                                      S->getRParenLoc(), move(Body));
 }
 
 template<typename Derived>
-Sema::OwningStmtResult 
-TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) { 
+Sema::OwningStmtResult
+TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
   // Goto statements must always be rebuilt, to resolve the label.
-  return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(), 
+  return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
                                       S->getLabel());
 }
 
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) { 
+TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
   OwningExprResult Target = getDerived().TransformExpr(S->getTarget());
   if (Target.isInvalid())
     return SemaRef.StmtError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Target.get() == S->getTarget())
-    return SemaRef.Owned(S->Retain()); 
+    return SemaRef.Owned(S->Retain());
 
   return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
                                               move(Target));
@@ -2751,31 +2750,31 @@
 
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) { 
-  return SemaRef.Owned(S->Retain()); 
+TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
+  return SemaRef.Owned(S->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) { 
-  return SemaRef.Owned(S->Retain()); 
+TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
+  return SemaRef.Owned(S->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) { 
+TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
   Sema::OwningExprResult Result = getDerived().TransformExpr(S->getRetValue());
   if (Result.isInvalid())
     return SemaRef.StmtError();
 
-  // FIXME: We always rebuild the return statement because there is no way 
+  // FIXME: We always rebuild the return statement because there is no way
   // to tell whether the return type of the function has changed.
   return getDerived().RebuildReturnStmt(S->getReturnLoc(), move(Result));
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) { 
+TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
   bool DeclChanged = false;
   llvm::SmallVector<Decl *, 4> Decls;
   for (DeclStmt::decl_iterator D = S->decl_begin(), DEnd = S->decl_end();
@@ -2783,25 +2782,25 @@
     Decl *Transformed = getDerived().TransformDefinition(*D);
     if (!Transformed)
       return SemaRef.StmtError();
-        
+
     if (Transformed != *D)
       DeclChanged = true;
-    
+
     Decls.push_back(Transformed);
   }
-  
+
   if (!getDerived().AlwaysRebuild() && !DeclChanged)
-    return SemaRef.Owned(S->Retain()); 
-  
-  return getDerived().RebuildDeclStmt(Decls.data(), Decls.size(), 
+    return SemaRef.Owned(S->Retain());
+
+  return getDerived().RebuildDeclStmt(Decls.data(), Decls.size(),
                                       S->getStartLoc(), S->getEndLoc());
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformSwitchCase(SwitchCase *S) { 
+TreeTransform<Derived>::TransformSwitchCase(SwitchCase *S) {
   assert(false && "SwitchCase is abstract and cannot be transformed");
-  return SemaRef.Owned(S->Retain()); 
+  return SemaRef.Owned(S->Retain());
 }
 
 template<typename Derived>
@@ -2809,58 +2808,58 @@
 TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) {
   // FIXME: Implement!
   assert(false && "Inline assembly cannot be transformed");
-  return SemaRef.Owned(S->Retain()); 
+  return SemaRef.Owned(S->Retain());
 }
 
 
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) { 
+TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
   // FIXME: Implement this
   assert(false && "Cannot transform an Objective-C @try statement");
-  return SemaRef.Owned(S->Retain()); 
+  return SemaRef.Owned(S->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) { 
+TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
   // FIXME: Implement this
   assert(false && "Cannot transform an Objective-C @catch statement");
   return SemaRef.Owned(S->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { 
+TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
   // FIXME: Implement this
   assert(false && "Cannot transform an Objective-C @finally statement");
-  return SemaRef.Owned(S->Retain()); 
+  return SemaRef.Owned(S->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
-TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) { 
+TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
   // FIXME: Implement this
   assert(false && "Cannot transform an Objective-C @throw statement");
-  return SemaRef.Owned(S->Retain()); 
+  return SemaRef.Owned(S->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
 TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
-                                                  ObjCAtSynchronizedStmt *S) { 
+                                                  ObjCAtSynchronizedStmt *S) {
   // FIXME: Implement this
   assert(false && "Cannot transform an Objective-C @synchronized statement");
-  return SemaRef.Owned(S->Retain()); 
+  return SemaRef.Owned(S->Retain());
 }
 
 template<typename Derived>
 Sema::OwningStmtResult
 TreeTransform<Derived>::TransformObjCForCollectionStmt(
-                                                  ObjCForCollectionStmt *S) { 
+                                                  ObjCForCollectionStmt *S) {
   // FIXME: Implement this
   assert(false && "Cannot transform an Objective-C for-each statement");
-  return SemaRef.Owned(S->Retain()); 
+  return SemaRef.Owned(S->Retain());
 }
 
 
@@ -2877,7 +2876,7 @@
     QualType T = getDerived().TransformType(ExceptionDecl->getType());
     if (T.isNull())
       return SemaRef.StmtError();
-    
+
     Var = getDerived().RebuildExceptionDecl(ExceptionDecl,
                                             T,
                                             ExceptionDecl->getDeclaratorInfo(),
@@ -2891,7 +2890,7 @@
       return SemaRef.StmtError();
     }
   }
-  
+
   // Transform the actual exception handler.
   OwningStmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
   if (Handler.isInvalid()) {
@@ -2899,191 +2898,191 @@
       Var->Destroy(SemaRef.Context);
     return SemaRef.StmtError();
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       !Var &&
       Handler.get() == S->getHandlerBlock())
-    return SemaRef.Owned(S->Retain()); 
+    return SemaRef.Owned(S->Retain());
 
   return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(),
                                           Var,
                                           move(Handler));
 }
-  
+
 template<typename Derived>
 Sema::OwningStmtResult
 TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
   // Transform the try block itself.
-  OwningStmtResult TryBlock 
+  OwningStmtResult TryBlock
     = getDerived().TransformCompoundStmt(S->getTryBlock());
   if (TryBlock.isInvalid())
     return SemaRef.StmtError();
-  
+
   // Transform the handlers.
   bool HandlerChanged = false;
   ASTOwningVector<&ActionBase::DeleteStmt> Handlers(SemaRef);
   for (unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
-    OwningStmtResult Handler 
+    OwningStmtResult Handler
       = getDerived().TransformCXXCatchStmt(S->getHandler(I));
     if (Handler.isInvalid())
       return SemaRef.StmtError();
-    
+
     HandlerChanged = HandlerChanged || Handler.get() != S->getHandler(I);
     Handlers.push_back(Handler.takeAs<Stmt>());
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       TryBlock.get() == S->getTryBlock() &&
       !HandlerChanged)
-    return SemaRef.Owned(S->Retain()); 
+    return SemaRef.Owned(S->Retain());
 
   return getDerived().RebuildCXXTryStmt(S->getTryLoc(), move(TryBlock),
-                                        move_arg(Handlers));  
+                                        move_arg(Handlers));
 }
-  
+
 //===----------------------------------------------------------------------===//
 // Expression transformation
 //===----------------------------------------------------------------------===//
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *E) { 
-  return SemaRef.Owned(E->Retain()); 
-}
-  
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) { 
-  NamedDecl *ND 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *E) {
+  return SemaRef.Owned(E->Retain());
+}
+
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
+  NamedDecl *ND
     = dyn_cast_or_null<NamedDecl>(getDerived().TransformDecl(E->getDecl()));
   if (!ND)
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() && ND == E->getDecl())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildDeclRefExpr(ND, E->getLocation());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *E) { 
-  return SemaRef.Owned(E->Retain()); 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *E) {
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *E) { 
-  return SemaRef.Owned(E->Retain()); 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *E) {
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *E) { 
-  return SemaRef.Owned(E->Retain()); 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *E) {
+  return SemaRef.Owned(E->Retain());
 }
-  
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformStringLiteral(StringLiteral *E) { 
-  return SemaRef.Owned(E->Retain()); 
+
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformStringLiteral(StringLiteral *E) {
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) { 
-  return SemaRef.Owned(E->Retain()); 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) {
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) { 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) {
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
-    return SemaRef.Owned(E->Retain()); 
-  
-  return getDerived().RebuildParenExpr(move(SubExpr), E->getLParen(), 
+    return SemaRef.Owned(E->Retain());
+
+  return getDerived().RebuildParenExpr(move(SubExpr), E->getLParen(),
                                        E->getRParen());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformUnaryOperator(UnaryOperator *E) { 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformUnaryOperator(UnaryOperator *E) {
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildUnaryOperator(E->getOperatorLoc(),
                                            E->getOpcode(),
                                            move(SubExpr));
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
   if (E->isArgumentType()) {
     QualType T = getDerived().TransformType(E->getArgumentType());
     if (T.isNull())
       return SemaRef.ExprError();
-    
+
     if (!getDerived().AlwaysRebuild() && T == E->getArgumentType())
       return SemaRef.Owned(E->Retain());
-    
-    return getDerived().RebuildSizeOfAlignOf(T, E->getOperatorLoc(), 
-                                             E->isSizeOf(), 
+
+    return getDerived().RebuildSizeOfAlignOf(T, E->getOperatorLoc(),
+                                             E->isSizeOf(),
                                              E->getSourceRange());
   }
-  
+
   Sema::OwningExprResult SubExpr(SemaRef);
-  {   
+  {
     // C++0x [expr.sizeof]p1:
     //   The operand is either an expression, which is an unevaluated operand
     //   [...]
     EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
-    
+
     SubExpr = getDerived().TransformExpr(E->getArgumentExpr());
     if (SubExpr.isInvalid())
       return SemaRef.ExprError();
-    
+
     if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
       return SemaRef.Owned(E->Retain());
   }
-  
+
   return getDerived().RebuildSizeOfAlignOf(move(SubExpr), E->getOperatorLoc(),
                                            E->isSizeOf(),
                                            E->getSourceRange());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) {
   OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
   if (LHS.isInvalid())
     return SemaRef.ExprError();
-  
+
   OwningExprResult RHS = getDerived().TransformExpr(E->getRHS());
   if (RHS.isInvalid())
     return SemaRef.ExprError();
-  
-  
+
+
   if (!getDerived().AlwaysRebuild() &&
       LHS.get() == E->getLHS() &&
       RHS.get() == E->getRHS())
     return SemaRef.Owned(E->Retain());
-  
+
   return getDerived().RebuildArraySubscriptExpr(move(LHS),
                                            /*FIXME:*/E->getLHS()->getLocStart(),
                                                 move(RHS),
                                                 E->getRBracketLoc());
 }
-  
-template<typename Derived> 
-Sema::OwningExprResult 
+
+template<typename Derived>
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformCallExpr(CallExpr *E) {
   // Transform the callee.
   OwningExprResult Callee = getDerived().TransformExpr(E->getCallee());
@@ -3098,55 +3097,55 @@
     OwningExprResult Arg = getDerived().TransformExpr(E->getArg(I));
     if (Arg.isInvalid())
       return SemaRef.ExprError();
-    
+
     // FIXME: Wrong source location information for the ','.
     FakeCommaLocs.push_back(
        SemaRef.PP.getLocForEndOfToken(E->getArg(I)->getSourceRange().getEnd()));
-    
-    ArgChanged = ArgChanged || Arg.get() != E->getArg(I);   
+
+    ArgChanged = ArgChanged || Arg.get() != E->getArg(I);
     Args.push_back(Arg.takeAs<Expr>());
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Callee.get() == E->getCallee() &&
       !ArgChanged)
     return SemaRef.Owned(E->Retain());
-  
+
   // FIXME: Wrong source location information for the '('.
-  SourceLocation FakeLParenLoc 
+  SourceLocation FakeLParenLoc
     = ((Expr *)Callee.get())->getSourceRange().getBegin();
   return getDerived().RebuildCallExpr(move(Callee), FakeLParenLoc,
                                       move_arg(Args),
                                       FakeCommaLocs.data(),
                                       E->getRParenLoc());
 }
-  
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) { 
+
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
   OwningExprResult Base = getDerived().TransformExpr(E->getBase());
   if (Base.isInvalid())
     return SemaRef.ExprError();
-  
+
   NestedNameSpecifier *Qualifier = 0;
   if (E->hasQualifier()) {
-    Qualifier 
+    Qualifier
       = getDerived().TransformNestedNameSpecifier(E->getQualifier(),
                                                   E->getQualifierRange());
     if (Qualifier == 0)
       return SemaRef.ExprError();
   }
-  
-  NamedDecl *Member 
+
+  NamedDecl *Member
     = cast_or_null<NamedDecl>(getDerived().TransformDecl(E->getMemberDecl()));
   if (!Member)
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Base.get() == E->getBase() &&
       Qualifier == E->getQualifier() &&
       Member == E->getMemberDecl())
-    return SemaRef.Owned(E->Retain()); 
+    return SemaRef.Owned(E->Retain());
 
   // FIXME: Bogus source location for the operator
   SourceLocation FakeOperatorLoc
@@ -3157,208 +3156,208 @@
                                         Qualifier,
                                         E->getQualifierRange(),
                                         E->getMemberLoc(),
-                                        Member);                                        
+                                        Member);
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformCastExpr(CastExpr *E) { 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformCastExpr(CastExpr *E) {
   assert(false && "Cannot transform abstract class");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) { 
+TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) {
   OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
   if (LHS.isInvalid())
     return SemaRef.ExprError();
-  
+
   OwningExprResult RHS = getDerived().TransformExpr(E->getRHS());
   if (RHS.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       LHS.get() == E->getLHS() &&
       RHS.get() == E->getRHS())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(),
                                             move(LHS), move(RHS));
 }
 
-template<typename Derived> 
+template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCompoundAssignOperator(
                                                   CompoundAssignOperator *E) {
   return getDerived().TransformBinaryOperator(E);
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) { 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) {
   OwningExprResult Cond = getDerived().TransformExpr(E->getCond());
   if (Cond.isInvalid())
     return SemaRef.ExprError();
-  
+
   OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
   if (LHS.isInvalid())
     return SemaRef.ExprError();
-  
+
   OwningExprResult RHS = getDerived().TransformExpr(E->getRHS());
   if (RHS.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Cond.get() == E->getCond() &&
       LHS.get() == E->getLHS() &&
       RHS.get() == E->getRHS())
     return SemaRef.Owned(E->Retain());
-  
-  return getDerived().RebuildConditionalOperator(move(Cond), 
+
+  return getDerived().RebuildConditionalOperator(move(Cond),
                                                  E->getQuestionLoc(),
-                                                 move(LHS), 
+                                                 move(LHS),
                                                  E->getColonLoc(),
                                                  move(RHS));
 }
-  
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *E) { 
+
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *E) {
   QualType T = getDerived().TransformType(E->getType());
   if (T.isNull())
     return SemaRef.ExprError();
-  
+
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getType() &&
       SubExpr.get() == E->getSubExpr())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildImplicitCastExpr(T, E->getCastKind(),
-                                              move(SubExpr), 
+                                              move(SubExpr),
                                               E->isLvalueCast());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformExplicitCastExpr(ExplicitCastExpr *E) { 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformExplicitCastExpr(ExplicitCastExpr *E) {
   assert(false && "Cannot transform abstract class");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) { 
+TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) {
   QualType T;
   {
     // FIXME: Source location isn't quite accurate.
-    SourceLocation TypeStartLoc 
+    SourceLocation TypeStartLoc
       = SemaRef.PP.getLocForEndOfToken(E->getLParenLoc());
     TemporaryBase Rebase(*this, TypeStartLoc, DeclarationName());
-    
+
     T = getDerived().TransformType(E->getTypeAsWritten());
     if (T.isNull())
       return SemaRef.ExprError();
   }
-  
+
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getTypeAsWritten() &&
       SubExpr.get() == E->getSubExpr())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildCStyleCaseExpr(E->getLParenLoc(), T,
                                             E->getRParenLoc(),
                                             move(SubExpr));
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) {
   QualType T;
   {
     // FIXME: Source location isn't quite accurate.
-    SourceLocation FakeTypeLoc 
+    SourceLocation FakeTypeLoc
       = SemaRef.PP.getLocForEndOfToken(E->getLParenLoc());
     TemporaryBase Rebase(*this, FakeTypeLoc, DeclarationName());
-    
+
     T = getDerived().TransformType(E->getType());
     if (T.isNull())
       return SemaRef.ExprError();
   }
-  
+
   OwningExprResult Init = getDerived().TransformExpr(E->getInitializer());
   if (Init.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getType() &&
       Init.get() == E->getInitializer())
-    return SemaRef.Owned(E->Retain()); 
+    return SemaRef.Owned(E->Retain());
 
   return getDerived().RebuildCompoundLiteralExpr(E->getLParenLoc(), T,
                                    /*FIXME:*/E->getInitializer()->getLocEnd(),
                                                  move(Init));
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) { 
+TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) {
   OwningExprResult Base = getDerived().TransformExpr(E->getBase());
   if (Base.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Base.get() == E->getBase())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   // FIXME: Bad source location
-  SourceLocation FakeOperatorLoc 
+  SourceLocation FakeOperatorLoc
     = SemaRef.PP.getLocForEndOfToken(E->getBase()->getLocEnd());
   return getDerived().RebuildExtVectorElementExpr(move(Base), FakeOperatorLoc,
                                                   E->getAccessorLoc(),
                                                   E->getAccessor());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) { 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) {
   bool InitChanged = false;
-  
+
   ASTOwningVector<&ActionBase::DeleteExpr, 4> Inits(SemaRef);
   for (unsigned I = 0, N = E->getNumInits(); I != N; ++I) {
     OwningExprResult Init = getDerived().TransformExpr(E->getInit(I));
     if (Init.isInvalid())
       return SemaRef.ExprError();
-    
+
     InitChanged = InitChanged || Init.get() != E->getInit(I);
     Inits.push_back(Init.takeAs<Expr>());
   }
-  
+
   if (!getDerived().AlwaysRebuild() && !InitChanged)
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildInitList(E->getLBraceLoc(), move_arg(Inits),
                                       E->getRBraceLoc());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) { 
+TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) {
   Designation Desig;
-  
+
   // transform the initializer value
   OwningExprResult Init = getDerived().TransformExpr(E->getInit());
   if (Init.isInvalid())
     return SemaRef.ExprError();
-  
+
   // transform the designators.
   ASTOwningVector<&ActionBase::DeleteExpr, 4> ArrayExprs(SemaRef);
   bool ExprChanged = false;
@@ -3371,73 +3370,73 @@
                                                D->getFieldLoc()));
       continue;
     }
-    
+
     if (D->isArrayDesignator()) {
       OwningExprResult Index = getDerived().TransformExpr(E->getArrayIndex(*D));
       if (Index.isInvalid())
         return SemaRef.ExprError();
-      
-      Desig.AddDesignator(Designator::getArray(Index.get(), 
+
+      Desig.AddDesignator(Designator::getArray(Index.get(),
                                                D->getLBracketLoc()));
-      
+
       ExprChanged = ExprChanged || Init.get() != E->getArrayIndex(*D);
       ArrayExprs.push_back(Index.release());
       continue;
     }
-    
+
     assert(D->isArrayRangeDesignator() && "New kind of designator?");
-    OwningExprResult Start 
+    OwningExprResult Start
       = getDerived().TransformExpr(E->getArrayRangeStart(*D));
     if (Start.isInvalid())
       return SemaRef.ExprError();
-    
+
     OwningExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(*D));
     if (End.isInvalid())
       return SemaRef.ExprError();
-    
-    Desig.AddDesignator(Designator::getArrayRange(Start.get(), 
+
+    Desig.AddDesignator(Designator::getArrayRange(Start.get(),
                                                   End.get(),
                                                   D->getLBracketLoc(),
                                                   D->getEllipsisLoc()));
-    
+
     ExprChanged = ExprChanged || Start.get() != E->getArrayRangeStart(*D) ||
       End.get() != E->getArrayRangeEnd(*D);
-    
+
     ArrayExprs.push_back(Start.release());
     ArrayExprs.push_back(End.release());
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Init.get() == E->getInit() &&
       !ExprChanged)
     return SemaRef.Owned(E->Retain());
-  
+
   return getDerived().RebuildDesignatedInitExpr(Desig, move_arg(ArrayExprs),
                                                 E->getEqualOrColonLoc(),
                                                 E->usesGNUSyntax(), move(Init));
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformImplicitValueInitExpr(
-                                                    ImplicitValueInitExpr *E) { 
+                                                    ImplicitValueInitExpr *E) {
   QualType T = getDerived().TransformType(E->getType());
   if (T.isNull())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getType())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildImplicitValueInitExpr(T);
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *E) {
   // FIXME: Do we want the type as written?
   QualType T;
-  
+
   {
     // FIXME: Source location isn't quite accurate.
     TemporaryBase Rebase(*this, E->getBuiltinLoc(), DeclarationName());
@@ -3445,22 +3444,22 @@
     if (T.isNull())
       return SemaRef.ExprError();
   }
-  
+
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getType() &&
       SubExpr.get() == E->getSubExpr())
     return SemaRef.Owned(E->Retain());
-  
+
   return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), move(SubExpr),
                                        T, E->getRParenLoc());
 }
 
 template<typename Derived>
-Sema::OwningExprResult 
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *E) {
   bool ArgumentChanged = false;
   ASTOwningVector<&ActionBase::DeleteExpr, 4> Inits(SemaRef);
@@ -3468,16 +3467,16 @@
     OwningExprResult Init = getDerived().TransformExpr(E->getExpr(I));
     if (Init.isInvalid())
       return SemaRef.ExprError();
-    
+
     ArgumentChanged = ArgumentChanged || Init.get() != E->getExpr(I);
     Inits.push_back(Init.takeAs<Expr>());
   }
-  
+
   return getDerived().RebuildParenListExpr(E->getLParenLoc(),
                                            move_arg(Inits),
                                            E->getRParenLoc());
 }
-  
+
 /// \brief Transform an address-of-label expression.
 ///
 /// By default, the transformation of an address-of-label expression always
@@ -3485,39 +3484,39 @@
 /// the corresponding label statement by semantic analysis.
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *E) { 
+TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *E) {
   return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
                                            E->getLabel());
 }
-  
-template<typename Derived> 
+
+template<typename Derived>
 Sema::OwningExprResult TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) {
-  OwningStmtResult SubStmt 
+  OwningStmtResult SubStmt
     = getDerived().TransformCompoundStmt(E->getSubStmt(), true);
   if (SubStmt.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       SubStmt.get() == E->getSubStmt())
     return SemaRef.Owned(E->Retain());
-  
-  return getDerived().RebuildStmtExpr(E->getLParenLoc(), 
+
+  return getDerived().RebuildStmtExpr(E->getLParenLoc(),
                                       move(SubStmt),
                                       E->getRParenLoc());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformTypesCompatibleExpr(TypesCompatibleExpr *E) { 
+TreeTransform<Derived>::TransformTypesCompatibleExpr(TypesCompatibleExpr *E) {
   QualType T1, T2;
   {
     // FIXME: Source location isn't quite accurate.
     TemporaryBase Rebase(*this, E->getBuiltinLoc(), DeclarationName());
-    
+
     T1 = getDerived().TransformType(E->getArgType1());
     if (T1.isNull())
       return SemaRef.ExprError();
-    
+
     T2 = getDerived().TransformType(E->getArgType2());
     if (T2.isNull())
       return SemaRef.ExprError();
@@ -3526,42 +3525,42 @@
   if (!getDerived().AlwaysRebuild() &&
       T1 == E->getArgType1() &&
       T2 == E->getArgType2())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildTypesCompatibleExpr(E->getBuiltinLoc(),
                                                  T1, T2, E->getRParenLoc());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) { 
+TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) {
   OwningExprResult Cond = getDerived().TransformExpr(E->getCond());
   if (Cond.isInvalid())
     return SemaRef.ExprError();
-  
+
   OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
   if (LHS.isInvalid())
     return SemaRef.ExprError();
-  
+
   OwningExprResult RHS = getDerived().TransformExpr(E->getRHS());
   if (RHS.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Cond.get() == E->getCond() &&
       LHS.get() == E->getLHS() &&
       RHS.get() == E->getRHS())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
                                         move(Cond), move(LHS), move(RHS),
                                         E->getRParenLoc());
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *E) { 
-  return SemaRef.Owned(E->Retain()); 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *E) {
+  return SemaRef.Owned(E->Retain());
 }
 
 template<typename Derived>
@@ -3570,7 +3569,7 @@
   OwningExprResult Callee = getDerived().TransformExpr(E->getCallee());
   if (Callee.isInvalid())
     return SemaRef.ExprError();
-  
+
   OwningExprResult First = getDerived().TransformExpr(E->getArg(0));
   if (First.isInvalid())
     return SemaRef.ExprError();
@@ -3581,59 +3580,59 @@
     if (Second.isInvalid())
       return SemaRef.ExprError();
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Callee.get() == E->getCallee() &&
       First.get() == E->getArg(0) &&
-      (E->getNumArgs() != 2 || Second.get() == E->getArg(1)))    
-    return SemaRef.Owned(E->Retain()); 
-  
+      (E->getNumArgs() != 2 || Second.get() == E->getArg(1)))
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildCXXOperatorCallExpr(E->getOperator(),
                                                  E->getOperatorLoc(),
-                                                 move(Callee), 
+                                                 move(Callee),
                                                  move(First),
                                                  move(Second));
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *E) { 
+TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *E) {
   return getDerived().TransformCallExpr(E);
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXNamedCastExpr(CXXNamedCastExpr *E) {
   QualType ExplicitTy;
   {
     // FIXME: Source location isn't quite accurate.
-    SourceLocation TypeStartLoc 
+    SourceLocation TypeStartLoc
       = SemaRef.PP.getLocForEndOfToken(E->getOperatorLoc());
     TemporaryBase Rebase(*this, TypeStartLoc, DeclarationName());
-  
+
     ExplicitTy = getDerived().TransformType(E->getTypeAsWritten());
     if (ExplicitTy.isNull())
       return SemaRef.ExprError();
   }
-  
+
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ExplicitTy == E->getTypeAsWritten() &&
       SubExpr.get() == E->getSubExpr())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   // FIXME: Poor source location information here.
-  SourceLocation FakeLAngleLoc 
+  SourceLocation FakeLAngleLoc
     = SemaRef.PP.getLocForEndOfToken(E->getOperatorLoc());
   SourceLocation FakeRAngleLoc = E->getSubExpr()->getSourceRange().getBegin();
   SourceLocation FakeRParenLoc
     = SemaRef.PP.getLocForEndOfToken(
                                   E->getSubExpr()->getSourceRange().getEnd());
   return getDerived().RebuildCXXNamedCastExpr(E->getOperatorLoc(),
-                                              E->getStmtClass(), 
+                                              E->getStmtClass(),
                                               FakeLAngleLoc,
                                               ExplicitTy,
                                               FakeRAngleLoc,
@@ -3641,54 +3640,54 @@
                                               move(SubExpr),
                                               FakeRParenLoc);
 }
-  
+
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) { 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
   return getDerived().TransformCXXNamedCastExpr(E);
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *E) { 
+TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
   return getDerived().TransformCXXNamedCastExpr(E);
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
-                                                CXXReinterpretCastExpr *E) { 
+                                                CXXReinterpretCastExpr *E) {
   return getDerived().TransformCXXNamedCastExpr(E);
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *E) { 
+TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *E) {
   return getDerived().TransformCXXNamedCastExpr(E);
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
-                                                   CXXFunctionalCastExpr *E) { 
+                                                   CXXFunctionalCastExpr *E) {
   QualType ExplicitTy;
   {
     TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName());
-    
+
     ExplicitTy = getDerived().TransformType(E->getTypeAsWritten());
     if (ExplicitTy.isNull())
       return SemaRef.ExprError();
   }
-  
+
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       ExplicitTy == E->getTypeAsWritten() &&
       SubExpr.get() == E->getSubExpr())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   // FIXME: The end of the type's source range is wrong
   return getDerived().RebuildCXXFunctionalCastExpr(
                                   /*FIXME:*/SourceRange(E->getTypeBeginLoc()),
@@ -3697,41 +3696,41 @@
                                                    move(SubExpr),
                                                    E->getRParenLoc());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) { 
+TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
   if (E->isTypeOperand()) {
     TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName());
-    
+
     QualType T = getDerived().TransformType(E->getTypeOperand());
     if (T.isNull())
       return SemaRef.ExprError();
-    
+
     if (!getDerived().AlwaysRebuild() &&
         T == E->getTypeOperand())
       return SemaRef.Owned(E->Retain());
-    
+
     return getDerived().RebuildCXXTypeidExpr(E->getLocStart(),
                                              /*FIXME:*/E->getLocStart(),
                                              T,
                                              E->getLocEnd());
   }
-  
+
   // We don't know whether the expression is potentially evaluated until
   // after we perform semantic analysis, so the expression is potentially
   // potentially evaluated.
-  EnterExpressionEvaluationContext Unevaluated(SemaRef, 
+  EnterExpressionEvaluationContext Unevaluated(SemaRef,
                                       Action::PotentiallyPotentiallyEvaluated);
-  
+
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       SubExpr.get() == E->getExprOperand())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildCXXTypeidExpr(E->getLocStart(),
                                            /*FIXME:*/E->getLocStart(),
                                            move(SubExpr),
@@ -3739,63 +3738,63 @@
 }
 
 template<typename Derived>
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { 
-  return SemaRef.Owned(E->Retain()); 
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
-                                                  CXXNullPtrLiteralExpr *E) { 
-  return SemaRef.Owned(E->Retain()); 
+                                                  CXXNullPtrLiteralExpr *E) {
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
   TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName());
-    
+
   QualType T = getDerived().TransformType(E->getType());
   if (T.isNull())
     return SemaRef.ExprError();
-    
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getType())
     return SemaRef.Owned(E->Retain());
- 
+
   return getDerived().RebuildCXXThisExpr(E->getLocStart(), T);
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) { 
+TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) {
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       SubExpr.get() == E->getSubExpr())
-    return SemaRef.Owned(E->Retain()); 
+    return SemaRef.Owned(E->Retain());
 
   return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), move(SubExpr));
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) { 
-  ParmVarDecl *Param 
+TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
+  ParmVarDecl *Param
     = cast_or_null<ParmVarDecl>(getDerived().TransformDecl(E->getParam()));
   if (!Param)
     return SemaRef.ExprError();
-  
+
   if (getDerived().AlwaysRebuild() &&
       Param == E->getParam())
     return SemaRef.Owned(E->Retain());
-  
+
   return getDerived().RebuildCXXDefaultArgExpr(Param);
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXZeroInitValueExpr(CXXZeroInitValueExpr *E) {
@@ -3804,48 +3803,48 @@
   QualType T = getDerived().TransformType(E->getType());
   if (T.isNull())
     return SemaRef.ExprError();
-    
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getType())
-    return SemaRef.Owned(E->Retain()); 
-  
-  return getDerived().RebuildCXXZeroInitValueExpr(E->getTypeBeginLoc(), 
+    return SemaRef.Owned(E->Retain());
+
+  return getDerived().RebuildCXXZeroInitValueExpr(E->getTypeBeginLoc(),
                                                 /*FIXME:*/E->getTypeBeginLoc(),
                                                   T,
                                                   E->getRParenLoc());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXConditionDeclExpr(CXXConditionDeclExpr *E) {
-  VarDecl *Var 
+  VarDecl *Var
     = cast_or_null<VarDecl>(getDerived().TransformDefinition(E->getVarDecl()));
   if (!Var)
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
-      Var == E->getVarDecl())    
+      Var == E->getVarDecl())
     return SemaRef.Owned(E->Retain());
-  
-  return getDerived().RebuildCXXConditionDeclExpr(E->getStartLoc(), 
+
+  return getDerived().RebuildCXXConditionDeclExpr(E->getStartLoc(),
                                                   /*FIXME:*/E->getStartLoc(),
                                                   Var);
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) { 
+TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
   // Transform the type that we're allocating
   TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName());
   QualType AllocType = getDerived().TransformType(E->getAllocatedType());
   if (AllocType.isNull())
     return SemaRef.ExprError();
-  
+
   // Transform the size of the array we're allocating (if any).
   OwningExprResult ArraySize = getDerived().TransformExpr(E->getArraySize());
   if (ArraySize.isInvalid())
     return SemaRef.ExprError();
-  
+
   // Transform the placement arguments (if any).
   bool ArgumentChanged = false;
   ASTOwningVector<&ActionBase::DeleteExpr> PlacementArgs(SemaRef);
@@ -3853,28 +3852,28 @@
     OwningExprResult Arg = getDerived().TransformExpr(E->getPlacementArg(I));
     if (Arg.isInvalid())
       return SemaRef.ExprError();
-    
+
     ArgumentChanged = ArgumentChanged || Arg.get() != E->getPlacementArg(I);
     PlacementArgs.push_back(Arg.take());
   }
-  
+
   // transform the constructor arguments (if any).
   ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(SemaRef);
   for (unsigned I = 0, N = E->getNumConstructorArgs(); I != N; ++I) {
     OwningExprResult Arg = getDerived().TransformExpr(E->getConstructorArg(I));
     if (Arg.isInvalid())
       return SemaRef.ExprError();
-    
+
     ArgumentChanged = ArgumentChanged || Arg.get() != E->getConstructorArg(I);
     ConstructorArgs.push_back(Arg.take());
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       AllocType == E->getAllocatedType() &&
       ArraySize.get() == E->getArraySize() &&
       !ArgumentChanged)
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildCXXNewExpr(E->getLocStart(),
                                         E->isGlobalNew(),
                                         /*FIXME:*/E->getLocStart(),
@@ -3887,26 +3886,26 @@
                                         move(ArraySize),
                                         /*FIXME:*/E->getLocStart(),
                                         move_arg(ConstructorArgs),
-                                        E->getLocEnd());  
+                                        E->getLocEnd());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) { 
+TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
   OwningExprResult Operand = getDerived().TransformExpr(E->getArgument());
   if (Operand.isInvalid())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
-      Operand.get() == E->getArgument())    
-    return SemaRef.Owned(E->Retain()); 
-  
+      Operand.get() == E->getArgument())
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildCXXDeleteExpr(E->getLocStart(),
                                            E->isGlobalDelete(),
                                            E->isArrayForm(),
                                            move(Operand));
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
@@ -3914,13 +3913,13 @@
   OwningExprResult Base = getDerived().TransformExpr(E->getBase());
   if (Base.isInvalid())
     return SemaRef.ExprError();
-  
+
   NestedNameSpecifier *Qualifier
     = getDerived().TransformNestedNameSpecifier(E->getQualifier(),
                                                 E->getQualifierRange());
   if (E->getQualifier() && !Qualifier)
     return SemaRef.ExprError();
-  
+
   QualType DestroyedType;
   {
     TemporaryBase Rebase(*this, E->getDestroyedTypeLoc(), DeclarationName());
@@ -3928,13 +3927,13 @@
     if (DestroyedType.isNull())
       return SemaRef.ExprError();
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       Base.get() == E->getBase() &&
       Qualifier == E->getQualifier() &&
       DestroyedType == E->getDestroyedType())
     return SemaRef.Owned(E->Retain());
-  
+
   return getDerived().RebuildCXXPseudoDestructorExpr(move(Base),
                                                      E->getOperatorLoc(),
                                                      E->isArrow(),
@@ -3943,39 +3942,39 @@
                                                      Qualifier,
                                                      E->getQualifierRange());
 }
-    
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformUnresolvedFunctionNameExpr(
-                                              UnresolvedFunctionNameExpr *E) { 
+                                              UnresolvedFunctionNameExpr *E) {
   // There is no transformation we can apply to an unresolved function name.
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) { 
+TreeTransform<Derived>::TransformUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
   TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName());
-  
+
   QualType T = getDerived().TransformType(E->getQueriedType());
   if (T.isNull())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getQueriedType())
     return SemaRef.Owned(E->Retain());
-    
+
   // FIXME: Bad location information
   SourceLocation FakeLParenLoc
     = SemaRef.PP.getLocForEndOfToken(E->getLocStart());
-  
-  return getDerived().RebuildUnaryTypeTrait(E->getTrait(), 
+
+  return getDerived().RebuildUnaryTypeTrait(E->getTrait(),
                                             E->getLocStart(),
                                             /*FIXME:*/FakeLParenLoc,
                                             T,
                                             E->getLocEnd());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformQualifiedDeclRefExpr(QualifiedDeclRefExpr *E) {
@@ -3984,45 +3983,45 @@
                                                 E->getQualifierRange());
   if (!NNS)
     return SemaRef.ExprError();
-  
-  NamedDecl *ND 
+
+  NamedDecl *ND
     = dyn_cast_or_null<NamedDecl>(getDerived().TransformDecl(E->getDecl()));
   if (!ND)
     return SemaRef.ExprError();
-  
-  if (!getDerived().AlwaysRebuild() && 
+
+  if (!getDerived().AlwaysRebuild() &&
       NNS == E->getQualifier() &&
       ND == E->getDecl())
-    return SemaRef.Owned(E->Retain()); 
-  
-  return getDerived().RebuildQualifiedDeclRefExpr(NNS, 
+    return SemaRef.Owned(E->Retain());
+
+  return getDerived().RebuildQualifiedDeclRefExpr(NNS,
                                                   E->getQualifierRange(),
                                                   ND,
                                                   E->getLocation(),
                                                   /*FIXME:*/false);
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformUnresolvedDeclRefExpr(
-                                                    UnresolvedDeclRefExpr *E) { 
+                                                    UnresolvedDeclRefExpr *E) {
   NestedNameSpecifier *NNS
   = getDerived().TransformNestedNameSpecifier(E->getQualifier(),
                                               E->getQualifierRange());
   if (!NNS)
     return SemaRef.ExprError();
-  
-  DeclarationName Name 
+
+  DeclarationName Name
     = getDerived().TransformDeclarationName(E->getDeclName(), E->getLocation());
   if (!Name)
     return SemaRef.ExprError();
-  
-  if (!getDerived().AlwaysRebuild() && 
+
+  if (!getDerived().AlwaysRebuild() &&
       NNS == E->getQualifier() &&
       Name == E->getDeclName())
-    return SemaRef.Owned(E->Retain()); 
-  
-  return getDerived().RebuildUnresolvedDeclRefExpr(NNS, 
+    return SemaRef.Owned(E->Retain());
+
+  return getDerived().RebuildUnresolvedDeclRefExpr(NNS,
                                                    E->getQualifierRange(),
                                                    Name,
                                                    E->getLocation(),
@@ -4031,15 +4030,15 @@
 
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformTemplateIdRefExpr(TemplateIdRefExpr *E) { 
-  TemplateName Template 
+TreeTransform<Derived>::TransformTemplateIdRefExpr(TemplateIdRefExpr *E) {
+  TemplateName Template
     = getDerived().TransformTemplateName(E->getTemplateName());
   if (Template.isNull())
     return SemaRef.ExprError();
-  
+
   llvm::SmallVector<TemplateArgument, 4> TransArgs;
   for (unsigned I = 0, N = E->getNumTemplateArgs(); I != N; ++I) {
-    TemplateArgument TransArg 
+    TemplateArgument TransArg
       = getDerived().TransformTemplateArgument(E->getTemplateArgs()[I]);
     if (TransArg.isNull())
       return SemaRef.ExprError();
@@ -4049,8 +4048,8 @@
 
   // FIXME: Would like to avoid rebuilding if nothing changed, but we can't
   // compare template arguments (yet).
-  
-  // FIXME: It's possible that we'll find out now that the template name 
+
+  // FIXME: It's possible that we'll find out now that the template name
   // actually refers to a type, in which case the caller is actually dealing
   // with a functional cast. Give a reasonable error message!
   return getDerived().RebuildTemplateIdExpr(Template, E->getTemplateNameLoc(),
@@ -4062,7 +4061,7 @@
 
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) { 
+TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
   TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName());
 
   QualType T = getDerived().TransformType(E->getType());
@@ -4074,16 +4073,16 @@
                               getDerived().TransformDecl(E->getConstructor()));
   if (!Constructor)
     return SemaRef.ExprError();
-  
+
   bool ArgumentChanged = false;
   ASTOwningVector<&ActionBase::DeleteExpr> Args(SemaRef);
-  for (CXXConstructExpr::arg_iterator Arg = E->arg_begin(), 
+  for (CXXConstructExpr::arg_iterator Arg = E->arg_begin(),
        ArgEnd = E->arg_end();
        Arg != ArgEnd; ++Arg) {
     OwningExprResult TransArg = getDerived().TransformExpr(*Arg);
     if (TransArg.isInvalid())
       return SemaRef.ExprError();
-    
+
     ArgumentChanged = ArgumentChanged || TransArg.get() != *Arg;
     Args.push_back(TransArg.takeAs<Expr>());
   }
@@ -4093,15 +4092,15 @@
       Constructor == E->getConstructor() &&
       !ArgumentChanged)
     return SemaRef.Owned(E->Retain());
-  
+
   return getDerived().RebuildCXXConstructExpr(T, Constructor, E->isElidable(),
                                               move_arg(Args));
 }
-  
+
 /// \brief Transform a C++ temporary-binding expression.
 ///
-/// The transformation of a temporary-binding expression always attempts to 
-/// bind a new temporary variable to its subexpression, even if the 
+/// The transformation of a temporary-binding expression always attempts to
+/// bind a new temporary variable to its subexpression, even if the
 /// subexpression itself did not change, because the temporary variable itself
 /// must be unique.
 template<typename Derived>
@@ -4110,70 +4109,70 @@
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   return SemaRef.MaybeBindToTemporary(SubExpr.takeAs<Expr>());
 }
-  
-/// \brief Transform a C++ expression that contains temporaries that should 
+
+/// \brief Transform a C++ expression that contains temporaries that should
 /// be destroyed after the expression is evaluated.
 ///
-/// The transformation of a full expression always attempts to build a new 
-/// CXXExprWithTemporaries expression, even if the 
+/// The transformation of a full expression always attempts to build a new
+/// CXXExprWithTemporaries expression, even if the
 /// subexpression itself did not change, because it will need to capture the
 /// the new temporary variables introduced in the subexpression.
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXExprWithTemporaries(
-                                                CXXExprWithTemporaries *E) { 
+                                                CXXExprWithTemporaries *E) {
   OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
   if (SubExpr.isInvalid())
     return SemaRef.ExprError();
-  
+
   return SemaRef.Owned(
            SemaRef.MaybeCreateCXXExprWithTemporaries(SubExpr.takeAs<Expr>(),
                                                E->shouldDestroyTemporaries()));
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
-                                                  CXXTemporaryObjectExpr *E) { 
+                                                  CXXTemporaryObjectExpr *E) {
   TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName());
   QualType T = getDerived().TransformType(E->getType());
   if (T.isNull())
     return SemaRef.ExprError();
-  
+
   CXXConstructorDecl *Constructor
     = cast_or_null<CXXConstructorDecl>(
                             getDerived().TransformDecl(E->getConstructor()));
   if (!Constructor)
     return SemaRef.ExprError();
-  
+
   bool ArgumentChanged = false;
   ASTOwningVector<&ActionBase::DeleteExpr> Args(SemaRef);
   Args.reserve(E->getNumArgs());
-  for (CXXTemporaryObjectExpr::arg_iterator Arg = E->arg_begin(), 
+  for (CXXTemporaryObjectExpr::arg_iterator Arg = E->arg_begin(),
                                          ArgEnd = E->arg_end();
        Arg != ArgEnd; ++Arg) {
     OwningExprResult TransArg = getDerived().TransformExpr(*Arg);
     if (TransArg.isInvalid())
       return SemaRef.ExprError();
-    
+
     ArgumentChanged = ArgumentChanged || TransArg.get() != *Arg;
     Args.push_back((Expr *)TransArg.release());
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getType() &&
       Constructor == E->getConstructor() &&
       !ArgumentChanged)
     return SemaRef.Owned(E->Retain());
-  
+
   // FIXME: Bogus location information
   SourceLocation CommaLoc;
   if (Args.size() > 1) {
     Expr *First = (Expr *)Args[0];
-    CommaLoc 
+    CommaLoc
       = SemaRef.PP.getLocForEndOfToken(First->getSourceRange().getEnd());
   }
   return getDerived().RebuildCXXTemporaryObjectExpr(E->getTypeBeginLoc(),
@@ -4183,16 +4182,16 @@
                                                     &CommaLoc,
                                                     E->getLocEnd());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXUnresolvedConstructExpr(
-                                            CXXUnresolvedConstructExpr *E) { 
+                                            CXXUnresolvedConstructExpr *E) {
   TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName());
   QualType T = getDerived().TransformType(E->getTypeAsWritten());
   if (T.isNull())
     return SemaRef.ExprError();
-  
+
   bool ArgumentChanged = false;
   ASTOwningVector<&ActionBase::DeleteExpr> Args(SemaRef);
   llvm::SmallVector<SourceLocation, 8> FakeCommaLocs;
@@ -4202,18 +4201,18 @@
     OwningExprResult TransArg = getDerived().TransformExpr(*Arg);
     if (TransArg.isInvalid())
       return SemaRef.ExprError();
-    
+
     ArgumentChanged = ArgumentChanged || TransArg.get() != *Arg;
     FakeCommaLocs.push_back(
                         SemaRef.PP.getLocForEndOfToken((*Arg)->getLocEnd()));
     Args.push_back(TransArg.takeAs<Expr>());
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       T == E->getTypeAsWritten() &&
       !ArgumentChanged)
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   // FIXME: we're faking the locations of the commas
   return getDerived().RebuildCXXUnresolvedConstructExpr(E->getTypeBeginLoc(),
                                                         T,
@@ -4222,31 +4221,31 @@
                                                         FakeCommaLocs.data(),
                                                         E->getRParenLoc());
 }
- 
+
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCXXUnresolvedMemberExpr(
-                                                  CXXUnresolvedMemberExpr *E) { 
+                                                  CXXUnresolvedMemberExpr *E) {
   // Transform the base of the expression.
   OwningExprResult Base = getDerived().TransformExpr(E->getBase());
   if (Base.isInvalid())
     return SemaRef.ExprError();
-  
+
   Sema::TypeTy *ObjectType = 0;
-  Base = SemaRef.ActOnStartCXXMemberReference(0, move(Base), 
+  Base = SemaRef.ActOnStartCXXMemberReference(0, move(Base),
                                               E->getOperatorLoc(),
                                       E->isArrow()? tok::arrow : tok::period,
                                               ObjectType);
   if (Base.isInvalid())
     return SemaRef.ExprError();
-  
+
   // FIXME: The first qualifier found might be a template type parameter,
   // in which case there is no transformed declaration to refer to (it might
   // refer to a built-in type!).
   NamedDecl *FirstQualifierInScope
     = cast_or_null<NamedDecl>(
               getDerived().TransformDecl(E->getFirstQualifierFoundInScope()));
-  
+
   NestedNameSpecifier *Qualifier = 0;
   if (E->getQualifier()) {
     Qualifier = getDerived().TransformNestedNameSpecifier(E->getQualifier(),
@@ -4256,12 +4255,12 @@
     if (!Qualifier)
       return SemaRef.ExprError();
   }
-  
-  DeclarationName Name 
+
+  DeclarationName Name
     = getDerived().TransformDeclarationName(E->getMember(), E->getMemberLoc());
   if (!Name)
     return SemaRef.ExprError();
-  
+
   if (!E->hasExplicitTemplateArgumentList()) {
     // This is a reference to a member without an explicitly-specified
     // template argument list. Optimize for this common case.
@@ -4270,8 +4269,8 @@
         Qualifier == E->getQualifier() &&
         Name == E->getMember() &&
         FirstQualifierInScope == E->getFirstQualifierFoundInScope())
-      return SemaRef.Owned(E->Retain()); 
-    
+      return SemaRef.Owned(E->Retain());
+
     return getDerived().RebuildCXXUnresolvedMemberExpr(move(Base),
                                                        E->isArrow(),
                                                        E->getOperatorLoc(),
@@ -4287,23 +4286,23 @@
   // FIXME: This also won't work for, e.g., x->template operator+<int>
   TemplateName OrigTemplateName
     = SemaRef.Context.getDependentTemplateName(0, Name.getAsIdentifierInfo());
-  
-  TemplateName Template 
-    = getDerived().TransformTemplateName(OrigTemplateName, 
+
+  TemplateName Template
+    = getDerived().TransformTemplateName(OrigTemplateName,
                                        QualType::getFromOpaquePtr(ObjectType));
   if (Template.isNull())
     return SemaRef.ExprError();
-  
+
   llvm::SmallVector<TemplateArgument, 4> TransArgs;
   for (unsigned I = 0, N = E->getNumTemplateArgs(); I != N; ++I) {
-    TemplateArgument TransArg 
+    TemplateArgument TransArg
     = getDerived().TransformTemplateArgument(E->getTemplateArgs()[I]);
     if (TransArg.isNull())
       return SemaRef.ExprError();
-    
+
     TransArgs.push_back(TransArg);
   }
-  
+
   return getDerived().RebuildCXXUnresolvedMemberExpr(move(Base),
                                                      E->isArrow(),
                                                      E->getOperatorLoc(),
@@ -4320,46 +4319,46 @@
 
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *E) { 
-  return SemaRef.Owned(E->Retain()); 
+TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *E) {
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) { 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) {
   // FIXME: poor source location
   TemporaryBase Rebase(*this, E->getAtLoc(), DeclarationName());
   QualType EncodedType = getDerived().TransformType(E->getEncodedType());
   if (EncodedType.isNull())
     return SemaRef.ExprError();
-  
+
   if (!getDerived().AlwaysRebuild() &&
       EncodedType == E->getEncodedType())
-    return SemaRef.Owned(E->Retain()); 
+    return SemaRef.Owned(E->Retain());
 
   return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
                                             EncodedType,
                                             E->getRParenLoc());
 }
-  
+
 template<typename Derived>
 Sema::OwningExprResult
-TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) { 
+TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) {
   // FIXME: Implement this!
   assert(false && "Cannot transform Objective-C expressions yet");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *E) { 
-  return SemaRef.Owned(E->Retain()); 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *E) {
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *E) { 
-  ObjCProtocolDecl *Protocol 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *E) {
+  ObjCProtocolDecl *Protocol
     = cast_or_null<ObjCProtocolDecl>(
                                 getDerived().TransformDecl(E->getProtocol()));
   if (!Protocol)
@@ -4367,140 +4366,140 @@
 
   if (!getDerived().AlwaysRebuild() &&
       Protocol == E->getProtocol())
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildObjCProtocolExpr(Protocol,
                                               E->getAtLoc(),
                                               /*FIXME:*/E->getAtLoc(),
                                               /*FIXME:*/E->getAtLoc(),
                                               E->getRParenLoc());
-                                              
+
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) { 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) {
   // FIXME: Implement this!
   assert(false && "Cannot transform Objective-C expressions yet");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
+template<typename Derived>
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
   // FIXME: Implement this!
   assert(false && "Cannot transform Objective-C expressions yet");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
+template<typename Derived>
+Sema::OwningExprResult
 TreeTransform<Derived>::TransformObjCImplicitSetterGetterRefExpr(
-                                          ObjCImplicitSetterGetterRefExpr *E) { 
+                                          ObjCImplicitSetterGetterRefExpr *E) {
   // FIXME: Implement this!
   assert(false && "Cannot transform Objective-C expressions yet");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformObjCSuperExpr(ObjCSuperExpr *E) { 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformObjCSuperExpr(ObjCSuperExpr *E) {
   // FIXME: Implement this!
   assert(false && "Cannot transform Objective-C expressions yet");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) { 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) {
   // FIXME: Implement this!
   assert(false && "Cannot transform Objective-C expressions yet");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) { 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) {
   bool ArgumentChanged = false;
   ASTOwningVector<&ActionBase::DeleteExpr> SubExprs(SemaRef);
   for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I) {
     OwningExprResult SubExpr = getDerived().TransformExpr(E->getExpr(I));
     if (SubExpr.isInvalid())
       return SemaRef.ExprError();
-    
+
     ArgumentChanged = ArgumentChanged || SubExpr.get() != E->getExpr(I);
     SubExprs.push_back(SubExpr.takeAs<Expr>());
   }
-  
+
   if (!getDerived().AlwaysRebuild() &&
       !ArgumentChanged)
-    return SemaRef.Owned(E->Retain()); 
-  
+    return SemaRef.Owned(E->Retain());
+
   return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
                                                move_arg(SubExprs),
                                                E->getRParenLoc());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) { 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
   // FIXME: Implement this!
   assert(false && "Cannot transform block expressions yet");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
 
-template<typename Derived> 
-Sema::OwningExprResult 
-TreeTransform<Derived>::TransformBlockDeclRefExpr(BlockDeclRefExpr *E) { 
+template<typename Derived>
+Sema::OwningExprResult
+TreeTransform<Derived>::TransformBlockDeclRefExpr(BlockDeclRefExpr *E) {
   // FIXME: Implement this!
   assert(false && "Cannot transform block-related expressions yet");
-  return SemaRef.Owned(E->Retain()); 
+  return SemaRef.Owned(E->Retain());
 }
-  
+
 //===----------------------------------------------------------------------===//
 // Type reconstruction
 //===----------------------------------------------------------------------===//
 
-template<typename Derived> 
+template<typename Derived>
 QualType TreeTransform<Derived>::RebuildPointerType(QualType PointeeType) {
-  return SemaRef.BuildPointerType(PointeeType, 0, 
+  return SemaRef.BuildPointerType(PointeeType, 0,
                                   getDerived().getBaseLocation(),
                                   getDerived().getBaseEntity());
 }
 
-template<typename Derived> 
+template<typename Derived>
 QualType TreeTransform<Derived>::RebuildBlockPointerType(QualType PointeeType) {
-  return SemaRef.BuildBlockPointerType(PointeeType, 0, 
+  return SemaRef.BuildBlockPointerType(PointeeType, 0,
                                        getDerived().getBaseLocation(),
                                        getDerived().getBaseEntity());
 }
 
-template<typename Derived> 
-QualType 
+template<typename Derived>
+QualType
 TreeTransform<Derived>::RebuildLValueReferenceType(QualType ReferentType) {
-  return SemaRef.BuildReferenceType(ReferentType, true, 0, 
+  return SemaRef.BuildReferenceType(ReferentType, true, 0,
                                     getDerived().getBaseLocation(),
                                     getDerived().getBaseEntity());
 }
 
-template<typename Derived> 
-QualType 
+template<typename Derived>
+QualType
 TreeTransform<Derived>::RebuildRValueReferenceType(QualType ReferentType) {
-  return SemaRef.BuildReferenceType(ReferentType, false, 0, 
+  return SemaRef.BuildReferenceType(ReferentType, false, 0,
                                     getDerived().getBaseLocation(),
                                     getDerived().getBaseEntity());
 }
 
 template<typename Derived>
-QualType TreeTransform<Derived>::RebuildMemberPointerType(QualType PointeeType, 
+QualType TreeTransform<Derived>::RebuildMemberPointerType(QualType PointeeType,
                                                           QualType ClassType) {
-  return SemaRef.BuildMemberPointerType(PointeeType, ClassType, 0, 
+  return SemaRef.BuildMemberPointerType(PointeeType, ClassType, 0,
                                         getDerived().getBaseLocation(),
                                         getDerived().getBaseEntity());
 }
 
 template<typename Derived>
-QualType 
+QualType
 TreeTransform<Derived>::RebuildArrayType(QualType ElementType,
                                          ArrayType::ArraySizeModifier SizeMod,
                                          const llvm::APInt *Size,
@@ -4511,11 +4510,11 @@
     return SemaRef.BuildArrayType(ElementType, SizeMod, SizeExpr,
                                   IndexTypeQuals, BracketsRange,
                                   getDerived().getBaseEntity());
-  
-  QualType Types[] = { 
-    SemaRef.Context.UnsignedCharTy, SemaRef.Context.UnsignedShortTy, 
-    SemaRef.Context.UnsignedIntTy, SemaRef.Context.UnsignedLongTy, 
-    SemaRef.Context.UnsignedLongLongTy, SemaRef.Context.UnsignedInt128Ty 
+
+  QualType Types[] = {
+    SemaRef.Context.UnsignedCharTy, SemaRef.Context.UnsignedShortTy,
+    SemaRef.Context.UnsignedIntTy, SemaRef.Context.UnsignedLongTy,
+    SemaRef.Context.UnsignedLongLongTy, SemaRef.Context.UnsignedInt128Ty
   };
   const unsigned NumTypes = sizeof(Types) / sizeof(QualType);
   QualType SizeType;
@@ -4524,78 +4523,78 @@
       SizeType = Types[I];
       break;
     }
-  
+
   if (SizeType.isNull())
     SizeType = SemaRef.Context.getFixedWidthIntType(Size->getBitWidth(), false);
-  
+
   IntegerLiteral ArraySize(*Size, SizeType, /*FIXME*/BracketsRange.getBegin());
-  return SemaRef.BuildArrayType(ElementType, SizeMod, &ArraySize, 
+  return SemaRef.BuildArrayType(ElementType, SizeMod, &ArraySize,
                                 IndexTypeQuals, BracketsRange,
-                                getDerived().getBaseEntity());    
+                                getDerived().getBaseEntity());
 }
-  
+
 template<typename Derived>
-QualType 
-TreeTransform<Derived>::RebuildConstantArrayType(QualType ElementType, 
+QualType
+TreeTransform<Derived>::RebuildConstantArrayType(QualType ElementType,
                                                  ArrayType::ArraySizeModifier SizeMod,
                                                  const llvm::APInt &Size,
                                                  unsigned IndexTypeQuals) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, 0, 
+  return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, 0,
                                         IndexTypeQuals, SourceRange());
 }
 
 template<typename Derived>
-QualType 
-TreeTransform<Derived>::RebuildConstantArrayWithExprType(QualType ElementType, 
+QualType
+TreeTransform<Derived>::RebuildConstantArrayWithExprType(QualType ElementType,
                                           ArrayType::ArraySizeModifier SizeMod,
                                                       const llvm::APInt &Size,
                                                          Expr *SizeExpr,
                                                       unsigned IndexTypeQuals,
                                                     SourceRange BracketsRange) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr, 
+  return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
                                        IndexTypeQuals, BracketsRange);
 }
 
 template<typename Derived>
-QualType 
+QualType
 TreeTransform<Derived>::RebuildConstantArrayWithoutExprType(
-                                                        QualType ElementType, 
+                                                        QualType ElementType,
                                           ArrayType::ArraySizeModifier SizeMod,
                                                        const llvm::APInt &Size,
                                                      unsigned IndexTypeQuals) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, 0, 
+  return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, 0,
                                        IndexTypeQuals, SourceRange());
 }
 
 template<typename Derived>
-QualType 
-TreeTransform<Derived>::RebuildIncompleteArrayType(QualType ElementType, 
+QualType
+TreeTransform<Derived>::RebuildIncompleteArrayType(QualType ElementType,
                                           ArrayType::ArraySizeModifier SizeMod,
                                                  unsigned IndexTypeQuals) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, 0, 0, 
+  return getDerived().RebuildArrayType(ElementType, SizeMod, 0, 0,
                                        IndexTypeQuals, SourceRange());
 }
-  
+
 template<typename Derived>
-QualType 
-TreeTransform<Derived>::RebuildVariableArrayType(QualType ElementType, 
+QualType
+TreeTransform<Derived>::RebuildVariableArrayType(QualType ElementType,
                                           ArrayType::ArraySizeModifier SizeMod,
                                                  ExprArg SizeExpr,
                                                  unsigned IndexTypeQuals,
                                                  SourceRange BracketsRange) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, 0, 
+  return getDerived().RebuildArrayType(ElementType, SizeMod, 0,
                                        SizeExpr.takeAs<Expr>(),
                                        IndexTypeQuals, BracketsRange);
 }
 
 template<typename Derived>
-QualType 
-TreeTransform<Derived>::RebuildDependentSizedArrayType(QualType ElementType, 
+QualType
+TreeTransform<Derived>::RebuildDependentSizedArrayType(QualType ElementType,
                                           ArrayType::ArraySizeModifier SizeMod,
                                                        ExprArg SizeExpr,
                                                        unsigned IndexTypeQuals,
                                                    SourceRange BracketsRange) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, 0, 
+  return getDerived().RebuildArrayType(ElementType, SizeMod, 0,
                                        SizeExpr.takeAs<Expr>(),
                                        IndexTypeQuals, BracketsRange);
 }
@@ -4606,7 +4605,7 @@
   // FIXME: semantic checking!
   return SemaRef.Context.getVectorType(ElementType, NumElements);
 }
-  
+
 template<typename Derived>
 QualType TreeTransform<Derived>::RebuildExtVectorType(QualType ElementType,
                                                       unsigned NumElements,
@@ -4614,32 +4613,32 @@
   llvm::APInt numElements(SemaRef.Context.getIntWidth(SemaRef.Context.IntTy),
                           NumElements, true);
   IntegerLiteral *VectorSize
-    = new (SemaRef.Context) IntegerLiteral(numElements, SemaRef.Context.IntTy, 
+    = new (SemaRef.Context) IntegerLiteral(numElements, SemaRef.Context.IntTy,
                                            AttributeLoc);
   return SemaRef.BuildExtVectorType(ElementType, SemaRef.Owned(VectorSize),
                                     AttributeLoc);
 }
-  
+
 template<typename Derived>
-QualType 
-TreeTransform<Derived>::RebuildDependentSizedExtVectorType(QualType ElementType, 
+QualType
+TreeTransform<Derived>::RebuildDependentSizedExtVectorType(QualType ElementType,
                                                            ExprArg SizeExpr,
                                                   SourceLocation AttributeLoc) {
   return SemaRef.BuildExtVectorType(ElementType, move(SizeExpr), AttributeLoc);
 }
- 
+
 template<typename Derived>
 QualType TreeTransform<Derived>::RebuildFunctionProtoType(QualType T,
-                                                          QualType *ParamTypes, 
+                                                          QualType *ParamTypes,
                                                         unsigned NumParamTypes,
-                                                          bool Variadic, 
+                                                          bool Variadic,
                                                           unsigned Quals) {
-  return SemaRef.BuildFunctionType(T, ParamTypes, NumParamTypes, Variadic, 
+  return SemaRef.BuildFunctionType(T, ParamTypes, NumParamTypes, Variadic,
                                    Quals,
                                    getDerived().getBaseLocation(),
                                    getDerived().getBaseEntity());
 }
-  
+
 template<typename Derived>
 QualType TreeTransform<Derived>::RebuildTypeOfExprType(ExprArg E) {
   return SemaRef.BuildTypeofExprType(E.takeAs<Expr>());
@@ -4662,10 +4661,10 @@
                                                            unsigned NumArgs) {
   // FIXME: Missing source locations for the template name, <, >.
   return SemaRef.CheckTemplateIdType(Template, getDerived().getBaseLocation(),
-                                     SourceLocation(), Args, NumArgs, 
-                                     SourceLocation());  
+                                     SourceLocation(), Args, NumArgs,
+                                     SourceLocation());
 }
-  
+
 template<typename Derived>
 NestedNameSpecifier *
 TreeTransform<Derived>::RebuildNestedNameSpecifier(NestedNameSpecifier *Prefix,
@@ -4678,7 +4677,7 @@
   SS.setRange(Range);
   SS.setScopeRep(Prefix);
   return static_cast<NestedNameSpecifier *>(
-                    SemaRef.BuildCXXNestedNameSpecifier(0, SS, Range.getEnd(), 
+                    SemaRef.BuildCXXNestedNameSpecifier(0, SS, Range.getEnd(),
                                                         Range.getEnd(), II,
                                                         ObjectType,
                                                         FirstQualifierInScope,
@@ -4705,22 +4704,22 @@
     return NestedNameSpecifier::Create(SemaRef.Context, Prefix, TemplateKW,
                                        T.getTypePtr());
   }
-  
+
   SemaRef.Diag(Range.getBegin(), diag::err_nested_name_spec_non_tag) << T;
   return 0;
 }
-  
+
 template<typename Derived>
-TemplateName 
+TemplateName
 TreeTransform<Derived>::RebuildTemplateName(NestedNameSpecifier *Qualifier,
                                             bool TemplateKW,
                                             TemplateDecl *Template) {
-  return SemaRef.Context.getQualifiedTemplateName(Qualifier, TemplateKW, 
+  return SemaRef.Context.getQualifiedTemplateName(Qualifier, TemplateKW,
                                                   Template);
 }
 
 template<typename Derived>
-TemplateName 
+TemplateName
 TreeTransform<Derived>::RebuildTemplateName(NestedNameSpecifier *Qualifier,
                                             bool TemplateKW,
                                             OverloadedFunctionDecl *Ovl) {
@@ -4728,13 +4727,13 @@
 }
 
 template<typename Derived>
-TemplateName 
+TemplateName
 TreeTransform<Derived>::RebuildTemplateName(NestedNameSpecifier *Qualifier,
                                             const IdentifierInfo &II,
                                             QualType ObjectType) {
   CXXScopeSpec SS;
   SS.setRange(SourceRange(getDerived().getBaseLocation()));
-  SS.setScopeRep(Qualifier);  
+  SS.setScopeRep(Qualifier);
   return getSema().ActOnDependentTemplateName(
                                       /*FIXME:*/getDerived().getBaseLocation(),
                                               II,
@@ -4743,9 +4742,9 @@
                                               ObjectType.getAsOpaquePtr())
            .template getAsVal<TemplateName>();
 }
- 
+
 template<typename Derived>
-Sema::OwningExprResult 
+Sema::OwningExprResult
 TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
                                                    SourceLocation OpLoc,
                                                    ExprArg Callee,
@@ -4754,73 +4753,73 @@
   Expr *FirstExpr = (Expr *)First.get();
   Expr *SecondExpr = (Expr *)Second.get();
   bool isPostIncDec = SecondExpr && (Op == OO_PlusPlus || Op == OO_MinusMinus);
-    
+
   // Determine whether this should be a builtin operation.
   if (SecondExpr == 0 || isPostIncDec) {
     if (!FirstExpr->getType()->isOverloadableType()) {
       // The argument is not of overloadable type, so try to create a
       // built-in unary operation.
-      UnaryOperator::Opcode Opc 
+      UnaryOperator::Opcode Opc
         = UnaryOperator::getOverloadedOpcode(Op, isPostIncDec);
-      
+
       return getSema().CreateBuiltinUnaryOp(OpLoc, Opc, move(First));
     }
   } else {
-    if (!FirstExpr->getType()->isOverloadableType() && 
+    if (!FirstExpr->getType()->isOverloadableType() &&
         !SecondExpr->getType()->isOverloadableType()) {
       // Neither of the arguments is an overloadable type, so try to
       // create a built-in binary operation.
       BinaryOperator::Opcode Opc = BinaryOperator::getOverloadedOpcode(Op);
-      OwningExprResult Result 
+      OwningExprResult Result
         = SemaRef.CreateBuiltinBinOp(OpLoc, Opc, FirstExpr, SecondExpr);
       if (Result.isInvalid())
         return SemaRef.ExprError();
-      
+
       First.release();
       Second.release();
       return move(Result);
     }
   }
-  
-  // Compute the transformed set of functions (and function templates) to be 
+
+  // Compute the transformed set of functions (and function templates) to be
   // used during overload resolution.
   Sema::FunctionSet Functions;
-  
-  DeclRefExpr *DRE 
+
+  DeclRefExpr *DRE
     = cast<DeclRefExpr>(((Expr *)Callee.get())->IgnoreParenCasts());
-  
+
   // FIXME: Do we have to check
   // IsAcceptableNonMemberOperatorCandidate for each of these?
   for (OverloadIterator F(DRE->getDecl()), FEnd; F != FEnd; ++F)
     Functions.insert(*F);
-  
+
   // Add any functions found via argument-dependent lookup.
   Expr *Args[2] = { FirstExpr, SecondExpr };
   unsigned NumArgs = 1 + (SecondExpr != 0);
-  DeclarationName OpName 
+  DeclarationName OpName
     = SemaRef.Context.DeclarationNames.getCXXOperatorName(Op);
   SemaRef.ArgumentDependentLookup(OpName, Args, NumArgs, Functions);
-  
+
   // Create the overloaded operator invocation for unary operators.
   if (NumArgs == 1 || isPostIncDec) {
-    UnaryOperator::Opcode Opc 
+    UnaryOperator::Opcode Opc
       = UnaryOperator::getOverloadedOpcode(Op, isPostIncDec);
     return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions, move(First));
   }
-  
+
   // Create the overloaded operator invocation for binary operators.
-  BinaryOperator::Opcode Opc = 
+  BinaryOperator::Opcode Opc =
     BinaryOperator::getOverloadedOpcode(Op);
-  OwningExprResult Result 
+  OwningExprResult Result
     = SemaRef.CreateOverloadedBinOp(OpLoc, Opc, Functions, Args[0], Args[1]);
   if (Result.isInvalid())
     return SemaRef.ExprError();
-  
+
   First.release();
   Second.release();
-  return move(Result);  
+  return move(Result);
 }
-  
+
 } // end namespace clang
 
 #endif // LLVM_CLANG_SEMA_TREETRANSFORM_H

Modified: cfe/trunk/test/Analysis/cfref_rdar6080742.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/cfref_rdar6080742.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/cfref_rdar6080742.c (original)
+++ cfe/trunk/test/Analysis/cfref_rdar6080742.c Wed Sep  9 10:08:12 2009
@@ -44,15 +44,15 @@
 #define AssertNoErr(err){ DebugDisplayOSStatusMsg((err), #err, __FILE__, __LINE__); }
 #define RequireNoErr(err, action){ if( DebugDisplayOSStatusMsg((err), #err, __FILE__, __LINE__) ) { action }}
 
-void DebugStop(const char *format,...);	/* Not an abort function. */
+void DebugStop(const char *format,...); /* Not an abort function. */
 
 int main(int argc, char *argv[]) {
-	CFStringRef     cfString;
-	OSStatus        status = noErr;
-	cfString = CFStringCreateWithCString(0, "hello", kCFStringEncodingUTF8);
-	RequireAction(cfString != 0, return memFullErr;) //no - warning
-        printf("cfstring %p\n", cfString);
-Exit:
-	CFRelease(cfString);
-	return 0;
+  CFStringRef     cfString;
+  OSStatus        status = noErr;
+  cfString = CFStringCreateWithCString(0, "hello", kCFStringEncodingUTF8);
+  RequireAction(cfString != 0, return memFullErr;) //no - warning
+    printf("cfstring %p\n", cfString);
+  Exit:
+  CFRelease(cfString);
+  return 0;
 }

Modified: cfe/trunk/test/CodeGen/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/asm.c (original)
+++ cfe/trunk/test/CodeGen/asm.c Wed Sep  9 10:08:12 2009
@@ -15,7 +15,7 @@
   unsigned long long a;
   struct reg { unsigned long long a, b; } b;
 
-	__asm__ volatile ("":: "m"(a), "m"(b));
+  __asm__ volatile ("":: "m"(a), "m"(b));
 }
 
 // PR3417

Modified: cfe/trunk/test/CodeGen/attr-cleanup.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-cleanup.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/attr-cleanup.c (original)
+++ cfe/trunk/test/CodeGen/attr-cleanup.c Wed Sep  9 10:08:12 2009
@@ -3,6 +3,6 @@
 // <rdar://problem/6827047>
 void f(void* arg);
 void g() {
-	__attribute__((cleanup(f))) void *g;
+  __attribute__((cleanup(f))) void *g;
 }
 

Modified: cfe/trunk/test/CodeGen/conditional.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/conditional.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/conditional.c (original)
+++ cfe/trunk/test/CodeGen/conditional.c Wed Sep  9 10:08:12 2009
@@ -1,11 +1,10 @@
 // RUN: clang-cc -emit-llvm %s -o %t
 
-float test1(int cond, float a, float b)
-{
+float test1(int cond, float a, float b) {
   return cond ? a : b;
 }
-double test2(int cond, float a, double b)
-{
+
+double test2(int cond, float a, double b) {
   return cond ? a : b;
 }
 
@@ -16,8 +15,8 @@
 }
 
 void test4() {
-int i; short j;
-float* k = 1 ? &i : &j;
+  int i; short j;
+  float* k = 1 ? &i : &j;
 }
 
 void test5() {
@@ -33,12 +32,10 @@
 
 void _efree(void *ptr);
 
-void _php_stream_free3()
-{
-	(1 ? free(0) : _efree(0));
+void _php_stream_free3() {
+  (1 ? free(0) : _efree(0));
 }
 
-void _php_stream_free4()
-{
-	1 ? _efree(0) : free(0);
+void _php_stream_free4() {
+  1 ? _efree(0) : free(0);
 }

Modified: cfe/trunk/test/CodeGen/debug-info.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/debug-info.c (original)
+++ cfe/trunk/test/CodeGen/debug-info.c Wed Sep  9 10:08:12 2009
@@ -24,14 +24,14 @@
 
 // PR3427
 struct foo {
-	int a;
-	void *ptrs[];
+  int a;
+  void *ptrs[];
 };
 struct foo bar;
 
 // PR4143
 struct foo2 {
-        enum bar *bar;
+  enum bar *bar;
 };
 
 struct foo2 foo2;

Modified: cfe/trunk/test/CodeGen/exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exprs.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/exprs.c (original)
+++ cfe/trunk/test/CodeGen/exprs.c Wed Sep  9 10:08:12 2009
@@ -48,9 +48,9 @@
 
 // this one shouldn't fold as well
 void eMaisUma() {
-	double t[1];
-	if (*t)
-		return;
+  double t[1];
+  if (*t)
+    return;
 }
 
 // rdar://6520707

Modified: cfe/trunk/test/CodeGen/functions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/functions.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/functions.c (original)
+++ cfe/trunk/test/CodeGen/functions.c Wed Sep  9 10:08:12 2009
@@ -3,11 +3,11 @@
 int g();
 
 int foo(int i) {
-	return g(i);
+  return g(i);
 }
 
 int g(int i) {
-	return g(i);
+  return g(i);
 }
 
 // rdar://6110827

Modified: cfe/trunk/test/CodeGen/global-with-initialiser.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/global-with-initialiser.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/global-with-initialiser.c (original)
+++ cfe/trunk/test/CodeGen/global-with-initialiser.c Wed Sep  9 10:08:12 2009
@@ -17,9 +17,9 @@
 long double globalLongDoubleArray[5] = { 1.0, 2.0 };
 
 struct Struct {
-	int member1;
-	float member2;
-	char *member3; 
+  int member1;
+  float member2;
+  char *member3; 
 };
 
 struct Struct globalStruct = { 1, 2.0f, "foobar"};

Modified: cfe/trunk/test/CodeGen/globalinit.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/globalinit.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/globalinit.c (original)
+++ cfe/trunk/test/CodeGen/globalinit.c Wed Sep  9 10:08:12 2009
@@ -37,7 +37,7 @@
 
 // References to enums.
 enum {
-	EnumA, EnumB
+  EnumA, EnumB
 };
 
 int c[] = { EnumA, EnumB };

Modified: cfe/trunk/test/CodeGen/init-with-member-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/init-with-member-expr.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/init-with-member-expr.c (original)
+++ cfe/trunk/test/CodeGen/init-with-member-expr.c Wed Sep  9 10:08:12 2009
@@ -14,7 +14,7 @@
 } mark_header_t;
 int is_rar_archive(int fd) {
         const mark_header_t rar_hdr[2] = {{0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00}, {'U', 'n', 'i', 'q', 'u', 'E', '!'}};
-	foo(rar_hdr);
+        foo(rar_hdr);
 
         return 0;
 }

Modified: cfe/trunk/test/CodeGen/regparm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/regparm.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/regparm.c (original)
+++ cfe/trunk/test/CodeGen/regparm.c Wed Sep  9 10:08:12 2009
@@ -9,11 +9,10 @@
 } foo;
 
 static void FASTCALL
-reduced(char b, double c, foo* d, double e, int f)
-{
+reduced(char b, double c, foo* d, double e, int f) {
 }
 
 int
 main(void) {
-	reduced(0, 0.0, 0, 0.0, 0);
+  reduced(0, 0.0, 0, 0.0, 0);
 }

Modified: cfe/trunk/test/CodeGen/staticinit.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/staticinit.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/staticinit.c (original)
+++ cfe/trunk/test/CodeGen/staticinit.c Wed Sep  9 10:08:12 2009
@@ -2,9 +2,9 @@
 // RUN: grep "g.b = internal global i8. getelementptr" %t &&
 
 struct AStruct { 
-	int i;
-	char *s;
-	double d;
+  int i;
+  char *s;
+  double d;
 };
 
 void f() {

Modified: cfe/trunk/test/CodeGen/struct-init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct-init.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/struct-init.c (original)
+++ cfe/trunk/test/CodeGen/struct-init.c Wed Sep  9 10:08:12 2009
@@ -2,11 +2,11 @@
 
 typedef struct _zend_ini_entry zend_ini_entry;
 struct _zend_ini_entry {
-	void *mh_arg1;
+  void *mh_arg1;
 };
 
 char a;
 
 const zend_ini_entry ini_entries[] = {
-	{  ((char*)&((zend_ini_entry*)0)->mh_arg1 - (char*)(void*)0)},
+  {  ((char*)&((zend_ini_entry*)0)->mh_arg1 - (char*)(void*)0)},
 };

Modified: cfe/trunk/test/CodeGen/struct.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/struct.c (original)
+++ cfe/trunk/test/CodeGen/struct.c Wed Sep  9 10:08:12 2009
@@ -70,8 +70,7 @@
   int length;
 } range;
 extern range f6();
-void f7()
-{
+void f7() {
   range r = f6();
 }
 
@@ -81,27 +80,23 @@
   range range2;
 } rangepair;
 
-void f8()
-{
+void f8() {
   rangepair p;
 
   range r = p.range1;
 }
 
-void f9(range *p)
-{
+void f9(range *p) {
   range r = *p;
 }
 
-void f10(range *p)
-{
+void f10(range *p) {
   range r = p[0];
 }
 
 /* _Bool types */
 
-struct _w
-{
+struct _w {
   short a,b;
   short c,d;
   short e,f;
@@ -113,27 +108,24 @@
 } ws;
 
 /* Implicit casts (due to typedefs) */
-typedef struct _a
-{
+typedef struct _a {
   int a;
 } a;
 
-void f11()
-{
-    struct _a a1;
-    a a2;
+void f11() {
+  struct _a a1;
+  a a2;
     
-    a1 = a2;
-    a2 = a1;
+  a1 = a2;
+  a2 = a1;
 }
 
 /* Implicit casts (due to const) */
-void f12()
-{
-	struct _a a1;
-	const struct _a a2;
-	
-	a1 = a2;
+void f12() {
+  struct _a a1;
+  const struct _a a2;
+
+  a1 = a2;
 }
 
 /* struct initialization */
@@ -147,8 +139,7 @@
 int a16(void) {c15.a = 1;}
 
 /* compound literals */
-void f13()
-{
+void f13() {
   a13 x; x = (a13){1,2};
 }
 

Modified: cfe/trunk/test/CodeGen/union-init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/union-init.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/union-init.c (original)
+++ cfe/trunk/test/CodeGen/union-init.c Wed Sep  9 10:08:12 2009
@@ -4,19 +4,19 @@
 typedef int Py_ssize_t;
 
 typedef union _gc_head {
-	struct {
-		union _gc_head *gc_next;
-		union _gc_head *gc_prev;
-		Py_ssize_t gc_refs;
-	} gc;
-	long double dummy;  /* force worst-case alignment */
+  struct {
+    union _gc_head *gc_next;
+    union _gc_head *gc_prev;
+    Py_ssize_t gc_refs;
+  } gc;
+  long double dummy;  /* force worst-case alignment */
 } PyGC_Head;
 
 struct gc_generation {
-	PyGC_Head head;
-	int threshold; /* collection threshold */
-	int count; /* count of allocations or collections of younger
-		      generations */
+  PyGC_Head head;
+  int threshold; /* collection threshold */
+  int count;     /* count of allocations or collections of younger
+                    generations */
 };
 
 #define NUM_GENERATIONS 3
@@ -24,8 +24,8 @@
 
 /* linked lists of container objects */
 struct gc_generation generations[NUM_GENERATIONS] = {
-	/* PyGC_Head,				threshold,	count */
-	{{{GEN_HEAD(0), GEN_HEAD(0), 0}},	700,		0},
-	{{{GEN_HEAD(1), GEN_HEAD(1), 0}},	10,		0},
-	{{{GEN_HEAD(2), GEN_HEAD(2), 0}},	10,		0},
+  /* PyGC_Head,                     threshold,      count */
+  {{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700,            0},
+  {{{GEN_HEAD(1), GEN_HEAD(1), 0}},  10,            0},
+  {{{GEN_HEAD(2), GEN_HEAD(2), 0}},  10,            0},
 };

Modified: cfe/trunk/test/CodeGen/vector.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/vector.c?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/vector.c (original)
+++ cfe/trunk/test/CodeGen/vector.c Wed Sep  9 10:08:12 2009
@@ -1,9 +1,8 @@
 // RUN: clang-cc -emit-llvm %s -o -
 typedef short __v4hi __attribute__ ((__vector_size__ (8)));
 
-void f()
-{
-    __v4hi A = (__v4hi)0LL;
+void f() {
+  __v4hi A = (__v4hi)0LL;
 }
 
 __v4hi x = {1,2,3};
@@ -15,7 +14,6 @@
 // PR4339
 typedef float vec4 __attribute__((vector_size(16)));
 
-void vac ( vec4* a, char b, float c )
-{
-	(*a)[b] = c;
+void vac ( vec4* a, char b, float c ) {
+  (*a)[b] = c;
 }

Modified: cfe/trunk/test/CodeGenCXX/constructor-conversion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/constructor-conversion.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/constructor-conversion.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/constructor-conversion.cpp Wed Sep  9 10:08:12 2009
@@ -8,16 +8,16 @@
 
 class X { // ...
 public: 
-	X(int) : iX(2), fX(2.3) , name("HELLO\n") {  }
+  X(int) : iX(2), fX(2.3) , name("HELLO\n") {  }
 
-	X(const char* arg, int ix=0) { iX = ix; fX = 6.0; name = arg+ix; }
-	X(): iX(100), fX(1.2) {}
-	int iX;
-	float fX;
-	const char *name;
-	void pr(void) {
-	  printf("iX = %d  fX = %f name = %s\n", iX, fX, name);
-	}
+  X(const char* arg, int ix=0) { iX = ix; fX = 6.0; name = arg+ix; }
+  X(): iX(100), fX(1.2) {}
+  int iX;
+  float fX;
+  const char *name;
+  void pr(void) {
+    printf("iX = %d  fX = %f name = %s\n", iX, fX, name);
+  }
 };
 
 void g(X arg) {
@@ -25,8 +25,7 @@
 }
 
 void f(X arg) {
-
-  X a = 1;  	// a = X(1)
+  X a = 1;        // a = X(1)
 
   a.pr();
 
@@ -35,18 +34,16 @@
   b.pr();
 
 
-  a = 2;	  // a = X(2)
+  a = 2;          // a = X(2)
 
   a.pr();
-
 }
 
 
-int main()
-{
-	X x;
-	f(x);
-  	g(3); // g(X(3))
+int main() {
+  X x;
+  f(x);
+  g(3);           // g(X(3))
 }
 
 // CHECK-LP64: call     __ZN1XC1Ei

Modified: cfe/trunk/test/CodeGenCXX/constructor-default-arg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/constructor-default-arg.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/constructor-default-arg.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/constructor-default-arg.cpp Wed Sep  9 10:08:12 2009
@@ -8,8 +8,8 @@
 
 
 struct C {
-	C() : iC(6) {}
-	int iC;
+  C() : iC(6) {}
+  int iC;
 };
 
 int foo() {
@@ -18,23 +18,23 @@
 
 class X { // ...
 public: 
-	X(int) {}
-	X(const X&, int i = 1, int j = 2, int k = foo()) {
-		printf("X(const X&, %d, %d, %d)\n", i, j, k);
-	}
+  X(int) {}
+  X(const X&, int i = 1, int j = 2, int k = foo()) {
+    printf("X(const X&, %d, %d, %d)\n", i, j, k);
+  }
 };
 
-int main()
-{
-	X a(1);
-	X b(a, 2);
-	X c = b;
-	X d(a, 5, 6);
+int main() {
+  X a(1);
+  X b(a, 2);
+  X c = b;
+  X d(a, 5, 6);
 }
-// CHECK-LP64: call	__ZN1XC1ERK1Xiii
-// CHECK-LP64: call	__ZN1XC1ERK1Xiii
-// CHECK-LP64: call	__ZN1XC1ERK1Xiii
-
-// CHECK-LP32: call	L__ZN1XC1ERK1Xiii
-// CHECK-LP32: call	L__ZN1XC1ERK1Xiii
-// CHECK-LP32: call	L__ZN1XC1ERK1Xiii
+
+// CHECK-LP64: call __ZN1XC1ERK1Xiii
+// CHECK-LP64: call __ZN1XC1ERK1Xiii
+// CHECK-LP64: call __ZN1XC1ERK1Xiii
+
+// CHECK-LP32: call L__ZN1XC1ERK1Xiii
+// CHECK-LP32: call L__ZN1XC1ERK1Xiii
+// CHECK-LP32: call L__ZN1XC1ERK1Xiii

Modified: cfe/trunk/test/CodeGenCXX/constructor-for-array-members.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/constructor-for-array-members.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/constructor-for-array-members.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/constructor-for-array-members.cpp Wed Sep  9 10:08:12 2009
@@ -35,11 +35,10 @@
 };
 
 int main() {
-	M m1;
-	m1.pr();
-
+  M m1;
+  m1.pr();
 }
 
-// CHECK-LP64: call	__ZN1SC1Ev
+// CHECK-LP64: call __ZN1SC1Ev
 
-// CHECK-LP32: call	L__ZN1SC1Ev
+// CHECK-LP32: call L__ZN1SC1Ev

Modified: cfe/trunk/test/CodeGenCXX/constructor-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/constructor-init.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/constructor-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/constructor-init.cpp Wed Sep  9 10:08:12 2009
@@ -31,19 +31,20 @@
   float f1;
   int i1;
   float d1;
-  void PR() { printf("f1 = %f d1 = %f i1 = %d ld = %f \n", f1,d1,i1, ld); 
-	      MPR();
-	      PPR();
-              QPR();
-	      printf("iQ = %d\n", iQ);
-	      printf("iP = %d\n", iP);
-              printf("iM = %d\n", iM);
-	      // FIXME. We don't yet support this syntax.
-	      // printf("iQ = %d\n", (*this).iQ);
-	      printf("iQ = %d\n", this->iQ);
-	      printf("iP = %d\n", this->iP);
-              printf("iM = %d\n", this->iM);
-            }
+  void PR() {
+    printf("f1 = %f d1 = %f i1 = %d ld = %f \n", f1,d1,i1, ld); 
+    MPR();
+    PPR();
+    QPR();
+    printf("iQ = %d\n", iQ);
+    printf("iP = %d\n", iP);
+    printf("iM = %d\n", iM);
+    // FIXME. We don't yet support this syntax.
+    // printf("iQ = %d\n", (*this).iQ);
+    printf("iQ = %d\n", this->iQ);
+    printf("iP = %d\n", this->iP);
+    printf("iM = %d\n", this->iM);
+  }
   float ld;
   float ff;
   M arr_m[3];

Modified: cfe/trunk/test/CodeGenCXX/constructor-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/constructor-template.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/constructor-template.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/constructor-template.cpp Wed Sep  9 10:08:12 2009
@@ -21,7 +21,7 @@
 // PR4853
 template <typename T> class List {
 public:
-  List(){ }	// List<BinomialNode<int>*>::List() remains undefined.
+  List(){ }     // List<BinomialNode<int>*>::List() remains undefined.
   ~List() {}
 };
 
@@ -47,7 +47,7 @@
 
 // CHECK-LP64: __ZN4ListIP12BinomialNodeIiEED1Ev:
 // CHECK-LP64: __ZN4ListIP12BinomialNodeIiEED2Ev:
-// CHECK-LP64:	__ZN4NodeIP12BinomialNodeIiEEC1Ev:
+// CHECK-LP64: __ZN4NodeIP12BinomialNodeIiEEC1Ev:
 // CHECK-LP64: __ZN4ListIP12BinomialNodeIiEEC1Ev:
 
 // CHECK-LP32: __ZN4ListIP12BinomialNodeIiEED1Ev:

Modified: cfe/trunk/test/CodeGenCXX/conversion-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/conversion-function.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/conversion-function.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/conversion-function.cpp Wed Sep  9 10:08:12 2009
@@ -6,11 +6,11 @@
 
 extern "C" int printf(...);
 struct S {
-	operator int();
+  operator int();
 };
 
 S::operator int() {
-	return 10;
+  return 10;
 }
 
 
@@ -42,51 +42,51 @@
 int count=0;
 class O { // ...
 public: 
-	operator int(){ return ++iO; }
-        O() : iO(count++) {}
-	int iO;
+  operator int(){ return ++iO; }
+  O() : iO(count++) {}
+  int iO;
 };
 
-void g(O a, O b)
-{
-        int i = (a) ? 1+a : 0; 
-        int j = (a&&b) ? a+b : i; 
-        if (a) { }
-	printf("i = %d j = %d a.iO = %d b.iO = %d\n", i, j, a.iO, b.iO);
+void g(O a, O b) {
+  int i = (a) ? 1+a : 0; 
+  int j = (a&&b) ? a+b : i; 
+  if (a) { }
+  printf("i = %d j = %d a.iO = %d b.iO = %d\n", i, j, a.iO, b.iO);
 }
 
 int main() {
-    int c = X(Z(y)); // OK: y.operator Z().operator X().operator int()
-    printf("c = %d\n", c);
-    float f = X(Z(y));
-    printf("f = %f\n", f);
-    int i = x;
-    printf("i = %d float = %f\n", i, float(x));
-    i = int(X(Z(y)));
-    f = float(X(Z(y)));
-    printf("i = %d float = %f\n", i,f);
-    f = (float)x;
-    i = (int)x;
-    printf("i = %d float = %f\n", i,f);
-
-    int d = (X)((Z)y);
-    printf("d = %d\n", d);
-
-    int e = (int)((X)((Z)y));
-    printf("e = %d\n", e);
-    O o1, o2;
-    g(o1, o2);
+  int c = X(Z(y)); // OK: y.operator Z().operator X().operator int()
+  printf("c = %d\n", c);
+  float f = X(Z(y));
+  printf("f = %f\n", f);
+  int i = x;
+  printf("i = %d float = %f\n", i, float(x));
+  i = int(X(Z(y)));
+  f = float(X(Z(y)));
+  printf("i = %d float = %f\n", i,f);
+  f = (float)x;
+  i = (int)x;
+  printf("i = %d float = %f\n", i,f);
+
+  int d = (X)((Z)y);
+  printf("d = %d\n", d);
+
+  int e = (int)((X)((Z)y));
+  printf("e = %d\n", e);
+  O o1, o2;
+  g(o1, o2);
 }
-// CHECK-LP64: .globl  __ZN1ScviEv
+
+// CHECK-LP64: .globl __ZN1ScviEv
 // CHECK-LP64-NEXT: __ZN1ScviEv:
-// CHECK-LP64: call	__ZN1Ycv1ZEv
-// CHECK-LP64: call	__ZN1Zcv1XEv
-// CHECK-LP64: call	__ZN1XcviEv
-// CHECK-LP64: call	__ZN1XcvfEv
+// CHECK-LP64: call __ZN1Ycv1ZEv
+// CHECK-LP64: call __ZN1Zcv1XEv
+// CHECK-LP64: call __ZN1XcviEv
+// CHECK-LP64: call __ZN1XcvfEv
 
 // CHECK-LP32: .globl  __ZN1ScviEv
 // CHECK-LP32-NEXT: __ZN1ScviEv:
-// CHECK-LP32: call	L__ZN1Ycv1ZEv
-// CHECK-LP32: call	L__ZN1Zcv1XEv
-// CHECK-LP32: call	L__ZN1XcviEv
-// CHECK-LP32: call	L__ZN1XcvfEv
+// CHECK-LP32: call L__ZN1Ycv1ZEv
+// CHECK-LP32: call L__ZN1Zcv1XEv
+// CHECK-LP32: call L__ZN1XcviEv
+// CHECK-LP32: call L__ZN1XcvfEv

Modified: cfe/trunk/test/CodeGenCXX/copy-assign-synthesis-1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/copy-assign-synthesis-1.cpp?rev=81346&r1=81345&r2=81346&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/copy-assign-synthesis-1.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/copy-assign-synthesis-1.cpp Wed Sep  9 10:08:12 2009
@@ -43,14 +43,16 @@
     printf("N1 = %d N2 = %d\n", N1, N2);
     for (unsigned i = 0; i < 3; i++)
       for (unsigned j = 0; j < 2; j++)
-	printf("arr_b[%d][%d] = %f\n", i,j,arr_b[i][j].B1);
+        printf("arr_b[%d][%d] = %f\n", i,j,arr_b[i][j].B1);
     B::pr();
   }
-  N& operator=(const N& arg) { N1 = arg.N1; N2 = arg.N2; 
-    			       for (unsigned i = 0; i < 3; i++)
-      			         for (unsigned j = 0; j < 2; j++)
-				   arr_b[i][j] = arg.arr_b[i][j];
-                               return *this; }
+  N& operator=(const N& arg) {
+    N1 = arg.N1; N2 = arg.N2; 
+    for (unsigned i = 0; i < 3; i++)
+      for (unsigned j = 0; j < 2; j++)
+        arr_b[i][j] = arg.arr_b[i][j];
+    return *this;
+  }
   B arr_b[3][2];
 };
 





More information about the cfe-commits mailing list