diff options
author | Mike Stump <mrs@apple.com> | 2009-09-09 15:08:12 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-09-09 15:08:12 +0000 |
commit | 1eb4433ac451dc16f4133a88af2d002ac26c58ef (patch) | |
tree | 07065b80cb7787bb7b9ffcb985196007a57e86f7 /lib/Sema/TreeTransform.h | |
parent | 79d39f92590cf2e91bf81486b02cd1156d13ca54 (diff) |
Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/TreeTransform.h')
-rw-r--r-- | lib/Sema/TreeTransform.h | 2219 |
1 files changed, 1109 insertions, 1110 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index d19653d157..bd7fb4f2f8 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -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 @@ namespace clang { /// 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 @@ namespace clang { /// 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 @@ namespace clang { /// \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 @@ namespace clang { /// 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 @@ template<typename Derived> 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 @@ public: /// 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 @@ public: /// \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 @@ public: /// 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 @@ public: /// /// \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 @@ public: /// /// \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 @@ public: /// \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 @@ public: /// 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 @@ public: /// \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 @@ public: /// 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 @@ public: /// /// 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 @@ public: /// /// 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 @@ public: /// 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 @@ public: /// 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: /// /// 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: /*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 @@ public: } /// \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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: } /// \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 @@ public: 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 @@ public: /*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 @@ public: ExprArg LHS, SourceLocation ColonLoc, |