Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index 40de81a..8e63fb8 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -25,7 +25,7 @@
                                              SourceLocation &DeclEnd,
                                              AccessSpecifier AS) {
   if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less))
-    return ParseExplicitInstantiation(SourceLocation(), ConsumeToken(), 
+    return ParseExplicitInstantiation(SourceLocation(), ConsumeToken(),
                                       DeclEnd);
 
   return ParseTemplateDeclarationOrSpecialization(Context, DeclEnd, AS);
@@ -38,18 +38,18 @@
     unsigned AddedLevels;
 
   public:
-    explicit TemplateParameterDepthCounter(unsigned &Depth) 
+    explicit TemplateParameterDepthCounter(unsigned &Depth)
       : Depth(Depth), AddedLevels(0) { }
-    
+
     ~TemplateParameterDepthCounter() {
       Depth -= AddedLevels;
     }
-    
-    void operator++() { 
+
+    void operator++() {
       ++Depth;
       ++AddedLevels;
     }
-    
+
     operator unsigned() const { return Depth; }
   };
 }
@@ -73,9 +73,9 @@
 Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context,
                                                  SourceLocation &DeclEnd,
                                                  AccessSpecifier AS) {
-  assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) && 
-	 "Token does not start a template declaration.");
-  
+  assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) &&
+         "Token does not start a template declaration.");
+
   // Enter template-parameter scope.
   ParseScope TemplateParmScope(this, Scope::TemplateParamScope);
 
@@ -118,33 +118,33 @@
       Diag(Tok.getLocation(), diag::err_expected_template);
       return DeclPtrTy();
     }
-  
+
     // Parse the '<' template-parameter-list '>'
     SourceLocation LAngleLoc, RAngleLoc;
     TemplateParameterList TemplateParams;
