diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-08-08 18:46:20 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-08-08 18:46:20 +0000 |
commit | 4a9d795502f8e001cdc6465ea7a0739ca48dd483 (patch) | |
tree | e3712fc3ce158fd5038dce8caadb1dfd3c288b25 /lib | |
parent | 919e8a1c6698bfa6848571d366430126bced727d (diff) |
Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161516 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/TreeTransform.h | 1144 |
1 files changed, 572 insertions, 572 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 76cd51f3e8..6b211b09a1 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -98,25 +98,25 @@ class TreeTransform { class ForgetPartiallySubstitutedPackRAII { Derived &Self; TemplateArgument Old; - + public: ForgetPartiallySubstitutedPackRAII(Derived &Self) : Self(Self) { Old = Self.ForgetPartiallySubstitutedPack(); } - + ~ForgetPartiallySubstitutedPackRAII() { Self.RememberPartiallySubstitutedPack(Old); } }; - + protected: Sema &SemaRef; - + /// \brief The set of local declarations that have been transformed, for /// cases where we are forced to build new declarations within the transformer /// rather than in the subclass (e.g., lambda closure types). llvm::DenseMap<Decl *, Decl *> TransformedLocalDecls; - + public: /// \brief Initializes a new tree transformer. TreeTransform(Sema &SemaRef) : SemaRef(SemaRef) { } @@ -177,7 +177,7 @@ public: DeclarationName Entity) : Self(Self) { OldLocation = Self.getDerived().getBaseLocation(); OldEntity = Self.getDerived().getBaseEntity(); - + if (Location.isValid()) Self.getDerived().setBase(Location, Entity); } @@ -207,7 +207,7 @@ public: bool DropCallArgument(Expr *E) { return E->isDefaultArgument(); } - + /// \brief Determine whether we should expand a pack expansion with the /// given set of parameter packs into separate arguments by repeatedly /// transforming the pattern. @@ -221,7 +221,7 @@ public: /// \param PatternRange The source range that covers the entire pattern of /// the pack expansion. /// - /// \param Unexpanded The set of unexpanded parameter packs within the + /// \param Unexpanded The set of unexpanded parameter packs within the /// pattern. /// /// \param ShouldExpand Will be set to \c true if the transformer should @@ -241,9 +241,9 @@ public: /// The callee must set this value when \c ShouldExpand is \c true; it may /// set this value in other cases. /// - /// \returns true if an error occurred (e.g., because the parameter packs - /// are to be instantiated with arguments of different lengths), false - /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions) + /// \returns true if an error occurred (e.g., because the parameter packs + /// are to be instantiated with arguments of different lengths), false + /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions) /// must be set. bool TryExpandParameterPacks(SourceLocation EllipsisLoc, SourceRange PatternRange, @@ -254,7 +254,7 @@ public: ShouldExpand = false; return false; } - + /// \brief "Forget" about the partially-substituted pack template argument, /// when performing an instantiation that must preserve the parameter pack /// use. @@ -263,18 +263,18 @@ public: TemplateArgument ForgetPartiallySubstitutedPack() { return TemplateArgument(); } - + /// \brief "Remember" the partially-substituted pack template argument /// after performing an instantiation that must preserve the parameter pack /// use. /// /// This routine is meant to be overridden by the template instantiator. void RememberPartiallySubstitutedPack(TemplateArgument Arg) { } - + /// \brief Note to the derived class when a function parameter pack is /// being expanded. void ExpandingFunctionParameterPack(ParmVarDecl *Pack) { } - + /// \brief Transforms the given type into another type. /// /// By default, this routine transforms a type by creating a @@ -325,8 +325,8 @@ public: /// \brief Transform the given list of expressions. /// - /// This routine transforms a list of expressions by invoking - /// \c TransformExpr() for each subexpression. However, it also provides + /// This routine transforms a list of expressions by invoking + /// \c TransformExpr() for each subexpression. However, it also provides /// support for variadic templates by expanding any pack expansions (if the /// derived class permits such expansion) along the way. When pack expansions /// are present, the number of outputs may not equal the number of inputs. @@ -336,7 +336,7 @@ public: /// \param NumInputs The number of expressions in \c Inputs. /// /// \param IsCall If \c true, then this transform is being performed on - /// function-call arguments, and any arguments that should be dropped, will + /// function-call arguments, and any arguments that should be dropped, will /// be. /// /// \param Outputs The transformed input expressions will be added to this @@ -349,61 +349,61 @@ public: bool TransformExprs(Expr **Inputs, unsigned NumInputs, bool IsCall, SmallVectorImpl<Expr *> &Outputs, bool *ArgChanged = 0); - + /// \brief Transform the given declaration, which is referenced from a type /// or expression. /// /// By default, acts as the identity function on declarations, unless the /// transformer has had to transform the declaration itself. Subclasses /// may override this function to provide alternate behavior. - Decl *TransformDecl(SourceLocation Loc, Decl *D) { + Decl *TransformDecl(SourceLocation Loc, Decl *D) { llvm::DenseMap<Decl *, Decl *>::iterator Known = TransformedLocalDecls.find(D); if (Known != TransformedLocalDecls.end()) return Known->second; - - return D; + + return D; } - /// \brief Transform the attributes associated with the given declaration and + /// \brief Transform the attributes associated with the given declaration and /// place them on the new declaration. /// /// By default, this operation does nothing. Subclasses may override this /// behavior to transform attributes. void transformAttrs(Decl *Old, Decl *New) { } - + /// \brief Note that a local declaration has been transformed by this /// transformer. /// - /// Local declarations are typically transformed via a call to + /// Local declarations are typically transformed via a call to /// TransformDefinition. However, in some cases (e.g., lambda expressions), /// the transformer itself has to transform the declarations. This routine /// can be overridden by a subclass that keeps track of such mappings. void transformedLocalDecl(Decl *Old, Decl *New) { TransformedLocalDecls[Old] = New; } - + /// \brief Transform the definition of the given declaration. /// /// By default, invokes TransformDecl() to transform the declaration. /// Subclasses may override this function to provide alternate behavior. - Decl *TransformDefinition(SourceLocation Loc, Decl *D) { - return getDerived().TransformDecl(Loc, D); + Decl *TransformDefinition(SourceLocation Loc, Decl *D) { + return getDerived().TransformDecl(Loc, D); } /// \brief Transform the given declaration, which was the first part of a /// nested-name-specifier in a member access expression. /// - /// This specific declaration transformation only applies to the first + /// This specific declaration transformation only applies to the first /// identifier in a nested-name-specifier of a member access expression, e.g., /// the \c T in \c x->T::member /// /// By default, invokes TransformDecl() to transform the declaration. /// Subclasses may override this function to provide alternate behavior. - NamedDecl *TransformFirstQualifierInScope(NamedDecl *D, SourceLocation Loc) { - return cast_or_null<NamedDecl>(getDerived().TransformDecl(Loc, D)); + NamedDecl *TransformFirstQualifierInScope(NamedDecl *D, SourceLocation Loc) { + return cast_or_null<NamedDecl>(getDerived().TransformDecl(Loc, D)); } - + /// \brief Transform the given nested-name-specifier with source-location /// information. /// @@ -433,7 +433,7 @@ public: /// /// \param NameLoc The source location of the template name. /// - /// \param ObjectType If we're translating a template name within a member + /// \param ObjectType If we're translating a template name within a member /// access expression, this is the type of the object whose member template /// is being referenced. /// @@ -463,7 +463,7 @@ public: /// \brief Transform the given set of template arguments. /// - /// By default, this operation transforms all of the template arguments + /// By default, this operation transforms all of the template arguments /// in the input set using \c TransformTemplateArgument(), and appends /// the transformed arguments to the output list. /// @@ -487,9 +487,9 @@ public: /// \brief Transform the given set of template arguments. /// - /// By default, this operation transforms all of the template arguments + /// By default, this operation transforms all of the template arguments /// in the input set using \c TransformTemplateArgument(), and appends - /// the transformed arguments to the output list. + /// the transformed arguments to the output list. /// /// \param First An iterator to the first template argument. /// @@ -527,18 +527,18 @@ public: StmtResult TransformSEHHandler(Stmt *Handler); - QualType + QualType TransformTemplateSpecializationType(TypeLocBuilder &TLB, TemplateSpecializationTypeLoc TL, TemplateName Template); - QualType + QualType TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB, DependentTemplateSpecializationTypeLoc TL, TemplateName Template, CXXScopeSpec &SS); - QualType + QualType TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB, DependentTemplateSpecializationTypeLoc TL, NestedNameSpecifierLoc QualifierLoc); @@ -784,8 +784,8 @@ public: ElaboratedTypeKeyword Keyword, NestedNameSpecifierLoc QualifierLoc, QualType Named) { - return SemaRef.Context.getElaboratedType(Keyword, - QualifierLoc.getNestedNameSpecifier(), + return SemaRef.Context.getElaboratedType(Keyword, + QualifierLoc.getNestedNameSpecifier(), Named); } @@ -804,30 +804,30 @@ public: // TODO: avoid TemplateName abstraction CXXScopeSpec SS; SS.Adopt(QualifierLoc); - TemplateName InstName + TemplateName InstName = getDerived().RebuildTemplateName(SS, *Name, NameLoc, QualType(), 0); - + if (InstName.isNull()) return QualType(); - + // If it's still dependent, make a dependent specialization. if (InstName.getAsDependentTemplateName()) - return SemaRef.Context.getDependentTemplateSpecializationType(Keyword, - QualifierLoc.getNestedNameSpecifier(), - Name, + return SemaRef.Context.getDependentTemplateSpecializationType(Keyword, + QualifierLoc.getNestedNameSpecifier(), + Name, Args); - + // Otherwise, make an elaborated type wrapping a non-dependent // specialization. QualType T = getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args); if (T.isNull()) return QualType(); - + if (Keyword == ETK_None && QualifierLoc.getNestedNameSpecifier() == 0) return T; - - return SemaRef.Context.getElaboratedType(Keyword, - QualifierLoc.getNestedNameSpecifier(), + + return SemaRef.Context.getElaboratedType(Keyword, + QualifierLoc.getNestedNameSpecifier(), T); } @@ -847,8 +847,8 @@ public: if (QualifierLoc.getNestedNameSpecifier()->isDependent()) { // If the name is still dependent, just build a new dependent name type. if (!SemaRef.computeDeclContext(SS)) - return SemaRef.Context.getDependentNameType(Keyword, - QualifierLoc.getNestedNameSpecifier(), + return SemaRef.Context.getDependentNameType(Keyword, + QualifierLoc.getNestedNameSpecifier(), Id); } @@ -875,15 +875,15 @@ public: case LookupResult::NotFound: case LookupResult::NotFoundInCurrentInstantiation: break; - + case LookupResult::Found: Tag = Result.getAsSingle<TagDecl>(); break; - + case LookupResult::FoundOverloaded: case LookupResult::FoundUnresolvedValue: llvm_unreachable("Tag lookup cannot find non-tags"); - + case LookupResult::Ambiguous: // Let the LookupResult structure handle ambiguities. return QualType(); @@ -925,8 +925,8 @@ public: // Build the elaborated-type-specifier type. QualType T = SemaRef.Context.getTypeDeclType(Tag); - return SemaRef.Context.getElaboratedType(Keyword, - QualifierLoc.getNestedNameSpecifier(), + return SemaRef.Context.getElaboratedType(Keyword, + QualifierLoc.getNestedNameSpecifier(), T); } @@ -934,7 +934,7 @@ public: /// /// By default, builds a new PackExpansionType type from the given pattern. /// Subclasses may override this routine to provide different behavior. - QualType RebuildPackExpansionType(QualType Pattern, + QualType RebuildPackExpansionType(QualType Pattern, SourceRange PatternRange, SourceLocation EllipsisLoc, llvm::Optional<unsigned> NumExpansions) { @@ -984,7 +984,7 @@ public: QualType ObjectType); /// \brief Build a new template name given a template template parameter pack - /// and the + /// and the /// /// By default, performs semantic analysis to determine whether the name can /// be resolved to a specific template, then builds the appropriate kind of @@ -1064,7 +1064,7 @@ public: /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. StmtResult RebuildIfStmt(SourceLocation IfLoc, Sema::FullExprArg Cond, - VarDecl *CondVar, Stmt *Then, + VarDecl *CondVar, Stmt *Then, SourceLocation ElseLoc, Stmt *Else) { return getSema().ActOnIfStmt(IfLoc, Cond, CondVar, Then, ElseLoc, Else); } @@ -1075,7 +1075,7 @@ public: /// Subclasses may override this routine to provide different behavior. StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, Expr *Cond, VarDecl *CondVar) { - return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Cond, + return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Cond, CondVar); } @@ -1113,10 +1113,10 @@ public: /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. StmtResult RebuildForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, - Stmt *Init, Sema::FullExprArg Cond, + Stmt *Init, Sema::FullExprArg Cond, VarDecl *CondVar, Sema::FullExprArg Inc, SourceLocation RParenLoc, Stmt *Body) { - return getSema().ActOnForStmt(ForLoc, LParenLoc, Init, Cond, + return getSema().ActOnForStmt(ForLoc, LParenLoc, Init, Cond, CondVar, Inc, RParenLoc, Body); } @@ -1174,7 +1174,7 @@ public: MultiExprArg Clobbers, SourceLocation RParenLoc, bool MSAsm) { - return getSema().ActOnAsmStmt(AsmLoc, IsSimple, IsVolatile, NumOutputs, + return getSema().ActOnAsmStmt(AsmLoc, IsSimple, IsVolatile, NumOutputs, NumInputs, Names, move(Constraints), Exprs, AsmString, Clobbers, RParenLoc, MSAsm); @@ -1214,7 +1214,7 @@ public: ExceptionDecl->getLocation(), ExceptionDecl->getIdentifier()); } - + /// \brief Build a new Objective-C \@catch statement. /// /// By default, performs semantic analysis to build the new statement. @@ -1226,7 +1226,7 @@ public: return getSema().ActOnObjCAtCatchStmt(AtLoc, RParenLoc, Var, Body); } - + /// \brief Build a new Objective-C \@finally statement. /// /// By default, performs semantic analysis to build the new statement. @@ -1235,7 +1235,7 @@ public: Stmt *Body) { return getSema().ActOnObjCAtFinallyStmt(AtLoc, Body); } - + /// \brief Build a new Objective-C \@throw statement. /// /// By default, performs semantic analysis to build the new statement. @@ -1244,7 +1244,7 @@ public: Expr *Operand) { return getSema().BuildObjCAtThrowStmt(AtLoc, Operand); } - + /// \brief Rebuild the operand to an Objective-C \@synchronized statement. /// /// By default, performs semantic analysis to build the new statement. @@ -1291,7 +1291,7 @@ public: return getSema().FinishObjCForCollectionStmt(ForEachStmt.take(), Body); } - + /// \brief Build a new C++ exception declaration. /// /// By default, performs semantic analysis to build the new decaration. @@ -1347,7 +1347,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - StmtResult RebuildMSDependentExistsStmt(SourceLocation KeywordLoc, + StmtResult RebuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, @@ -1363,7 +1363,7 @@ public: StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body) { return getSema().FinishCXXForRangeStmt(ForRange, Body); } - + StmtResult RebuildSEHTryStmt(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, @@ -1453,8 +1453,8 @@ public: return getSema().BuildBuiltinOffsetOf(OperatorLoc, Type, Components, NumComponents, RParenLoc); } - - /// \brief Build a new sizeof, alignof or vec_step expression with a + + /// \brief Build a new sizeof, alignof or vec_step expression with a /// type argument. /// /// By default, performs semantic analysis to build the new expression. @@ -1642,7 +1642,7 @@ public: = SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc); if (Result.isInvalid() || ResultTy->isDependentType()) return move(Result); - + // Patch in the result type we were given, which may have been computed // when the initial InitListExpr was built. InitListExpr *ILE = cast<InitListExpr>((Expr *)Result.get()); @@ -1892,7 +1892,7 @@ public: SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc) { - return getSema().BuildCXXTypeId(TypeInfoType, TypeidLoc, Operand, + return getSema().BuildCXXTypeId(TypeInfoType, TypeidLoc, Operand, RParenLoc); } @@ -1917,7 +1917,7 @@ public: SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc) { - return getSema().BuildCXXUuidof(TypeInfoType, TypeidLoc, Operand, + return getSema().BuildCXXUuidof(TypeInfoType, TypeidLoc, Operand, RParenLoc); } @@ -1961,7 +1961,7 @@ public: /// By default, builds a new default-argument expression, which does not /// require any semantic analysis. Subclasses may override this routine to /// provide different behavior. - ExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc, + ExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc, ParmVarDecl *Param) { return getSema().Owned(CXXDefaultArgExpr::Create(getSema().Context, Loc, Param)); @@ -2051,7 +2051,7 @@ public: SourceLocation RParenLoc) { return getSema().BuildTypeTrait(Trait, StartLoc, Args, RParenLoc); } - + /// \brief Build a new array type trait expression. /// /// By default, performs semantic analysis to build the new expression. @@ -2122,10 +2122,10 @@ public: CXXConstructExpr::ConstructionKind ConstructKind, SourceRange ParenRange) { ASTOwningVector<Expr*> ConvertedArgs(SemaRef); - if (getSema().CompleteConstructorCall(Constructor, move(Args), Loc, + if (getSema().CompleteConstructorCall(Constructor, move(Args), Loc, ConvertedArgs)) return ExprError(); - + return getSema().BuildCXXConstructExpr(Loc, T, Constructor, IsElidable, move_arg(ConvertedArgs), HadMultipleCandidates, @@ -2216,17 +2216,17 @@ public: } /// \brief Build a new expression to compute the length of a parameter pack. - ExprResult RebuildSizeOfPackExpr(SourceLocation OperatorLoc, NamedDecl *Pack, - SourceLocation PackLoc, + ExprResult RebuildSizeOfPackExpr(SourceLocation OperatorLoc, NamedDecl *Pack, + SourceLocation PackLoc, SourceLocation RParenLoc, llvm::Optional<unsigned> Length) { if (Length) - return new (SemaRef.Context) SizeOfPackExpr(SemaRef.Context.getSizeType(), - OperatorLoc, Pack, PackLoc, + return new (SemaRef.Context) SizeOfPackExpr(SemaRef.Context.getSizeType(), + OperatorLoc, Pack, PackLoc, RParenLoc, *Length); - - return new (SemaRef.Context) SizeOfPackExpr(SemaRef.Context.getSizeType(), - OperatorLoc, Pack, PackLoc, + + return new (SemaRef.Context) SizeOfPackExpr(SemaRef.Context.getSizeType(), + OperatorLoc, Pack, PackLoc, RParenLoc); } @@ -2237,18 +2237,18 @@ public: ExprResult RebuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { return getSema().BuildObjCBoxedExpr(SR, ValueExpr); } - + /// \brief Build a new Objective-C array literal. /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. ExprResult RebuildObjCArrayLiteral(SourceRange Range, Expr **Elements, unsigned NumElements) { - return getSema().BuildObjCArrayLiteral(Range, + return getSema().BuildObjCArrayLiteral(Range, MultiExprArg(Elements, NumElements)); } - - ExprResult RebuildObjCSubscriptRefExpr(SourceLocation RB, + + ExprResult RebuildObjCSubscriptRefExpr(SourceLocation RB, Expr *Base, Expr *Key, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod) { @@ -2265,7 +2265,7 @@ public: unsigned NumElements) { return getSema().BuildObjCDictionaryLiteral(Range, Elements, NumElements); } - + /// \brief Build a new Objective-C \@encode expression. /// /// By default, performs semantic analysis to build the new expression. @@ -2282,7 +2282,7 @@ public: Selector Sel, ArrayRef<SourceLocation> SelectorLocs, ObjCMethodDecl *Method, - SourceLocation LBracLoc, + SourceLocation LBracLoc, MultiExprArg Args, SourceLocation RBracLoc) { return SemaRef.BuildClassMessage(ReceiverTypeInfo, @@ -2297,7 +2297,7 @@ public: Selector Sel, ArrayRef<SourceLocation> SelectorLocs, ObjCMethodDecl *Method, - SourceLocation LBracLoc, + SourceLocation LBracLoc, MultiExprArg Args, SourceLocation RBracLoc) { return SemaRef.BuildInstanceMessage(Receiver, @@ -2325,15 +2325,15 @@ public: false); if (Result.isInvalid() || Base.isInvalid()) return ExprError(); - + if (Result.get()) return move(Result); - + return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(), /*FIXME:*/IvarLoc, IsArrow, SS, SourceLocation(), /*FirstQualifierInScope=*/0, - R, + R, /*TemplateArgs=*/0); } @@ -2341,7 +2341,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - ExprResult RebuildObjCPropertyRefExpr(Expr *BaseArg, + ExprResult RebuildObjCPropertyRefExpr(Expr *BaseArg, ObjCPropertyDecl *Property, SourceLocation PropertyLoc) { CXXScopeSpec SS; @@ -2354,18 +2354,18 @@ public: SS, 0, false); if (Result.isInvalid() || Base.isInvalid()) return ExprError(); - + if (Result.get()) return move(Result); - + return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(), - /*FIXME:*/PropertyLoc, IsArrow, + /*FIXME:*/PropertyLoc, IsArrow, SS, SourceLocation(), /*FirstQualifierInScope=*/0, - R, + R, /*TemplateArgs=*/0); } - + /// \brief Build a new Objective-C property reference expression. /// /// By default, performs semantic analysis to build the new expression. @@ -2397,18 +2397,18 @@ public: SS, 0, false); if (Result.isInvalid() || Base.isInvalid()) return ExprError(); - + if (Result.get()) return move(Result); - + return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(), /*FIXME:*/IsaLoc, IsArrow, SS, SourceLocation(), /*FirstQualifierInScope=*/0, - R, + R, /*TemplateArgs=*/0); } - + /// \brief Build a new shuffle vector expression. /// /// By default, performs semantic analysis to build the new expression. @@ -2450,7 +2450,7 @@ public: /// \brief Build a new template argument pack expansion. /// /// By default, performs semantic analysis to build a new pack expansion - /// for a template argument. Subclasses may override this routine to provide + /// for a template argument. Subclasses may override this routine to provide /// different behavior. TemplateArgumentLoc RebuildPackExpansion(TemplateArgumentLoc Pattern, SourceLocation EllipsisLoc, @@ -2462,10 +2462,10 @@ public: EllipsisLoc, NumExpansions); if (Result.isInvalid()) return TemplateArgumentLoc(); - + return TemplateArgumentLoc(Result.get(), Result.get()); } - + case TemplateArgument::Template: return TemplateArgumentLoc(TemplateArgument( Pattern.getArgument().getAsTemplate(), @@ -2473,16 +2473,16 @@ public: Pattern.getTemplateQualifierLoc(), Pattern.getTemplateNameLoc(), EllipsisLoc); - + case TemplateArgument::Null: case TemplateArgument::Integral: case TemplateArgument::Declaration: case TemplateArgument::Pack: case TemplateArgument::TemplateExpansion: llvm_unreachable("Pack expansion pattern has no parameter packs"); - + case TemplateArgument::Type: - if (TypeSourceInfo *Expansion + if (TypeSourceInfo *Expansion = getSema().CheckPackExpansion(Pattern.getTypeSourceInfo(), EllipsisLoc, NumExpansions)) @@ -2490,14 +2490,14 @@ public: Expansion); break; } - + return TemplateArgumentLoc(); } - + /// \brief Build a new expression pack expansion. /// /// By default, performs semantic analysis to build a new pack expansion - /// for an expression. Subclasses may override this routine to provide + /// for an expression. Subclasses may override this routine to provide /// different behavior. ExprResult RebuildPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc, llvm::Optional<unsigned> NumExpansions) { @@ -2586,8 +2586,8 @@ ExprResult TreeTransform<Derived>::TransformExpr(Expr *E) { } template<typename Derived> -bool TreeTransform<Derived>::TransformExprs(Expr **Inputs, - unsigned NumInputs, +bool TreeTransform<Derived>::TransformExprs(Expr **Inputs, + unsigned NumInputs, bool IsCall, SmallVectorImpl<Expr *> &Outputs, bool *ArgChanged) { @@ -2596,17 +2596,17 @@ bool TreeTransform<Derived>::TransformExprs(Expr **Inputs, if (IsCall && getDerived().DropCallArgument(Inputs[I])) { if (ArgChanged) *ArgChanged = true; - + break; } - + if (PackExpansionExpr *Expansion = dyn_cast<PackExpansionExpr>(Inputs[I])) { Expr *Pattern = Expansion->getPattern(); - + SmallVector<UnexpandedParameterPack, 2> Unexpanded; getSema().collectUnexpandedParameterPacks(Pattern, Unexpanded); assert(!Unexpanded.empty() && "Pack expansion without parameter packs?"); - + // Determine whether the set of unexpanded parameter packs can and should // be expanded. bool Expand = true; @@ -2620,22 +2620,22 @@ bool TreeTransform<Derived>::TransformExprs(Expr **Inputs, Expand, RetainExpansion, NumExpansions)) return true; - + if (!Expand) { // The transform has determined that we should perform a simple - // transformation on the pack expansion, producing another pack + // transformation on the pack expansion, producing another pack // expansion. Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1); ExprResult OutPattern = getDerived().TransformExpr(Pattern); if (OutPattern.isInvalid()) return true; - - ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.get(), + + ExprResult Out = getDerived().RebuildPackExpansion(OutPattern.get(), Expansion->getEllipsisLoc(), NumExpansions); if (Out.isInvalid()) return true; - + if (ArgChanged) *ArgChanged = true; Outputs.push_back(Out.get()); @@ -2645,7 +2645,7 @@ bool TreeTransform<Derived>::TransformExprs(Expr **Inputs, // Record right away that the argument was changed. This needs // to happen even if the array expands to nothing. if (ArgChanged) *ArgChanged = true; - + // The transform has determined that we should perform an elementwise // expansion of the pattern. Do so. for (unsigned I = 0; I != *NumExpansions; ++I) { @@ -2660,23 +2660,23 @@ bool TreeTransform<Derived>::TransformExprs(Expr **Inputs, if (Out.isInvalid()) return true; } - + Outputs.push_back(Out.get()); } - + continue; } - + ExprResult Result = getDerived().TransformExpr(Inputs[I]); if (Result.isInvalid()) return true; - + if (Result.get() != Inputs[I] && ArgChanged) *ArgChanged = true; - - Outputs.push_back(Result.get()); + + Outputs.push_back(Result.get()); } - + return false; } @@ -2687,7 +2687,7 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc( QualType ObjectType, NamedDecl *FirstQualifierInScope) { SmallVector<NestedNameSpecifierLoc, 4> Qualifiers; - for (NestedNameSpecifierLoc Qualifier = NNS; Qualifier; + for (NestedNameSpecifierLoc Qualifier = NNS; Qualifier; Qualifier = Qualifier.getPrefix()) Qualifiers.push_back(Qualifier); @@ -2695,19 +2695,19 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc( while (!Qualifiers.empty()) { NestedNameSpecifierLoc Q = Qualifiers.pop_back_val(); NestedNameSpecifier *QNNS = Q.getNestedNameSpecifier(); - + switch (QNNS->getKind()) { case NestedNameSpecifier::Identifier: - if (SemaRef.BuildCXXNestedNameSpecifier(/*Scope=*/0, + if (SemaRef.BuildCXXNestedNameSpecifier(/*Scope=*/0, *QNNS->getAsIdentifier(), - Q.getLocalBeginLoc(), + Q.getLocalBeginLoc(), Q.getLocalEndLoc(), - ObjectType, false, SS, + ObjectType, false, SS, FirstQualifierInScope, false)) return NestedNameSpecifierLoc(); - + break; - + case NestedNameSpecifier::Namespace: { NamespaceDecl *NS = cast_or_null<NamespaceDecl>( @@ -2717,35 +2717,35 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc( SS.Extend(SemaRef.Context, NS, Q.getLocalBeginLoc(), Q.getLocalEndLoc()); break; } - + case NestedNameSpecifier::NamespaceAlias: { NamespaceAliasDecl *Alias = cast_or_null<NamespaceAliasDecl>( getDerived().TransformDecl(Q.getLocalBeginLoc(), QNNS->getAsNamespaceAlias())); - SS.Extend(SemaRef.Context, Alias, Q.getLocalBeginLoc(), + SS.Extend(SemaRef.Context, Alias, Q.getLocalBeginLoc(), Q.getLocalEndLoc()); break; } - + case NestedNameSpecifier::Global: // There is no meaningful transformation that one could perform on the // global scope. SS.MakeGlobal(SemaRef.Context, Q.getBeginLoc()); break; - + case NestedNameSpecifier::TypeSpecWithTemplate: case NestedNameSpecifier::TypeSpec: { TypeLoc TL = TransformTypeInObjectScope(Q.getTypeLoc(), ObjectType, FirstQualifierInScope, SS); - + if (!TL) return NestedNameSpecifierLoc(); - + if (TL.getT |