-    if (ParseTemplateParameters(Depth, TemplateParams, LAngleLoc, 
+    if (ParseTemplateParameters(Depth, TemplateParams, LAngleLoc,
                                 RAngleLoc)) {
       // Skip until the semi-colon or a }.
       SkipUntil(tok::r_brace, true, true);
       if (Tok.is(tok::semi))
         ConsumeToken();
-      return DeclPtrTy();      
+      return DeclPtrTy();
     }
 
     ParamLists.push_back(
-      Actions.ActOnTemplateParameterList(Depth, ExportLoc, 
-                                         TemplateLoc, LAngleLoc, 
+      Actions.ActOnTemplateParameterList(Depth, ExportLoc,
+                                         TemplateLoc, LAngleLoc,
                                          TemplateParams.data(),
                                          TemplateParams.size(), RAngleLoc));
 
     if (!TemplateParams.empty()) {
       isSpecialization = false;
       ++Depth;
-    }    
+    }
   } while (Tok.is(tok::kw_export) || Tok.is(tok::kw_template));
 
   // Parse the actual template declaration.
-  return ParseSingleDeclarationAfterTemplate(Context, 
+  return ParseSingleDeclarationAfterTemplate(Context,
                                              ParsedTemplateInfo(&ParamLists,
                                                              isSpecialization),
                                              DeclEnd, AS);
@@ -170,7 +170,7 @@
 /// declaration. Will be AS_none for namespace-scope declarations.
 ///
 /// \returns the new declaration.
-Parser::DeclPtrTy 
+Parser::DeclPtrTy
 Parser::ParseSingleDeclarationAfterTemplate(
                                        unsigned Context,
                                        const ParsedTemplateInfo &TemplateInfo,
@@ -184,7 +184,7 @@
     ParseCXXClassMemberDeclaration(AS, TemplateInfo);
     return DeclPtrTy::make((void*)0);
   }
-  
+
   // Parse the declaration specifiers.
   DeclSpec DS;
   ParseDeclarationSpecifiers(DS, TemplateInfo, AS);
@@ -205,7 +205,7 @@
       ConsumeToken();
     return DeclPtrTy();
   }
-  
+
   // If we have a declaration or declarator list, handle it.
   if (isDeclarationAfterDeclarator()) {
     // Parse this declaration.
@@ -256,7 +256,7 @@
 /// is the number of template headers directly enclosing this template header.
 /// TemplateParams is the current list of template parameters we're building.
 /// The template parameter we parse will be added to this list. LAngleLoc and
-/// RAngleLoc will receive the positions of the '<' and '>', respectively, 
+/// RAngleLoc will receive the positions of the '<' and '>', respectively,
 /// that enclose this template parameter list.
 ///
 /// \returns true if an error occurred, false otherwise.
@@ -265,17 +265,17 @@
                                      SourceLocation &LAngleLoc,
                                      SourceLocation &RAngleLoc) {
   // Get the template parameter list.
-  if(!Tok.is(tok::less)) {
+  if (!Tok.is(tok::less)) {
     Diag(Tok.getLocation(), diag::err_expected_less_after) << "template";
     return true;
   }
   LAngleLoc = ConsumeToken();
-  
+
   // Try to parse the template parameter list.
   if (Tok.is(tok::greater))
     RAngleLoc = ConsumeToken();
-  else if(ParseTemplateParameterList(Depth, TemplateParams)) {
-    if(!Tok.is(tok::greater)) {
+  else if (ParseTemplateParameterList(Depth, TemplateParams)) {
+    if (!Tok.is(tok::greater)) {
       Diag(Tok.getLocation(), diag::err_expected_greater);
       return true;
     }
@@ -287,15 +287,15 @@
 /// ParseTemplateParameterList - Parse a template parameter list. If
 /// the parsing fails badly (i.e., closing bracket was left out), this
 /// will try to put the token stream in a reasonable position (closing
-/// a statement, etc.) and return false. 
+/// a statement, etc.) and return false.
 ///
 ///       template-parameter-list:    [C++ temp]
 ///         template-parameter
 ///         template-parameter-list ',' template-parameter
-bool 
+bool
 Parser::ParseTemplateParameterList(unsigned Depth,
                                    TemplateParameterList &TemplateParams) {
-  while(1) {
+  while (1) {
     if (DeclPtrTy TmpParam
           = ParseTemplateParameter(Depth, TemplateParams.size())) {
       TemplateParams.push_back(TmpParam);
@@ -304,11 +304,11 @@
       // a comma or closing brace.
       SkipUntil(tok::comma, tok::greater, true, true);
     }
-    
+
     // Did we find a comma or the end of the template parmeter list?
-    if(Tok.is(tok::comma)) {
+    if (Tok.is(tok::comma)) {
       ConsumeToken();
-    } else if(Tok.is(tok::greater)) {
+    } else if (Tok.is(tok::greater)) {
       // Don't consume this... that's done by template parser.
       break;
     } else {
@@ -338,16 +338,16 @@
 ///         'typename' identifier[opt] '=' type-id
 ///         'template' ...[opt][C++0x] '<' template-parameter-list '>' 'class' identifier[opt]
 ///         'template' '<' template-parameter-list '>' 'class' identifier[opt] = id-expression
-Parser::DeclPtrTy 
+Parser::DeclPtrTy
 Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) {
-  if(Tok.is(tok::kw_class) ||
-     (Tok.is(tok::kw_typename) && 
-         // FIXME: Next token has not been annotated!
-	 NextToken().isNot(tok::annot_typename))) {
+  if (Tok.is(tok::kw_class) ||
+      (Tok.is(tok::kw_typename) &&
+       // FIXME: Next token has not been annotated!
+       NextToken().isNot(tok::annot_typename))) {
     return ParseTypeParameter(Depth, Position);
   }
-  
-  if(Tok.is(tok::kw_template))
+
+  if (Tok.is(tok::kw_template))
     return ParseTemplateTemplateParameter(Depth, Position);
 
   // If it's none of the above, then it must be a parameter declaration.
@@ -367,7 +367,7 @@
 ///         'typename' identifier[opt] '=' type-id
 Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){
   assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) &&
-	 "A type-parameter starts with 'class' or 'typename'");
+         "A type-parameter starts with 'class' or 'typename'");
 
   // Consume the 'class' or 'typename' keyword.
   bool TypenameKeyword = Tok.is(tok::kw_typename);
@@ -379,33 +379,33 @@
   if (Tok.is(tok::ellipsis)) {
     Ellipsis = true;
     EllipsisLoc = ConsumeToken();
-    
-    if (!getLang().CPlusPlus0x) 
+
+    if (!getLang().CPlusPlus0x)
       Diag(EllipsisLoc, diag::err_variadic_templates);
   }
-  
+
   // Grab the template parameter name (if given)
   SourceLocation NameLoc;
   IdentifierInfo* ParamName = 0;
-  if(Tok.is(tok::identifier)) {
+  if (Tok.is(tok::identifier)) {
     ParamName = Tok.getIdentifierInfo();
     NameLoc = ConsumeToken();
-  } else if(Tok.is(tok::equal) || Tok.is(tok::comma) ||
-	    Tok.is(tok::greater)) {
+  } else if (Tok.is(tok::equal) || Tok.is(tok::comma) ||
+            Tok.is(tok::greater)) {
     // Unnamed template parameter. Don't have to do anything here, just
     // don't consume this token.
   } else {
     Diag(Tok.getLocation(), diag::err_expected_ident);
     return DeclPtrTy();
   }
-  
+
   DeclPtrTy TypeParam = Actions.ActOnTypeParameter(CurScope, TypenameKeyword,
                                                    Ellipsis, EllipsisLoc,
                                                    KeyLoc, ParamName, NameLoc,
                                                    Depth, Position);
 
   // Grab a default type id (if given).
-  if(Tok.is(tok::equal)) {
+  if (Tok.is(tok::equal)) {
     SourceLocation EqualLoc = ConsumeToken();
     SourceLocation DefaultLoc = Tok.getLocation();
     TypeResult DefaultType = ParseTypeName();
@@ -413,12 +413,12 @@
       Actions.ActOnTypeParameterDefault(TypeParam, EqualLoc, DefaultLoc,
                                         DefaultType.get());
   }
-  
+
   return TypeParam;
 }
 
 /// ParseTemplateTemplateParameter - Handle the parsing of template
-/// template parameters. 
+/// template parameters.
 ///
 ///       type-parameter:    [C++ temp.param]
 ///         'template' '<' template-parameter-list '>' 'class' identifier[opt]
@@ -429,11 +429,11 @@
 
   // Handle the template <...> part.
   SourceLocation TemplateLoc = ConsumeToken();
-  TemplateParameterList TemplateParams; 
+  TemplateParameterList TemplateParams;
   SourceLocation LAngleLoc, RAngleLoc;
   {
     ParseScope TemplateParmScope(this, Scope::TemplateParamScope);
-    if(ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc,
+    if (ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc,
                                RAngleLoc)) {
       return DeclPtrTy();
     }
@@ -441,8 +441,8 @@
 
   // Generate a meaningful error if the user forgot to put class before the
   // identifier, comma, or greater.
-  if(!Tok.is(tok::kw_class)) {
-    Diag(Tok.getLocation(), diag::err_expected_class_before) 
+  if (!Tok.is(tok::kw_class)) {
+    Diag(Tok.getLocation(), diag::err_expected_class_before)
       << PP.getSpelling(Tok);
     return DeclPtrTy();
   }
@@ -451,10 +451,10 @@
   // Get the identifier, if given.
   SourceLocation NameLoc;
   IdentifierInfo* ParamName = 0;
-  if(Tok.is(tok::identifier)) {
+  if (Tok.is(tok::identifier)) {
     ParamName = Tok.getIdentifierInfo();
     NameLoc = ConsumeToken();
-  } else if(Tok.is(tok::equal) || Tok.is(tok::comma) || Tok.is(tok::greater)) {
+  } else if (Tok.is(tok::equal) || Tok.is(tok::comma) || Tok.is(tok::greater)) {
     // Unnamed template parameter. Don't have to do anything here, just
     // don't consume this token.
   } else {
@@ -462,10 +462,10 @@
     return DeclPtrTy();
   }
 
-  TemplateParamsTy *ParamList = 
+  TemplateParamsTy *ParamList =
     Actions.ActOnTemplateParameterList(Depth, SourceLocation(),
                                        TemplateLoc, LAngleLoc,
-                                       &TemplateParams[0], 
+                                       &TemplateParams[0],
                                        TemplateParams.size(),
                                        RAngleLoc);
 
@@ -489,7 +489,7 @@
 }
 
 /// ParseNonTypeTemplateParameter - Handle the parsing of non-type
-/// template parameters (e.g., in "template<int Size> class array;"). 
+/// template parameters (e.g., in "template<int Size> class array;").
 ///
 ///       template-parameter:
 ///         ...
@@ -501,7 +501,7 @@
 /// parameters.
 /// FIXME: We need to make a ParseParameterDeclaration that works for
 /// non-type template parameters and normal function parameters.
-Parser::DeclPtrTy 
+Parser::DeclPtrTy
 Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
   SourceLocation StartLoc = Tok.getLocation();
 
@@ -524,7 +524,7 @@
     return DeclPtrTy();
   }
 
-  // Create the parameter. 
+  // Create the parameter.
   DeclPtrTy Param = Actions.ActOnNonTypeTemplateParameter(CurScope, ParamDecl,
                                                           Depth, Position);
 
@@ -537,16 +537,16 @@
     //   template-parameter, the first non-nested > is taken as the
     //   end of the template-parameter-list rather than a greater-than
     //   operator.
-    GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);   
+    GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);
 
     OwningExprResult DefaultArg = ParseAssignmentExpression();
     if (DefaultArg.isInvalid())
       SkipUntil(tok::comma, tok::greater, true, true);
     else if (Param)
-      Actions.ActOnNonTypeTemplateParameterDefault(Param, EqualLoc, 
+      Actions.ActOnNonTypeTemplateParameterDefault(Param, EqualLoc,
                                                    move(DefaultArg));
   }
-  
+
   return Param;
 }
 
@@ -568,9 +568,9 @@
 /// token that forms the template-id. Otherwise, we will leave the
 /// last token in the stream (e.g., so that it can be replaced with an
 /// annotation token).
-bool 
+bool
 Parser::ParseTemplateIdAfterTemplateName(TemplateTy Template,
-                                         SourceLocation TemplateNameLoc, 
+                                         SourceLocation TemplateNameLoc,
                                          const CXXScopeSpec *SS,
                                          bool ConsumeLastToken,
                                          SourceLocation &LAngleLoc,
@@ -628,7 +628,7 @@
 
   return false;
 }
-                                              
+
 /// \brief Replace the tokens that form a simple-template-id with an
 /// annotation token containing the complete template-id.
 ///
@@ -667,7 +667,7 @@
 /// formed, this function returns true.
 ///
 bool Parser::AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK,
-                                     const CXXScopeSpec *SS, 
+                                     const CXXScopeSpec *SS,
                                      SourceLocation TemplateKWLoc,
                                      bool AllowTypeAnnotation) {
   assert(getLang().CPlusPlus && "Can only annotate template-ids in C++");
@@ -684,12 +684,12 @@
   TemplateArgIsTypeList TemplateArgIsType;
   TemplateArgLocationList TemplateArgLocations;
   bool Invalid = ParseTemplateIdAfterTemplateName(Template, TemplateNameLoc,
-                                                  SS, false, LAngleLoc, 
-                                                  TemplateArgs, 
+                                                  SS, false, LAngleLoc,
+                                                  TemplateArgs,
                                                   TemplateArgIsType,
                                                   TemplateArgLocations,
                                                   RAngleLoc);
-  
+
   if (Invalid) {
     // If we failed to parse the template ID but skipped ahead to a >, we're not
     // going to be able to form a token annotation.  Eat the '>' if present.
@@ -704,7 +704,7 @@
 
   // Build the annotation token.
   if (TNK == TNK_Type_template && AllowTypeAnnotation) {
-    Action::TypeResult Type 
+    Action::TypeResult Type
       = Actions.ActOnTemplateIdType(Template, TemplateNameLoc,
                                     LAngleLoc, TemplateArgsPtr,
                                     &TemplateArgLocations[0],
@@ -723,13 +723,13 @@
       Tok.setLocation(SS->getBeginLoc());
     else if (TemplateKWLoc.isValid())
       Tok.setLocation(TemplateKWLoc);
-    else 
+    else
       Tok.setLocation(TemplateNameLoc);
   } else {
     // Build a template-id annotation token that can be processed
     // later.
     Tok.setKind(tok::annot_template_id);
-    TemplateIdAnnotation *TemplateId 
+    TemplateIdAnnotation *TemplateId
       = TemplateIdAnnotation::Allocate(TemplateArgs.size());
     TemplateId->TemplateNameLoc = TemplateNameLoc;
     TemplateId->Name = Name;
@@ -772,21 +772,21 @@
 void Parser::AnnotateTemplateIdTokenAsType(const CXXScopeSpec *SS) {
   assert(Tok.is(tok::annot_template_id) && "Requires template-id tokens");
 
-  TemplateIdAnnotation *TemplateId 
+  TemplateIdAnnotation *TemplateId
     = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
   assert((TemplateId->Kind == TNK_Type_template ||
           TemplateId->Kind == TNK_Dependent_template_name) &&
          "Only works for type and dependent templates");
-  
-  ASTTemplateArgsPtr TemplateArgsPtr(Actions, 
+
+  ASTTemplateArgsPtr TemplateArgsPtr(Actions,
                                      TemplateId->getTemplateArgs(),
                                      TemplateId->getTemplateArgIsType(),
                                      TemplateId->NumArgs);
 
-  Action::TypeResult Type 
+  Action::TypeResult Type
     = Actions.ActOnTemplateIdType(TemplateTy::make(TemplateId->Template),
                                   TemplateId->TemplateNameLoc,
-                                  TemplateId->LAngleLoc, 
+                                  TemplateId->LAngleLoc,
                                   TemplateArgsPtr,
                                   TemplateId->getTemplateArgLocations(),
                                   TemplateId->RAngleLoc);
@@ -839,7 +839,7 @@
 ///       template-argument-list: [C++ 14.2]
 ///         template-argument
 ///         template-argument-list ',' template-argument
-bool 
+bool
 Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs,
                                   TemplateArgIsTypeList &TemplateArgIsType,
                               TemplateArgLocationList &TemplateArgLocations) {
@@ -867,18 +867,18 @@
   return Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater);
 }
 
-/// \brief Parse a C++ explicit template instantiation 
+/// \brief Parse a C++ explicit template instantiation
 /// (C++ [temp.explicit]).
 ///
 ///       explicit-instantiation:
 ///         'extern' [opt] 'template' declaration
 ///
 /// Note that the 'extern' is a GNU extension and C++0x feature.
-Parser::DeclPtrTy 
+Parser::DeclPtrTy
 Parser::ParseExplicitInstantiation(SourceLocation ExternLoc,
                                    SourceLocation TemplateLoc,
                                    SourceLocation &DeclEnd) {
-  return ParseSingleDeclarationAfterTemplate(Declarator::FileContext, 
+  return ParseSingleDeclarationAfterTemplate(Declarator::FileContext,
                                              ParsedTemplateInfo(ExternLoc,
                                                                 TemplateLoc),
                                              DeclEnd, AS_none);