diff options
author | John McCall <rjmccall@apple.com> | 2010-08-24 06:29:42 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-24 06:29:42 +0000 |
commit | 60d7b3a319d84d688752be3870615ac0f111fb16 (patch) | |
tree | d6ff6a3cd161c984a956e3016ce2aa0b93bdf680 /lib/Sema | |
parent | 182f7093dd9dabbcf6df44b4ae004ead38804b48 (diff) |
OwningExprResult -> ExprResult. This patch brought to you by
M-x query-replace-regexp
\(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 60 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 146 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 78 | ||||
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 28 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 30 | ||||
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 40 | ||||
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 72 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 24 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 24 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 18 | ||||
-rw-r--r-- | lib/Sema/TreeTransform.h | 616 |
16 files changed, 584 insertions, 588 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index 72b58f4e43..56531c7f70 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -116,7 +116,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr, CastExpr::CastKind &Kind); /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's. -Action::OwningExprResult +ExprResult Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, ParsedType Ty, SourceLocation RAngleBracketLoc, @@ -133,7 +133,7 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceRange(LParenLoc, RParenLoc)); } -Action::OwningExprResult +ExprResult Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *DestTInfo, ExprArg Ex, SourceRange AngleBrackets, SourceRange Parens) { @@ -964,7 +964,7 @@ TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr, QualType DestType, (CStyle || !DestType->isReferenceType())) return TC_NotApplicable; - Sema::OwningExprResult Result + ExprResult Result = InitSeq.Perform(Self, Entity, InitKind, Action::MultiExprArg(Self, &SrcExpr, 1)); if (Result.isInvalid()) { diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 4e8c82fd7e..6148faaf90 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -121,9 +121,9 @@ bool Sema::CheckablePrintfAttr(const FormatAttr *Format, CallExpr *TheCall) { return false; } -Action::OwningExprResult +ExprResult Sema::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { - OwningExprResult TheCallResult(Owned(TheCall)); + ExprResult TheCallResult(Owned(TheCall)); switch (BuiltinID) { case Builtin::BI__builtin___CFStringMakeConstantString: @@ -390,8 +390,8 @@ bool Sema::CheckBlockCall(NamedDecl *NDecl, CallExpr *TheCall) { /// /// This function goes through and does final semantic checking for these /// builtins, -Sema::OwningExprResult -Sema::SemaBuiltinAtomicOverloaded(OwningExprResult TheCallResult) { +ExprResult +Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) { CallExpr *TheCall = (CallExpr *)TheCallResult.get(); DeclRefExpr *DRE =cast<DeclRefExpr>(TheCall->getCallee()->IgnoreParenCasts()); FunctionDecl *FDecl = cast<FunctionDecl>(DRE->getDecl()); @@ -746,7 +746,7 @@ bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) { /// SemaBuiltinShuffleVector - Handle __builtin_shufflevector. // This is declared to take (...), so we have to check everything. -Action::OwningExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) { +ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) { if (TheCall->getNumArgs() < 2) return ExprError(Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args_at_least) diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index fba670e595..649f70b7b4 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -3707,7 +3707,7 @@ void Sema::CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, // an instance method. QualType SuperTy = Context.getObjCInterfaceType(CDecl); SuperTy = Context.getObjCObjectPointerType(SuperTy); - OwningExprResult Super + ExprResult Super = Owned(new (Context) ObjCSuperExpr(SuperLoc, SuperTy)); return CodeCompleteObjCInstanceMessage(S, (Expr *)Super.get(), SelIdents, NumSelIdents); @@ -3733,7 +3733,7 @@ void Sema::CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, CXXScopeSpec SS; UnqualifiedId id; id.setIdentifier(Super, SuperLoc); - OwningExprResult SuperExpr = ActOnIdExpression(S, SS, id, false, false); + ExprResult SuperExpr = ActOnIdExpression(S, SS, id, false, false); return CodeCompleteObjCInstanceMessage(S, (Expr *)SuperExpr.get(), SelIdents, NumSelIdents); } diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 30cfb18706..944993b2c9 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2147,7 +2147,7 @@ static bool RebuildDeclaratorInCurrentInstantiation(Sema &S, Declarator &D, case DeclSpec::TST_typeofExpr: { Expr *E = DS.getRepAsExpr(); - OwningExprResult Result = S.RebuildExprInCurrentInstantiation(E); + ExprResult Result = S.RebuildExprInCurrentInstantiation(E); if (Result.isInvalid()) return true; DS.UpdateExprRep(Result.get()); break; @@ -4156,7 +4156,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { VDecl->setInvalidDecl(); } else if (!VDecl->isInvalidDecl()) { InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1); - OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, + ExprResult Result = InitSeq.Perform(*this, Entity, Kind, MultiExprArg(*this, &Init, 1), &DclT); if (Result.isInvalid()) { @@ -4227,7 +4227,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { Diag(VDecl->getLocation(), diag::warn_extern_init); if (!VDecl->isInvalidDecl()) { InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1); - OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, + ExprResult Result = InitSeq.Perform(*this, Entity, Kind, MultiExprArg(*this, &Init, 1), &DclT); if (Result.isInvalid()) { @@ -4465,8 +4465,8 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl, = InitializationKind::CreateDefault(Var->getLocation()); InitializationSequence InitSeq(*this, Entity, Kind, 0, 0); - OwningExprResult Init = InitSeq.Perform(*this, Entity, Kind, - MultiExprArg(*this, 0, 0)); + ExprResult Init = InitSeq.Perform(*this, Entity, Kind, + MultiExprArg(*this, 0, 0)); if (Init.isInvalid()) Var->setInvalidDecl(); else if (Init.get()) { diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index f30cbc53af..ee407a8859 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -126,7 +126,7 @@ Sema::SetParamDefaultArgument(ParmVarDecl *Param, Expr *Arg, InitializationKind Kind = InitializationKind::CreateCopy(Param->getLocation(), EqualLoc); InitializationSequence InitSeq(*this, Entity, Kind, &Arg, 1); - OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, + ExprResult Result = InitSeq.Perform(*this, Entity, Kind, MultiExprArg(*this, &Arg, 1)); if (Result.isInvalid()) return true; @@ -1317,7 +1317,7 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args, InitializationSequence InitSeq(*this, MemberEntity, Kind, Args, NumArgs); - OwningExprResult MemberInit = + ExprResult MemberInit = InitSeq.Perform(*this, MemberEntity, Kind, MultiExprArg(*this, Args, NumArgs), 0); if (MemberInit.isInvalid()) @@ -1409,7 +1409,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, if (Dependent) { // Can't check initialization for a base of dependent type or when // any of the arguments are type-dependent expressions. - OwningExprResult BaseInit + ExprResult BaseInit = Owned(new (Context) ParenListExpr(Context, LParenLoc, Args, NumArgs, RParenLoc)); @@ -1448,7 +1448,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, InitializationSequence InitSeq(*this, BaseEntity, Kind, Args, NumArgs); - OwningExprResult BaseInit = + ExprResult BaseInit = InitSeq.Perform(*this, BaseEntity, Kind, MultiExprArg(*this, Args, NumArgs), 0); if (BaseInit.isInvalid()) @@ -1473,7 +1473,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, for (unsigned I = 0; I != NumArgs; ++I) Args[I]->Retain(); - OwningExprResult Init + ExprResult Init = Owned(new (Context) ParenListExpr(Context, LParenLoc, Args, NumArgs, RParenLoc)); return new (Context) CXXBaseOrMemberInitializer(Context, BaseTInfo, @@ -1508,7 +1508,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, = InitializedEntity::InitializeBase(SemaRef.Context, BaseSpec, IsInheritedVirtualBase); - Sema::OwningExprResult BaseInit; + ExprResult BaseInit; switch (ImplicitInitKind) { case IIK_Default: { @@ -1597,7 +1597,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, Sema::LookupMemberName); MemberLookup.addDecl(Field, AS_public); MemberLookup.resolveKind(); - Sema::OwningExprResult CopyCtorArg + ExprResult CopyCtorArg = SemaRef.BuildMemberReferenceExpr(MemberExprBase, ParamType, Loc, /*IsArrow=*/false, @@ -1633,7 +1633,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, IndexVariables.push_back(IterationVar); // Create a reference to the iteration variable. - Sema::OwningExprResult IterationVarRef + ExprResult IterationVarRef = SemaRef.BuildDeclRefExpr(IterationVar, SizeType, Loc); assert(!IterationVarRef.isInvalid() && "Reference to invented variable cannot fail!"); @@ -1668,7 +1668,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, InitializationSequence InitSeq(SemaRef, Entities.back(), InitKind, &CopyCtorArgE, 1); - Sema::OwningExprResult MemberInit + ExprResult MemberInit = InitSeq.Perform(SemaRef, Entities.back(), InitKind, Sema::MultiExprArg(SemaRef, &CopyCtorArgE, 1)); MemberInit = SemaRef.MaybeCreateCXXExprWithTemporaries(MemberInit.get()); @@ -1694,7 +1694,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, InitializationKind::CreateDefault(Loc); InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, 0, 0); - Sema::OwningExprResult MemberInit = + ExprResult MemberInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, Sema::MultiExprArg(SemaRef, 0, 0)); if (MemberInit.isInvalid()) @@ -4540,7 +4540,7 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation, /// \param Depth Internal parameter recording the depth of the recursion. /// /// \returns A statement or a loop that copies the expressions. -static OwningStmtResult +static StmtResult BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, Expr *To, Expr *From, bool CopyingBaseSubobject, unsigned Depth = 0) { @@ -4600,7 +4600,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, T.getTypePtr())); // Create the reference to operator=. - OwningExprResult OpEqualRef + ExprResult OpEqualRef = S.BuildMemberReferenceExpr(To, T, Loc, /*isArrow=*/false, SS, /*FirstQualifierInScope=*/0, OpLookup, /*TemplateArgs=*/0, @@ -4610,7 +4610,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, // Build the call to the assignment operator. - OwningExprResult Call = S.BuildCallToMemberFunction(/*Scope=*/0, + ExprResult Call = S.BuildCallToMemberFunction(/*Scope=*/0, OpEqualRef.takeAs<Expr>(), Loc, &From, 1, 0, Loc); if (Call.isInvalid()) @@ -4623,7 +4623,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, // operator is used. const ConstantArrayType *ArrayTy = S.Context.getAsConstantArrayType(T); if (!ArrayTy) { - OwningExprResult Assignment = S.CreateBuiltinBinOp(Loc, + ExprResult Assignment = S.CreateBuiltinBinOp(Loc, BinaryOperator::Assign, To, From); @@ -4690,7 +4690,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, IterationVarRef, Loc)); // Build the copy for an individual element of the array. - OwningStmtResult Copy = BuildSingleCopyAssign(S, Loc, + StmtResult Copy = BuildSingleCopyAssign(S, Loc, ArrayTy->getElementType(), To, From, CopyingBaseSubobject, Depth+1); @@ -4970,7 +4970,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, ImplicitCastExpr::LValue, &BasePath); // Dereference "this". - OwningExprResult To = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref, This); + ExprResult To = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref, This); // Implicitly cast "this" to the appropriately-qualified base type. Expr *ToE = To.takeAs<Expr>(); @@ -4982,7 +4982,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, To = Owned(ToE); // Build the copy. - OwningStmtResult Copy = BuildSingleCopyAssign(*this, Loc, BaseType, + StmtResult Copy = BuildSingleCopyAssign(*this, Loc, BaseType, To.get(), From, /*CopyingBaseSubobject=*/true); if (Copy.isInvalid()) { @@ -5041,10 +5041,10 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, LookupMemberName); MemberLookup.addDecl(*Field); MemberLookup.resolveKind(); - OwningExprResult From = BuildMemberReferenceExpr(OtherRef, OtherRefType, + ExprResult From = BuildMemberReferenceExpr(OtherRef, OtherRefType, Loc, /*IsArrow=*/false, SS, 0, MemberLookup, 0); - OwningExprResult To = BuildMemberReferenceExpr(This, This->getType(), + ExprResult To = BuildMemberReferenceExpr(This, This->getType(), Loc, /*IsArrow=*/true, SS, 0, MemberLookup, 0); assert(!From.isInvalid() && "Implicit field reference cannot fail"); @@ -5128,7 +5128,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, llvm::SmallVector<SourceLocation, 4> Commas; // FIXME: Silly Commas.push_back(Loc); Commas.push_back(Loc); - OwningExprResult Call = ExprError(); + ExprResult Call = ExprError(); if (NeedsCollectableMemCpy) Call = ActOnCallExpr(/*Scope=*/0, CollectableMemCpyRef, @@ -5146,7 +5146,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, } // Build the copy of this field. - OwningStmtResult Copy = BuildSingleCopyAssign(*this, Loc, FieldType, + StmtResult Copy = BuildSingleCopyAssign(*this, Loc, FieldType, To.get(), From.get(), /*CopyingBaseSubobject=*/false); if (Copy.isInvalid()) { @@ -5162,10 +5162,10 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, if (!Invalid) { // Add a "return *this;" - OwningExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref, + ExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref, This); - OwningStmtResult Return = ActOnReturnStmt(Loc, ThisObj.get()); + StmtResult Return = ActOnReturnStmt(Loc, ThisObj.get()); if (Return.isInvalid()) Invalid = true; else { @@ -5184,7 +5184,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, return; } - OwningStmtResult Body = ActOnCompoundStmt(Loc, Loc, move_arg(Statements), + StmtResult Body = ActOnCompoundStmt(Loc, Loc, move_arg(Statements), /*isStmtExpr=*/false); assert(!Body.isInvalid() && "Compound statement creation cannot fail"); CopyAssignOperator->setBody(Body.takeAs<Stmt>()); @@ -5393,7 +5393,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CopyConstructor->setUsed(); } -Sema::OwningExprResult +ExprResult Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, CXXConstructorDecl *Constructor, MultiExprArg ExprArgs, @@ -5426,7 +5426,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, /// BuildCXXConstructExpr - Creates a complete call to a constructor, /// including handling of its default argument expressions. -Sema::OwningExprResult +ExprResult Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, CXXConstructorDecl *Constructor, bool Elidable, MultiExprArg ExprArgs, @@ -5444,7 +5444,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, bool Sema::InitializeVarWithConstructor(VarDecl *VD, CXXConstructorDecl *Constructor, MultiExprArg Exprs) { - OwningExprResult TempResult = + ExprResult TempResult = BuildCXXConstructExpr(VD->getLocation(), VD->getType(), Constructor, move(Exprs)); if (TempResult.isInvalid()) @@ -5579,7 +5579,7 @@ void Sema::AddCXXDirectInitializerToDecl(Decl *RealDecl, InitializationSequence InitSeq(*this, Entity, Kind, Exprs.get(), Exprs.size()); - OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, move(Exprs)); + ExprResult Result = InitSeq.Perform(*this, Entity, Kind, move(Exprs)); if (Result.isInvalid()) { VDecl->setInvalidDecl(); return; @@ -6146,7 +6146,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, QualType ExDeclType, InitializationKind Kind = InitializationKind::CreateCopy(Loc, SourceLocation()); InitializationSequence InitSeq(*this, Entity, Kind, &ExDeclRef, 1); - OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, + ExprResult Result = InitSeq.Perform(*this, Entity, Kind, MultiExprArg(*this, &ExDeclRef, 1)); if (Result.isInvalid()) Invalid = true; @@ -6934,7 +6934,7 @@ void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) { InitializationKind::CreateDefault(ObjCImplementation->getLocation()); InitializationSequence InitSeq(*this, InitEntity, InitKind, 0, 0); - Sema::OwningExprResult MemberInit = + ExprResult MemberInit = InitSeq.Perform(*this, InitEntity, InitKind, Sema::MultiExprArg(*this, 0, 0)); MemberInit = MaybeCreateCXXExprWithTemporaries(MemberInit.get()); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index b1e2b7f049..1aede96a25 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -371,7 +371,7 @@ QualType Sema::UsualArithmeticConversions(Expr *&lhsExpr, Expr *&rhsExpr, /// multiple tokens. However, the common case is that StringToks points to one /// string. /// -Action::OwningExprResult +ExprResult Sema::ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks) { assert(NumStringToks && "Must have at least one string!"); @@ -459,7 +459,7 @@ static bool ShouldSnapshotBlockValueReference(Sema &S, BlockScopeInfo *CurBlock, } -Sema::OwningExprResult +ExprResult Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, SourceLocation Loc, const CXXScopeSpec *SS) { DeclarationNameInfo NameInfo(D->getDeclName(), Loc); @@ -467,7 +467,7 @@ Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, SourceLocation Loc, } /// BuildDeclRefExpr - Build a DeclRefExpr. -Sema::OwningExprResult +ExprResult Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, const DeclarationNameInfo &NameInfo, const CXXScopeSpec *SS) { @@ -543,7 +543,7 @@ VarDecl *Sema::BuildAnonymousStructUnionMemberPath(FieldDecl *Field, return BaseObject; } -Sema::OwningExprResult +ExprResult Sema::BuildAnonymousStructUnionMemberReference(SourceLocation Loc, FieldDecl *Field, Expr *BaseObjectExpr, @@ -1061,7 +1061,7 @@ static ObjCIvarDecl *SynthesizeProvisionalIvar(Sema &SemaRef, return 0; } -Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S, +ExprResult Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS, UnqualifiedId &Id, bool HasTrailingLParen, @@ -1134,7 +1134,7 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S, // If this reference is in an Objective-C method, then we need to do // some special Objective-C lookup, too. if (IvarLookupFollowUp) { - OwningExprResult E(LookupInObjCMethod(R, S, II, true)); + ExprResult E(LookupInObjCMethod(R, S, II, true)); if (E.isInvalid()) return ExprError(); @@ -1180,7 +1180,7 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S, // reference the ivar. if (ObjCIvarDecl *Ivar = R.getAsSingle<ObjCIvarDecl>()) { R.clear(); - OwningExprResult E(LookupInObjCMethod(R, S, Ivar->getIdentifier())); + ExprResult E(LookupInObjCMethod(R, S, Ivar->getIdentifier())); assert(E.isInvalid() || E.get()); return move(E); } @@ -1241,7 +1241,7 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S, } /// Builds an expression which might be an implicit member expression. -Sema::OwningExprResult +ExprResult Sema::BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs) { @@ -1280,7 +1280,7 @@ Sema::BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, /// declaration name, generally during template instantiation. /// There's a large number of things which don't need to be done along /// this path. -Sema::OwningExprResult +ExprResult Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo) { DeclContext *DC; @@ -1313,7 +1313,7 @@ Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, /// actually quite a lot of extra work involved. /// /// Returns a null sentinel to indicate trivial success. -Sema::OwningExprResult +ExprResult Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation) { SourceLocation Loc = Lookup.getNameLoc(); @@ -1368,7 +1368,7 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, UnqualifiedId SelfName; SelfName.setIdentifier(&II, SourceLocation()); CXXScopeSpec SelfScopeSpec; - OwningExprResult SelfExpr = ActOnIdExpression(S, SelfScopeSpec, + ExprResult SelfExpr = ActOnIdExpression(S, SelfScopeSpec, SelfName, false, false); MarkDeclarationReferenced(Loc, IV); return Owned(new (Context) @@ -1593,7 +1593,7 @@ static MemberExpr *BuildMemberExpr(ASTContext &C, Expr *Base, bool isArrow, /// is known to be an instance method, and the given unqualified lookup /// set is known to contain only instance members, at least one of which /// is from an appropriate type. -Sema::OwningExprResult +ExprResult Sema::BuildImplicitMemberExpr(const CXXScopeSpec &SS, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, @@ -1709,7 +1709,7 @@ static bool CheckDeclInExpr(Sema &S, SourceLocation Loc, NamedDecl *D) { return false; } -Sema::OwningExprResult +ExprResult Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL) { @@ -1745,7 +1745,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, /// \brief Complete semantic analysis for a reference to the given declaration. -Sema::OwningExprResult +ExprResult Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D) { @@ -1828,7 +1828,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, DeclRefExpr(const_cast<ValueDecl*>(BDRE->getDecl()), T, SourceLocation()); - OwningExprResult Res = PerformCopyInitialization( + ExprResult Res = PerformCopyInitialization( InitializedEntity::InitializeBlock(VD->getLocation(), T, false), SourceLocation(), @@ -1849,7 +1849,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, NameInfo, &SS); } -Sema::OwningExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, +ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind) { PredefinedExpr::IdentType IT; @@ -1884,7 +1884,7 @@ Sema::OwningExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, return Owned(new (Context) PredefinedExpr(Loc, ResTy, IT)); } -Sema::OwningExprResult Sema::ActOnCharacterConstant(const Token &Tok) { +ExprResult Sema::ActOnCharacterConstant(const Token &Tok) { llvm::SmallString<16> CharBuffer; bool Invalid = false; llvm::StringRef ThisTok = PP.getSpelling(Tok, CharBuffer, &Invalid); @@ -1911,7 +1911,7 @@ Sema::OwningExprResult Sema::ActOnCharacterConstant(const Token &Tok) { Ty, Tok.getLocation())); } -Action::OwningExprResult Sema::ActOnNumericConstant(const Token &Tok) { +ExprResult Sema::ActOnNumericConstant(const Token &Tok) { // Fast path for a single digit (which is quite common). A single digit // cannot have a trigraph, escaped newline, radix prefix, or type suffix. if (Tok.getLength() == 1) { @@ -2073,7 +2073,7 @@ Action::OwningExprResult Sema::ActOnNumericConstant(const Token &Tok) { return Owned(Res); } -Action::OwningExprResult Sema::ActOnParenExpr(SourceLocation L, +ExprResult Sema::ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E) { assert((E != 0) && "ActOnParenExpr() missing expr"); return Owned(new (Context) ParenExpr(L, R, E)); @@ -2158,7 +2158,7 @@ bool Sema::CheckAlignOfExpr(Expr *E, SourceLocation OpLoc, } /// \brief Build a sizeof or alignof expression given a type operand. -Action::OwningExprResult +ExprResult Sema::CreateSizeOfAlignOfExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, bool isSizeOf, SourceRange R) { @@ -2179,7 +2179,7 @@ Sema::CreateSizeOfAlignOfExpr(TypeSourceInfo *TInfo, /// \brief Build a sizeof or alignof expression given an expression /// operand. -Action::OwningExprResult +ExprResult Sema::CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc, bool isSizeOf, SourceRange R) { // Verify that the operand is valid. @@ -2207,7 +2207,7 @@ Sema::CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc, /// ActOnSizeOfAlignOfExpr - Handle @c sizeof(type) and @c sizeof @c expr and /// the same for @c alignof and @c __alignof /// Note that the ArgRange is invalid if isType is false. -Action::OwningExprResult +ExprResult Sema::ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType, void *TyOrEx, const SourceRange &ArgRange) { // If error parsing type, ignore. @@ -2220,7 +2220,7 @@ Sema::ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType, } Expr *ArgEx = (Expr *)TyOrEx; - Action::OwningExprResult Result + ExprResult Result = CreateSizeOfAlignOfExpr(ArgEx, OpLoc, isSizeof, ArgEx->getSourceRange()); if (Result.isInvalid()) @@ -2249,7 +2249,7 @@ QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc, bool isReal) { -Action::OwningExprResult +ExprResult Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input) { UnaryOperator::Opcode Opc; @@ -2262,11 +2262,11 @@ Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, return BuildUnaryOp(S, OpLoc, Opc, Input); } -Action::OwningExprResult +ExprResult Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc) { // Since this might be a postfix expression, get rid of ParenListExprs. - OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base); + ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base); if (Result.isInvalid()) return ExprError(); Base = Result.take(); @@ -2290,7 +2290,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, } -Action::OwningExprResult +ExprResult Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc) { Expr *LHSExp = Base; @@ -2541,7 +2541,7 @@ static Decl *FindGetterNameDecl(const ObjCObjectPointerType *QIdTy, return GDecl; } -Sema::OwningExprResult +ExprResult Sema::ActOnDependentMemberExpr(Expr *BaseExpr, QualType BaseType, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, @@ -2718,7 +2718,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, return false; } -Sema::OwningExprResult +ExprResult Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, @@ -2745,7 +2745,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType, // Explicit member accesses. } else { - OwningExprResult Result = + ExprResult Result = LookupMemberExpr(R, Base, IsArrow, OpLoc, SS, /*ObjCImpDecl*/ 0, TemplateArgs != 0); @@ -2766,7 +2766,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType, R, TemplateArgs); } -Sema::OwningExprResult +ExprResult Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType, SourceLocation OpLoc, bool IsArrow, const CXXScopeSpec &SS, @@ -2957,7 +2957,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType, /// /// The ObjCImpDecl bit is a gross hack that will need to be properly /// fixed for ObjC++. -Sema::OwningExprResult +ExprResult Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, bool &IsArrow, SourceLocation OpLoc, CXXScopeSpec &SS, @@ -2991,7 +2991,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, << QualType(Fun, 0) << FixItHint::CreateInsertion(Loc, "()"); - OwningExprResult NewBase + ExprResult NewBase = ActOnCallExpr(0, BaseExpr, Loc, MultiExprArg(*this, 0, 0), 0, Loc); BaseExpr = 0; @@ -3304,7 +3304,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, /// \param ObjCImpDecl the current ObjC @implementation decl; /// this is an ugly hack around the fact that ObjC @implementations /// aren't properly put in the context chain -Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, +ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, @@ -3330,7 +3330,7 @@ Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, static_cast<NestedNameSpecifier*>(SS.getScopeRep()))); // This is a postfix expression, so get rid of ParenListExprs. - OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base); + ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base); if (Result.isInvalid()) return ExprError(); Base = Result.take(); @@ -3370,7 +3370,7 @@ Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, return move(Result); } -Sema::OwningExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, +ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param) { if (Param->hasUnparsedDefaultArg()) { @@ -3392,7 +3392,7 @@ Sema::OwningExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, InstantiatingTemplate Inst(*this, CallLoc, Param, Innermost.first, Innermost.second); - OwningExprResult Result = SubstExpr(UninstExpr, ArgList); + ExprResult Result = SubstExpr(UninstExpr, ArgList); if (Result.isInvalid()) return ExprError(); @@ -3525,7 +3525,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, InitializedEntity Entity = Param? InitializedEntity::InitializeParameter(Param) : InitializedEntity::InitializeParameter(ProtoArgType); - OwningExprResult ArgE = PerformCopyInitialization(Entity, + ExprResult ArgE = PerformCopyInitialization(Entity, SourceLocation(), Owned(Arg)); if (ArgE.isInvalid()) @@ -3535,7 +3535,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, } else { ParmVarDecl *Param = FDecl->getParamDecl(i); - OwningExprResult ArgExpr = + ExprResult ArgExpr = BuildCXXDefaultArgExpr(CallLoc, FDecl, Param); if (ArgExpr.isInvalid()) return true; @@ -3560,14 +3560,14 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments. /// This provides the location of the left/right parens and a list of comma /// locations. -Action::OwningExprResult +ExprResult Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg args, SourceLocation *CommaLocs, SourceLocation RParenLoc) { unsigned NumArgs = args.size(); // Since this might be a postfix expression, get rid of ParenListExprs. - OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Fn); + ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Fn); if (Result.isInvalid()) return ExprError(); Fn = Result.take(); @@ -3690,7 +3690,7 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, /// block-pointer type. /// /// \param NDecl the declaration being called, if available -Sema::OwningExprResult +ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, Expr **Args, unsigned NumArgs, @@ -3791,7 +3791,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, return MaybeBindToTemporary(TheCall); } -Action::OwningExprResult +ExprResult Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr) { assert((Ty != 0) && "ActOnCompoundLiteral(): missing type"); @@ -3806,7 +3806,7 @@ Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, return BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc, InitExpr); } -Action::OwningExprResult +ExprResult Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *literalExpr) { QualType literalType = TInfo->getType(); @@ -3828,7 +3828,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, = InitializationKind::CreateCast(SourceRange(LParenLoc, RParenLoc), /*IsCStyleCast=*/true); InitializationSequence InitSeq(*this, Entity, Kind, &literalExpr, 1); - OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, + ExprResult Result = InitSeq.Perform(*this, Entity, Kind, MultiExprArg(*this, &literalExpr, 1), &literalType); if (Result.isInvalid()) @@ -3845,7 +3845,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, literalExpr, isFileScope)); } -Action::OwningExprResult +ExprResult Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg initlist, SourceLocation RBraceLoc) { unsigned NumInit = initlist.size(); @@ -4046,7 +4046,7 @@ bool Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *&CastExpr, return false; } -Action::OwningExprResult +ExprResult Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *castExpr) { assert((Ty != 0) && (castExpr != 0) && @@ -4065,7 +4065,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, ParsedType Ty, return BuildCStyleCastExpr(LParenLoc, castTInfo, RParenLoc, castExpr); } -Action::OwningExprResult +ExprResult Sema::BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *castExpr) { CastExpr::CastKind Kind = CastExpr::CK_Unknown; @@ -4082,13 +4082,13 @@ Sema::BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, /// This is not an AltiVec-style cast, so turn the ParenListExpr into a sequence /// of comma binary operators. -OwningExprResult +ExprResult Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *expr) { ParenListExpr *E = dyn_cast<ParenListExpr>(expr); if (!E) return Owned(expr); - OwningExprResult Result(E->getExpr(0)); + ExprResult Result(E->getExpr(0)); for (unsigned i = 1, e = E->getNumExprs(); i != e && !Result.isInvalid(); ++i) Result = ActOnBinOp(S, E->getExprLoc(), tok::comma, Result.get(), @@ -4099,7 +4099,7 @@ Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *expr) { return ActOnParenExpr(E->getLParenLoc(), E->getRParenLoc(), Result.get()); } -Action::OwningExprResult +ExprResult Sema::ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *Op, TypeSourceInfo *TInfo) { @@ -4139,13 +4139,13 @@ Sema::ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc, } else { // This is not an AltiVec-style cast, so turn the ParenListExpr into a // sequence of BinOp comma operators. - OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Op); + ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Op); if (Result.isInvalid()) return ExprError(); return BuildCStyleCastExpr(LParenLoc, TInfo, RParenLoc, Result.take()); } } -Action::OwningExprResult Sema::ActOnParenOrParenListExpr(SourceLocation L, +ExprResult Sema::ActOnParenOrParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val, ParsedType TypeOfCast) { @@ -4483,7 +4483,7 @@ QualType Sema::FindCompositeObjCPointerType(Expr *&LHS, Expr *&RHS, /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null /// in the case of a the GNU conditional expr extension. -Action::OwningExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc, +ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr) { @@ -6418,7 +6418,7 @@ static inline UnaryOperator::Opcode ConvertTokenKindToUnaryOpcode( /// CreateBuiltinBinOp - Creates a new built-in binary operation with /// operator @p Opc at location @c TokLoc. This routine only supports /// built-in operations; ActOnBinOp handles overloaded operators. -Action::OwningExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, +ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, unsigned Op, Expr *lhs, Expr *rhs) { QualType ResultTy; // Result type of the binary operator. @@ -6628,7 +6628,7 @@ static void DiagnoseBinOpPrecedence(Sema &Self, BinaryOperator::Opcode Opc, } // Binary Operators. 'Tok' is the token for the operator. -Action::OwningExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc, +ExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *lhs, Expr *rhs) { BinaryOperator::Opcode Opc = ConvertTokenKindToBinaryOpcode(Kind); @@ -6641,7 +6641,7 @@ Action::OwningExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc, return BuildBinOp(S, TokLoc, Opc, lhs, rhs); } -Action::OwningExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc, +ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperator::Opcode Opc, Expr *lhs, Expr *rhs) { if (getLangOptions().CPlusPlus && @@ -6666,7 +6666,7 @@ Action::OwningExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc, return CreateBuiltinBinOp(OpLoc, Opc, lhs, rhs); } -Action::OwningExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, +ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, unsigned OpcIn, Expr *Input) { UnaryOperator::Opcode Opc = static_cast<UnaryOperator::Opcode>(OpcIn); @@ -6750,7 +6750,7 @@ Action::OwningExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, return Owned(new (Context) UnaryOperator(Input, Opc, resultType, OpLoc)); } -Action::OwningExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc, +ExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperator::Opcode Opc, Expr *Input) { if (getLangOptions().CPlusPlus && Input->getType()->isOverloadableType() && @@ -6772,13 +6772,13 @@ Action::OwningExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc, } // Unary Operators. 'Tok' is the token for the operator. -Action::OwningExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc, +ExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input) { return BuildUnaryOp(S, OpLoc, ConvertTokenKindToUnaryOpcode(Op), Input); } /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo". -Sema::OwningExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc, +ExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, IdentifierInfo *LabelII) { // Look up the record for this label identifier. @@ -6794,7 +6794,7 @@ Sema::OwningExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc, Context.getPointerType(Context.VoidTy))); } -Sema::OwningExprResult +ExprResult Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc) { // "({..})" assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!"); @@ -6829,7 +6829,7 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, return Owned(new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc)); } -Sema::OwningExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, +ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, OffsetOfComponent *CompPtr, unsigned NumComponents, @@ -6985,7 +6985,7 @@ Sema::OwningExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, Exprs.data(), Exprs.size(), RParenLoc)); } -Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S, +ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType argty, @@ -7006,7 +7006,7 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S, } -Sema::OwningExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc, +ExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc, ParsedType arg1,ParsedType arg2, SourceLocation RPLoc) { TypeSourceInfo *argTInfo1; @@ -7019,7 +7019,7 @@ Sema::OwningExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc, return BuildTypesCompatibleExpr(BuiltinLoc, argTInfo1, argTInfo2, RPLoc); } -Sema::OwningExprResult +ExprResult Sema::BuildTypesCompatibleExpr(SourceLocation BuiltinLoc, TypeSourceInfo *argTInfo1, TypeSourceInfo *argTInfo2, @@ -7035,7 +7035,7 @@ Sema::BuildTypesCompatibleExpr(SourceLocation BuiltinLoc, } -Sema::OwningExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc, +ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc) { @@ -7197,7 +7197,7 @@ void Sema::ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) { /// ActOnBlockStmtExpr - This is called when the body of a block statement /// literal was successfully completed. ^(int x){...} -Sema::OwningExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, +ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope) { // If blocks are disabled, emit an error. if (!LangOpts.Blocks) @@ -7296,7 +7296,7 @@ Sema::OwningExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, return Owned(Result); } -Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, +ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, Expr *expr, ParsedType type, SourceLocation RPLoc) { TypeSourceInfo *TInfo; @@ -7304,7 +7304,7 @@ Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, return BuildVAArgExpr(BuiltinLoc, expr, TInfo, RPLoc); } -Sema::OwningExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc, +ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc) { Expr *OrigExpr = E; @@ -7342,7 +7342,7 @@ Sema::OwningExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc, return Owned(new (Context) VAArgExpr(BuiltinLoc, E, TInfo, RPLoc, T)); } -Sema::OwningExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) { +ExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) { // The type of __null will be int or long, depending on the size of // pointers on the target. QualType Ty; @@ -7870,8 +7870,8 @@ bool Sema::CheckBooleanCondition(Expr *&E, SourceLocation Loc) { return false; } -Sema::OwningExprResult Sema::ActOnBooleanCondition(Scope *S, SourceLocation Loc, - Expr *Sub) { +ExprResult Sema::ActOnBooleanCondition(Scope *S, SourceLocation Loc, + Expr *Sub) { if (!Sub) return ExprError(); diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 8aa8ba57d9..a8b1bd091d 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -258,7 +258,7 @@ ParsedType Sema::getDestructorName(SourceLocation TildeLoc, } /// \brief Build a C++ typeid expression with a type operand. -Sema::OwningExprResult Sema::BuildCXXTypeId(QualType TypeInfoType, +ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc) { @@ -281,7 +281,7 @@ Sema::OwningExprResult Sema::BuildCXXTypeId(QualType TypeInfoType, } /// \brief Build a C++ typeid expression with an expression operand. -Sema::OwningExprResult Sema::BuildCXXTypeId(QualType TypeInfoType, +ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, Expr *E, SourceLocation RParenLoc) { @@ -333,7 +333,7 @@ Sema::OwningExprResult Sema::BuildCXXTypeId(QualType TypeInfoType, } /// ActOnCXXTypeidOfType - Parse typeid( type-id ) or typeid (expression); -Action::OwningExprResult +ExprResult Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc) { // Find the std::type_info type. @@ -368,7 +368,7 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, } /// ActOnCXXBoolLiteral - Parse {true,false} literals. -Action::OwningExprResult +ExprResult Sema::ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) { assert((Kind == tok::kw_true || Kind == tok::kw_false) && "Unknown C++ Boolean value!"); @@ -377,13 +377,13 @@ Sema::ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) { } /// ActOnCXXNullPtrLiteral - Parse 'nullptr'. -Action::OwningExprResult +ExprResult Sema::ActOnCXXNullPtrLiteral(SourceLocation Loc) { return Owned(new (Context) CXXNullPtrLiteralExpr(Context.NullPtrTy, Loc)); } /// ActOnCXXThrow - Parse throw expressions. -Action::OwningExprResult +ExprResult Sema::ActOnCXXThrow(SourceLocation OpLoc, Expr *Ex) { if (Ex && !Ex->isTypeDependent() && CheckCXXThrowOperand(OpLoc, Ex)) return ExprError(); @@ -431,7 +431,7 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) { InitializedEntity Entity = InitializedEntity::InitializeException(ThrowLoc, E->getType(), /*NRVO=*/false); - OwningExprResult Res = PerformCopyInitialization(Entity, + ExprResult Res = PerformCopyInitialization(Entity, SourceLocation(), Owned(E)); if (Res.isInvalid()) @@ -463,7 +463,7 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) { return false; } -Action::OwningExprResult Sema::ActOnCXXThis(SourceLocation ThisLoc) { +ExprResult Sema::ActOnCXXThis(SourceLocation ThisLoc) { /// C++ 9.3.2: In the body of a non-static member function, the keyword this /// is a non-lvalue expression whose value is the address of the object for /// which the function is called. @@ -482,7 +482,7 @@ Action::OwningExprResult Sema::ActOnCXXThis(SourceLocation ThisLoc) { /// Can be interpreted either as function-style casting ("int(x)") /// or class type construction ("ClassType(x,y,z)") /// or creation of a value-initialized type ("int()"). -Action::OwningExprResult +ExprResult Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, ParsedType TypeRep, SourceLocation LParenLoc, MultiExprArg exprs, @@ -554,7 +554,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, ParsedType TypeRep, : InitializationKind::CreateValue(TypeRange.getBegin(), LParenLoc, RParenLoc); InitializationSequence InitSeq(*this, Entity, Kind, Exprs, NumExprs); - OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, + ExprResult Result = InitSeq.Perform(*this, Entity, Kind, move(exprs)); // FIXME: Improve AST representation? @@ -586,7 +586,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, ParsedType TypeRep, /// or /// @code ::new Foo(23, "hello") @endcode /// For the interpretation of this heap of arguments, consult the base version. -Action::OwningExprResult +ExprResult Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, @@ -648,7 +648,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, ConstructorRParen); } -Sema::OwningExprResult +ExprResult Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, @@ -684,7 +684,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, QualType SizeType = ArraySize->getType(); - OwningExprResult ConvertedSize + ExprResult ConvertedSize = ConvertToIntegralOrEnumerationType(StartLoc, ArraySize, PDiag(diag::err_array_size_not_integral), PDiag(diag::err_array_size_incomplete_type) @@ -807,7 +807,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, InitializedEntity Entity = InitializedEntity::InitializeNew(StartLoc, AllocType); InitializationSequence InitSeq(*this, Entity, Kind, ConsArgs, NumConsArgs); - OwningExprResult FullInit = InitSeq.Perform(*this, Entity, Kind, + ExprResult FullInit = InitSeq.Perform(*this, Entity, Kind, move(ConstructorArgs)); if (FullInit.isInvalid()) return ExprError(); @@ -1133,7 +1133,7 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, // Watch out for variadic allocator function. unsigned NumArgsInFnDecl = FnDecl->getNumParams(); for (unsigned i = 0; (i < NumArgs && i < NumArgsInFnDecl); ++i) { - OwningExprResult Result + ExprResult Result = PerformCopyInitialization(InitializedEntity::InitializeParameter( FnDecl->getParamDecl(i)), SourceLocation(), @@ -1376,7 +1376,7 @@ bool Sema::FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, /// @code ::delete ptr; @endcode /// or /// @code delete [] ptr; @endcode -Action::OwningExprResult +ExprResult Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Ex) { // C++ [expr.delete]p1: @@ -1500,7 +1500,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, /// \brief Check the use of the given variable as a C++ condition in an if, /// while, do-while, or switch statement. -Action::OwningExprResult Sema::CheckConditionVariable(VarDecl *ConditionVar, +ExprResult Sema::CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, bool ConvertToBoolean) { QualType T = ConditionVar->getType(); @@ -1569,7 +1569,7 @@ Sema::IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType) { return false; } -static Sema::OwningExprResult BuildCXXCastArgument(Sema &S, +static ExprResult BuildCXXCastArgument(Sema &S, SourceLocation CastLoc, QualType Ty, CastExpr::CastKind Kind, @@ -1585,7 +1585,7 @@ static Sema::OwningExprResult BuildCXXCastArgument(Sema &S, CastLoc, ConstructorArgs)) return S.ExprError(); - Sema::OwningExprResult Result = + ExprResult Result = S.BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method), move_arg(ConstructorArgs)); if (Result.isInvalid()) @@ -1655,7 +1655,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, return true; } - OwningExprResult CastArg + ExprResult CastArg = BuildCXXCastArgument(*this, From->getLocStart(), ToType.getNonReferenceType(), @@ -1715,7 +1715,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, /*FIXME:ConstructLoc*/SourceLocation(), ConstructorArgs)) return true; - OwningExprResult FromResult = + ExprResult FromResult = BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(), ToType, SCS.CopyConstructor, move_arg(ConstructorArgs)); @@ -1724,7 +1724,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, From = FromResult.takeAs<Expr>(); return false; } - OwningExprResult FromResult = + ExprResult FromResult = BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(), ToType, SCS.CopyConstructor, MultiExprArg(*this, &From, 1)); @@ -1922,7 +1922,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, return false; } -Sema::OwningExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT, +ExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT, SourceLocation KWLoc, SourceLocation LParen, ParsedType Ty, @@ -2172,7 +2172,7 @@ static bool ConvertForConditional(Sema &Self, Expr *&E, QualType T) { InitializationKind Kind = InitializationKind::CreateCopy(E->getLocStart(), SourceLocation()); InitializationSequence InitSeq(Self, Entity, Kind, &E, 1); - Sema::OwningExprResult Result = InitSeq.Perform(Self, Entity, Kind, + ExprResult Result = InitSeq.Perform(Self, Entity, Kind, Sema::MultiExprArg(Self, &E, 1)); if (Result.isInvalid()) return true; @@ -2312,13 +2312,13 @@ QualType Sema::CXXCheckConditionalOperands(Expr *&Cond, Expr *&LHS, Expr *&RHS, if (LTy->isRecordType()) { // The operands have class type. Make a temporary copy. InitializedEntity Entity = InitializedEntity::InitializeTemporary(LTy); - OwningExprResult LHSCopy = PerformCopyInitialization(Entity, + ExprResult LHSCopy = PerformCopyInitialization(Entity, SourceLocation(), Owned(LHS)); if (LHSCopy.isInvalid()) return QualType(); - OwningExprResult RHSCopy = PerformCopyInitialization(Entity, + ExprResult RHSCopy = PerformCopyInitialization(Entity, SourceLocation(), Owned(RHS)); if (RHSCopy.isInvalid()) @@ -2554,14 +2554,14 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc, } // Convert E1 to Composite1 - OwningExprResult E1Result + ExprResult E1Result = E1ToC1.Perform(*this, Entity1, Kind, MultiExprArg(*this,&E1,1)); if (E1Result.isInvalid()) return QualType(); E1 = E1Result.takeAs<Expr>(); // Convert E2 to Composite1 - OwningExprResult E2Result + ExprResult E2Result = E2ToC1.Perform(*this, Entity1, Kind, MultiExprArg(*this,&E2,1)); if (E2Result.isInvalid()) return QualType(); @@ -2579,14 +2579,14 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc, return QualType(); // Convert E1 to Composite2 - OwningExprResult E1Result + ExprResult E1Result = E1ToC2.Perform(*this, Entity2, Kind, MultiExprArg(*this, &E1, 1)); if (E1Result.isInvalid()) return QualType(); E1 = E1Result.takeAs<Expr>(); // Convert E2 to Composite2 - OwningExprResult E2Result + ExprResult E2Result = E2ToC2.Perform(*this, Entity2, Kind, MultiExprArg(*this, &E2, 1)); if (E2Result.isInvalid()) return QualType(); @@ -2595,7 +2595,7 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc, return Composite2; } -Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) { +ExprResult Sema::MaybeBindToTemporary(Expr *E) { if (!Context.getLangOptions().CPlusPlus) return Owned(E); @@ -2655,8 +2655,8 @@ Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr) { return E; } -Sema::OwningExprResult -Sema::MaybeCreateCXXExprWithTemporaries(OwningExprResult SubExpr) { +ExprResult +Sema::MaybeCreateCXXExprWithTemporaries(ExprResult SubExpr) { if (SubExpr.isInvalid()) return ExprError(); @@ -2679,12 +2679,12 @@ FullExpr Sema::CreateFullExpr(Expr *SubExpr) { return E; } -Sema::OwningExprResult +ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor) { // Since this might be a postfix expression, get rid of ParenListExprs. - OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base); + ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base); if (Result.isInvalid()) return ExprError(); Base = Result.get(); @@ -2764,7 +2764,7 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, return move(Base); } -Sema::OwningExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc, +ExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc, Expr *MemExpr) { SourceLocation ExpectedLParenLoc = PP.getLocForEndOfToken(NameLoc); Diag(MemExpr->getLocStart(), diag::err_dtor_expr_without_call) @@ -2779,7 +2779,7 @@ Sema::OwningExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc, /*RPLoc*/ ExpectedLParenLoc); } -Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(Expr *Base, +ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, @@ -2874,7 +2874,7 @@ Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(Expr *Base, return DiagnoseDtorReference(Destructed.getLocation(), Result); } -Sema::OwningExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base, +ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, @@ -3044,7 +3044,7 @@ CXXMemberCallExpr *Sema::BuildCXXMemberCallExpr(Expr *Exp, return CE; } -Sema::OwningExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) { +ExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) { if (!FullExpr) return ExprError(); return MaybeCreateCXXExprWithTemporaries(FullExpr); } diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index cf818c4cc5..018dcefe88 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -241,7 +241,7 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, return true; InitializedEntity Entity = InitializedEntity::InitializeParameter(Param); - OwningExprResult ArgE = PerformCopyInitialization(Entity, + ExprResult ArgE = PerformCopyInitialization(Entity, SourceLocation(), Owned(argExpr->Retain())); if (ArgE.isInvalid()) @@ -331,7 +331,7 @@ ObjCMethodDecl *Sema::LookupPrivateInstanceMethod(Selector Sel, /// HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an /// objective C interface. This is a property reference expression. -Action::OwningExprResult Sema:: +ExprResult Sema:: HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, DeclarationName MemberName, SourceLocation MemberLoc) { @@ -433,7 +433,7 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, -Action::OwningExprResult Sema:: +ExprResult Sema:: ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, @@ -624,7 +624,7 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S, return ObjCInstanceMessage; } -Sema::OwningExprResult Sema::ActOnSuperMessage(Scope *S, +ExprResult Sema::ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, @@ -700,7 +700,7 @@ Sema::OwningExprResult Sema::ActOnSuperMessage(Scope *S, /// \param RBrac The location of the closing square bracket ']'. /// /// \param Args The message arguments. -Sema::OwningExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, +ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, @@ -779,7 +779,7 @@ Sema::OwningExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, // ActOnClassMessage - used for both unary and keyword messages. // ArgExprs is optional - if it is present, the number of expressions // is obtained from Sel.getNumArgs(). -Sema::OwningExprResult Sema::ActOnClassMessage(Scope *S, +ExprResult Sema::ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, @@ -828,7 +828,7 @@ Sema::OwningExprResult Sema::ActOnClassMessage(Scope *S, /// \param RBrac The location of the closing square bracket ']'. /// /// \param Args The message arguments. -Sema::OwningExprResult Sema::BuildInstanceMessage(Expr *Receiver, +ExprResult Sema::BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, @@ -1032,13 +1032,13 @@ Sema::OwningExprResult Sema::BuildInstanceMessage(Expr *Receiver, // ActOnInstanceMessage - used for both unary and keyword messages. // ArgExprs is optional - if it is present, the number of expressions // is obtained from Sel.getNumArgs(). -Sema::OwningExprResult Sema::ActOnInstanceMessage(Scope *S, - Expr *Receiver, - Selector Sel, - SourceLocation LBracLoc, - SourceLocation SelectorLoc, - SourceLocation RBracLoc, - MultiExprArg Args) { +ExprResult Sema::ActOnInstanceMessage(Scope *S, + Expr *Receiver, + Selector Sel, + SourceLocation LBracLoc, + SourceLocation SelectorLoc, + SourceLocation RBracLoc, + MultiExprArg Args) { if (!Receiver) return ExprError(); diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 7fc23d610e..a4d0b5164b 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -263,7 +263,7 @@ void InitListChecker::FillInValueInitForField(unsigned Init, FieldDecl *Field, return; } - Sema::OwningExprResult MemberInit + ExprResult MemberInit = InitSeq.Perform(SemaRef, MemberEntity, Kind, Sema::MultiExprArg(SemaRef, 0, 0)); if (MemberInit.isInvalid()) { @@ -373,7 +373,7 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity, return; } - Sema::OwningExprResult ElementInit + ExprResult ElementInit = InitSeq.Perform(SemaRef, ElementEntity, Kind, Sema::MultiExprArg(SemaRef, 0, 0)); if (ElementInit.isInvalid()) { @@ -678,7 +678,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, InitializationSequence Seq(SemaRef, Entity, Kind, &expr, 1); if (Seq) { - Sema::OwningExprResult Result = + ExprResult Result = Seq.Perform(SemaRef, Entity, Kind, Sema::MultiExprArg(SemaRef, &expr, 1)); if (Result.isInvalid()) @@ -758,7 +758,7 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity, return; } - Sema::OwningExprResult Result = + ExprResult Result = SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), SemaRef.Owned(expr)); @@ -805,7 +805,7 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity, return; } - Sema::OwningExprResult Result = + ExprResult Result = SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), SemaRef.Owned(expr)); @@ -1813,10 +1813,10 @@ CheckArrayDesignatorExpr(Sema &S, Expr *Index, llvm::APSInt &Value) { return false; } -Sema::OwningExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, +ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, SourceLocation Loc, bool GNUSyntax, - OwningExprResult Init) { + ExprResult Init) { typedef DesignatedInitExpr::Designator ASTDesignator; bool Invalid = false; @@ -3298,10 +3298,10 @@ static bool shouldDestroyTemporary(const InitializedEntity &Entity) { /// \returns An expression that copies the initializer expression into /// a temporary object, or an error expression if a copy could not be /// created. -static Sema::OwningExprResult CopyObject(Sema &S, +static ExprResult CopyObject(Sema &S, QualType T, const InitializedEntity &Entity, - Sema::OwningExprResult CurInit, + ExprResult CurInit, bool IsExtraneousCopy) { // Determine which class type we're copying to. Expr *CurInitExpr = (Expr *)CurInit.get(); @@ -3475,7 +3475,7 @@ void InitializationSequence::PrintInitLocationNote(Sema &S, } } -Action::OwningExprResult +ExprResult InitializationSequence::Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, @@ -3528,7 +3528,7 @@ InitializationSequence::Perform(Sema &S, } if (Kind.getKind() == InitializationKind::IK_Copy || Kind.isExplicitCast()) - return Sema::OwningExprResult(Args.release()[0]); + return ExprResult(Args.release()[0]); if (Args.size() == 0) return S.Owned((Expr *)0); @@ -3552,7 +3552,7 @@ InitializationSequence::Perform(Sema &S, *ResultType = Entity.getDecl() ? Entity.getDecl()->getType() : Entity.getType(); - Sema::OwningExprResult CurInit = S.Owned((Expr *)0); + ExprResult CurInit = S.Owned((Expr *)0); assert(!Steps.empty() && "Cannot have an empty initialization sequence"); @@ -3577,7 +3577,7 @@ InitializationSequence::Perform(Sema &S, case SK_StringInit: case SK_ObjCObjectConversion: assert(Args.size() == 1); - CurInit = Sema::OwningExprResult(((Expr **)(Args.get()))[0]->Retain()); + CurInit = ExprResult(((Expr **)(Args.get()))[0]->Retain()); if (CurInit.isInvalid()) return S.ExprError(); break; @@ -4454,10 +4454,10 @@ void InitializationSequence::dump() const { //===----------------------------------------------------------------------===// // Initialization helper functions //===----------------------------------------------------------------------===// -Sema::OwningExprResult +ExprResult Sema::PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, - OwningExprResult Init) { + ExprResult Init) { if (Init.isInvalid()) return ExprError(); diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 2314a6f94a..56b0918bef 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -464,7 +464,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, Expr *IvarRefExpr = new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), AtLoc, SelfExpr, true, true); - OwningExprResult Res = + ExprResult Res = PerformCopyInitialization(InitializedEntity::InitializeResult( SourceLocation(), getterMethod->getResultType(), @@ -494,8 +494,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, ParmVarDecl *Param = (*P); Expr *rhs = new (Context) DeclRefExpr(Param,Param->getType(), SourceLocation()); - OwningExprResult Res = BuildBinOp(S, SourceLocation(), - BinaryOperator::Assign, lhs, rhs); + ExprResult Res = BuildBinOp(S, SourceLocation(), + BinaryOperator::Assign, lhs, rhs); PIDecl->setSetterCXXAssignment(Res.takeAs<Expr>()); } } diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 09adf14450..cadaa4a91d 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -3191,7 +3191,7 @@ bool Sema::PerformContextuallyConvertToObjCId(Expr *&From) { /// /// \returns The expression, converted to an integral or enumeration type if /// successful. -Sema::OwningExprResult +ExprResult Sema::ConvertToIntegralOrEnumerationType(SourceLocation Loc, Expr *From, const PartialDiagnostic &NotIntDiag, const PartialDiagnostic &IncompleteDiag, @@ -6505,7 +6505,7 @@ void Sema::AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, /// Attempts to recover from a call where no functions were found. /// /// Returns true if new candidates were found. -static Sema::OwningExprResult +static ExprResult BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, @@ -6535,7 +6535,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn, // Build an implicit member call if appropriate. Just drop the // casts and such from the call, we don't really care. - Sema::OwningExprResult NewFn = SemaRef.ExprError(); + ExprResult NewFn = SemaRef.ExprError(); if ((*R.begin())->isCXXClassMember()) NewFn = SemaRef.BuildPossibleImplicitMemberExpr(SS, R, ExplicitTemplateArgs); else if (ExplicitTemplateArgs) @@ -6561,7 +6561,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn, /// the function declaration produced by overload /// resolution. Otherwise, emits diagnostics, deletes all of the /// arguments and Fn, and returns NULL. -Sema::OwningExprResult +ExprResult Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, Expr **Args, unsigned NumArgs, @@ -6655,7 +6655,7 @@ static bool IsOverloaded(const UnresolvedSetImpl &Functions) { /// by CreateOverloadedUnaryOp(). /// /// \param input The input argument. -Sema::OwningExprResult +ExprResult Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn, const UnresolvedSetImpl &Fns, Expr *Input) { @@ -6737,7 +6737,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn, return ExprError(); } else { // Convert the arguments. - OwningExprResult InputInit + ExprResult InputInit = PerformCopyInitialization(InitializedEntity::InitializeParameter( FnDecl->getParamDecl(0)), SourceLocation(), @@ -6824,7 +6824,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn, /// /// \param LHS Left-hand argument. /// \param RHS Right-hand argument. -Sema::OwningExprResult +ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc, unsigned OpcIn, const UnresolvedSetImpl &Fns, @@ -6916,7 +6916,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, // Best->Access is only meaningful for class members. CheckMemberOperatorAccess(OpLoc, Args[0], Args[1], Best->FoundDecl); - OwningExprResult Arg1 + ExprResult Arg1 = PerformCopyInitialization( InitializedEntity::InitializeParameter( FnDecl->getParamDecl(0)), @@ -6932,7 +6932,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, Args[1] = RHS = Arg1.takeAs<Expr>(); } else { // Convert the arguments. - OwningExprResult Arg0 + ExprResult Arg0 = PerformCopyInitialization( InitializedEntity::InitializeParameter( FnDecl->getParamDecl(0)), @@ -6941,7 +6941,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, if (Arg0.isInvalid()) return ExprError(); - OwningExprResult Arg1 + ExprResult Arg1 = PerformCopyInitialization( InitializedEntity::InitializeParameter( FnDecl->getParamDecl(1)), @@ -6999,7 +6999,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, // For class as left operand for assignment or compound assigment operator // do not fall through to handling in built-in, but report that no overloaded // assignment operator found - OwningExprResult Result = ExprError(); + ExprResult Result = ExprError(); if (Args[0]->getType()->isRecordType() && Opc >= BinaryOperator::Assign && Opc <= BinaryOperator::OrAssign) { Diag(OpLoc, diag::err_ovl_no_viable_oper) @@ -7039,7 +7039,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]); } -Action::OwningExprResult +ExprResult Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, Expr *Idx) { @@ -7101,7 +7101,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, return ExprError(); // Convert the arguments. - OwningExprResult InputInit + ExprResult InputInit = PerformCopyInitialization(InitializedEntity::InitializeParameter( FnDecl->getParamDecl(0)), SourceLocation(), @@ -7186,7 +7186,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, /// parameter). The caller needs to validate that the member /// expression refers to a member function or an overloaded member /// function. -Sema::OwningExprResult +ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, SourceLocation LParenLoc, Expr **Args, unsigned NumArgs, SourceLocation *CommaLocs, @@ -7539,7 +7539,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object, // Pass the argument. - OwningExprResult InputInit + ExprResult InputInit = PerformCopyInitialization(InitializedEntity::InitializeParameter( Method->getParamDecl(i)), SourceLocation(), Arg); @@ -7547,7 +7547,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object, IsError |= InputInit.isInvalid(); Arg = InputInit.takeAs<Expr>(); } else { - OwningExprResult DefArg + ExprResult DefArg = BuildCXXDefaultArgExpr(LParenLoc, Method, Method->getParamDecl(i)); if (DefArg.isInvalid()) { IsError = true; @@ -7581,7 +7581,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object, /// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator-> /// (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 +ExprResult Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc) { assert(Base->getType()->isRecordType() && "left-hand side must have class type"); @@ -7806,9 +7806,9 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, return E->Retain(); } -Sema::OwningExprResult Sema::FixOverloadedFunctionReference(OwningExprResult E, - DeclAccessPair Found, - FunctionDecl *Fn) { +ExprResult Sema::FixOverloadedFunctionReference(ExprResult E, + DeclAccessPair Found, + FunctionDecl *Fn) { return Owned(FixOverloadedFunctionReference((Expr *)E.get(), Found, Fn)); } diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index b6e1e7c62d..5f0ea16f40 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -27,7 +27,7 @@ #include "llvm/ADT/SmallVector.h" using namespace clang; -Sema::OwningStmtResult Sema::ActOnExprStmt(FullExprArg expr) { +StmtResult Sema::ActOnExprStmt(FullExprArg expr) { Expr *E = expr.get(); assert(E && "ActOnExprStmt(): missing expression"); // C99 6.8.3p2: The expression in an expression statement is evaluated as a @@ -39,11 +39,11 @@ Sema::OwningStmtResult Sema::ActOnExprStmt(FullExprArg expr) { } -Sema::OwningStmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc) { +StmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc) { return Owned(new (Context) NullStmt(SemiLoc)); } -Sema::OwningStmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg, +StmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg, SourceLocation StartLoc, SourceLocation EndLoc) { DeclGroupRef DG = dg.getAsVal<DeclGroupRef>(); @@ -135,7 +135,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) { DiagRuntimeBehavior(Loc, PDiag(DiagID) << R1 << R2); } -Action::OwningStmtResult +StmtResult Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, MultiStmtArg elts, bool isStmtExpr) { unsigned NumElts = elts.size(); @@ -170,7 +170,7 @@ Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, return Owned(new (Context) CompoundStmt(Context, Elts, NumElts, L, R)); } -Action::OwningStmtResult +StmtResult Sema::ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal, SourceLocation DotDotDotLoc, Expr *RHSVal, SourceLocation ColonLoc) { @@ -206,7 +206,7 @@ void Sema::ActOnCaseStmtBody(Stmt *caseStmt, Stmt *SubStmt) { CS->setSubStmt(SubStmt); } -Action::OwningStmtResult +StmtResult Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope) { if (getSwitchStack().empty()) { @@ -219,7 +219,7 @@ Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, return Owned(DS); } -Action::OwningStmtResult +StmtResult Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, SourceLocation ColonLoc, Stmt *SubStmt) { // Look up the record for this label identifier. @@ -246,11 +246,11 @@ Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, return Owned(LabelDecl); } -Action::OwningStmtResult +StmtResult Sema::ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar, Stmt *thenStmt, SourceLocation ElseLoc, Stmt *elseStmt) { - OwningExprResult CondResult(CondVal.release()); + ExprResult CondResult(CondVal.release()); VarDecl *ConditionVar = 0; if (CondVar) { @@ -382,10 +382,10 @@ static QualType GetTypeBeforeIntegralPromotion(const Expr* expr) { return expr->getType(); } -Action::OwningStmtResult +StmtResult Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond, Decl *CondVar) { - OwningExprResult CondResult; + ExprResult CondResult; VarDecl *ConditionVar = 0; if (CondVar) { @@ -427,7 +427,7 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond, return Owned(SS); } -Action::OwningStmtResult +StmtResult Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *BodyStmt) { SwitchStmt *SS = cast<SwitchStmt>(Switch); @@ -783,10 +783,10 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, return Owned(SS); } -Action::OwningStmtResult +StmtResult Sema::ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond, Decl *CondVar, Stmt *Body) { - OwningExprResult CondResult(Cond.release()); + ExprResult CondResult(Cond.release()); VarDecl *ConditionVar = 0; if (CondVar) { @@ -805,7 +805,7 @@ Sema::ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond, Body, WhileLoc)); } -Action::OwningStmtResult +StmtResult Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen) { @@ -814,7 +814,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, if (CheckBooleanCondition(Cond, DoLoc)) return StmtError(); - OwningExprResult CondResult = MaybeCreateCXXExprWithTemporaries(Cond); + ExprResult CondResult = MaybeCreateCXXExprWithTemporaries(Cond); if (CondResult.isInvalid()) return StmtError(); Cond = CondResult.take(); @@ -824,7 +824,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, return Owned(new (Context) DoStmt(Body, Cond, DoLoc, WhileLoc, CondRParen)); } -Action::OwningStmtResult +StmtResult Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, FullExprArg second, Decl *secondVar, FullExprArg third, @@ -846,7 +846,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, } } - OwningExprResult SecondResult(second.release()); + ExprResult SecondResult(second.release()); VarDecl *ConditionVar = 0; if (secondVar) { ConditionVar = cast<VarDecl>(secondVar); @@ -867,7 +867,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, RParenLoc)); } -Action::OwningStmtResult +StmtResult Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, Expr *Second, @@ -936,7 +936,7 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc, ForLoc, RParenLoc)); } -Action::OwningStmtResult +StmtResult Sema::ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, IdentifierInfo *LabelII) { // Look up the record for this label identifier. @@ -951,7 +951,7 @@ Sema::ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, return Owned(new (Context) GotoStmt(LabelDecl, GotoLoc, LabelLoc)); } -Action::OwningStmtResult +StmtResult Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *E) { // Convert operand to void* @@ -969,7 +969,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, return Owned(new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E)); } -Action::OwningStmtResult +StmtResult Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) { Scope *S = CurScope->getContinueParent(); if (!S) { @@ -980,7 +980,7 @@ Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) { return Owned(new (Context) ContinueStmt(ContinueLoc)); } -Action::OwningStmtResult +StmtResult Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { Scope *S = CurScope->getBreakParent(); if (!S) { @@ -1032,7 +1032,7 @@ static const VarDecl *getNRVOCandidate(ASTContext &Ctx, QualType RetType, /// ActOnBlockReturnStmt - Utility routine to figure out block's return type. /// -Action::OwningStmtResult +StmtResult Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // If this is the first return we've seen in the block, infer the type of // the block from it. @@ -1086,7 +1086,7 @@ Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // In C++ the return statement is handled via a copy initialization. // the C version of which boils down to CheckSingleAssignmentConstraints. NRVOCandidate = getNRVOCandidate(Context, FnRetType, RetValExp); - OwningExprResult Res = PerformCopyInitialization( + ExprResult Res = PerformCopyInitialization( InitializedEntity::InitializeResult(ReturnLoc, FnRetType, NRVOCandidate != 0), @@ -1117,7 +1117,7 @@ Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { return Owned(Result); } -Action::OwningStmtResult +StmtResult Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { if (getCurBlock()) return ActOnBlockReturnStmt(ReturnLoc, RetValExp); @@ -1177,7 +1177,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // In C++ the return statement is handled via a copy initialization. // the C version of which boils down to CheckSingleAssignmentConstraints. NRVOCandidate = getNRVOCandidate(Context, FnRetType, RetValExp); - OwningExprResult Res = PerformCopyInitialization( + ExprResult Res = PerformCopyInitialization( InitializedEntity::InitializeResult(ReturnLoc, FnRetType, NRVOCandidate != 0), @@ -1241,7 +1241,7 @@ static bool CheckAsmLValue(const Expr *E, Sema &S) { } -Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, +StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, @@ -1462,7 +1462,7 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, return Owned(NS); } -Action::OwningStmtResult +StmtResult Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body) { @@ -1473,12 +1473,12 @@ Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc, return Owned(new (Context) ObjCAtCatchStmt(AtLoc, RParen, Var, Body)); } -Action::OwningStmtResult +StmtResult Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body) { return Owned(new (Context) ObjCAtFinallyStmt(AtLoc, Body)); } -Action::OwningStmtResult +StmtResult Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg CatchStmts, Stmt *Finally) { setFunctionHasBranchProtectedScope(); @@ -1489,7 +1489,7 @@ Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, Finally)); } -Sema::OwningStmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, +StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw) { if (Throw) { QualType ThrowType = Throw->getType(); @@ -1506,7 +1506,7 @@ Sema::OwningStmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, return Owned(new (Context) ObjCAtThrowStmt(AtLoc, Throw)); } -Action::OwningStmtResult +StmtResult Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope) { if (!Throw) { @@ -1522,7 +1522,7 @@ Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, return BuildObjCAtThrowStmt(AtLoc, Throw); } -Action::OwningStmtResult +StmtResult Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SyncExpr, Stmt *SyncBody) { setFunctionHasBranchProtectedScope(); @@ -1541,7 +1541,7 @@ Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SyncExpr, /// ActOnCXXCatchBlock - Takes an exception declaration and a handler block /// and creates a proper catch handler from them. -Action::OwningStmtResult +StmtResult Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl, Stmt *HandlerBlock) { // There's nothing to test that ActOnExceptionDecl didn't already test. @@ -1585,7 +1585,7 @@ public: /// ActOnCXXTryBlock - Takes a try compound-statement and a number of /// handlers and creates a try statement from them. -Action::OwningStmtResult +StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, MultiStmtArg RawHandlers) { unsigned NumHandlers = RawHandlers.size(); diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index c62bbebba3..05d0ec172a 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -344,7 +344,7 @@ void Sema::LookupTemplateName(LookupResult &Found, /// ActOnDependentIdExpression - Handle a dependent id-expression that /// was just parsed. This is only possible with an explicit scope /// specifier naming a dependent type. -Sema::OwningExprResult +ExprResult Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, @@ -376,7 +376,7 @@ Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS, return BuildDependentDeclRefExpr(SS, NameInfo, TemplateArgs); } -Sema::OwningExprResult +ExprResult Sema::BuildDependentDeclRefExpr(const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs) { @@ -1578,7 +1578,7 @@ Sema::TypeResult Sema::ActOnTagTemplateIdType(TypeResult TypeResult, return ParsedType::make(ElabType); } -Sema::OwningExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS, +ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo &TemplateArgs) { @@ -1615,7 +1615,7 @@ Sema::OwningExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS, } // We actually only call this from template instantiation. -Sema::OwningExprResult +ExprResult Sema::BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo &TemplateArgs) { @@ -1860,7 +1860,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef, /// parameters that precede \p Param in the template parameter list. /// /// \returns the substituted template argument, or NULL if an error occurred. -static Sema::OwningExprResult +static ExprResult SubstDefaultTemplateArgument(Sema &SemaRef, TemplateDecl *Template, SourceLocation TemplateLoc, @@ -1956,7 +1956,7 @@ Sema::SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, if (!NonTypeParm->hasDefaultArgument()) return TemplateArgumentLoc(); - OwningExprResult Arg = SubstDefaultTemplateArgument(*this, Template, + ExprResult Arg = SubstDefaultTemplateArgument(*this, Template, TemplateLoc, RAngleLoc, NonTypeParm, @@ -2279,7 +2279,7 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, break; } - Sema::OwningExprResult E = SubstDefaultTemplateArgument(*this, Template, + ExprResult E = SubstDefaultTemplateArgument(*this, Template, TemplateLoc, RAngleLoc, NTTP, @@ -3038,7 +3038,7 @@ bool Sema::CheckTemplateArgument(TemplateTemplateParmDecl *Param, /// declaration and the type of its corresponding non-type template /// parameter, produce an expression that properly refers to that /// declaration. -Sema::OwningExprResult +ExprResult Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc) { @@ -3061,7 +3061,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, ClassType.getTypePtr()); CXXScopeSpec SS; SS.setScopeRep(Qualifier); - OwningExprResult RefExpr = BuildDeclRefExpr(VD, + ExprResult RefExpr = BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(), Loc, &SS); @@ -3092,7 +3092,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, if (ParamType->isPointerType()) { // When the non-type template parameter is a pointer, take the // address of the declaration. - OwningExprResult RefExpr = BuildDeclRefExpr(VD, T, Loc); + ExprResult RefExpr = BuildDeclRefExpr(VD, T, Loc); if (RefExpr.isInvalid()) return ExprError(); @@ -3128,7 +3128,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, /// This routine takes care of the mapping from an integral template /// argument (which may have any integral type) to the appropriate /// literal value. -Sema::OwningExprResult +ExprResult Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc) { assert(Arg.getKind() == TemplateArgument::Integral && @@ -5485,7 +5485,7 @@ TypeSourceInfo *Sema::RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, return Rebuilder.TransformType(T); } -OwningExprResult Sema::RebuildExprInCurrentInstantiation(Expr *E) { +ExprResult Sema::RebuildExprInCurrentInstantiation(Expr *E) { CurrentInstantiationRebuilder Rebuilder(*this, E->getExprLoc(), DeclarationName()); return Rebuilder.TransformExpr(E); diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 014a47953f..18e6560a3c 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -614,10 +614,10 @@ namespace { QualType RebuildElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType T); - Sema::OwningExprResult TransformPredefinedExpr(PredefinedExpr *E); - Sema::OwningExprResult TransformDeclRefExpr(DeclRefExpr *E); - Sema::OwningExprResult TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E); - Sema::OwningExprResult TransformTemplateParmRefExpr(DeclRefExpr *E, + ExprResult TransformPredefinedExpr(PredefinedExpr *E); + ExprResult TransformDeclRefExpr(DeclRefExpr *E); + ExprResult TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E); + ExprResult TransformTemplateParmRefExpr(DeclRefExpr *E, NonTypeTemplateParmDecl *D); QualType TransformFunctionProtoType(TypeLocBuilder &TLB, @@ -631,9 +631,9 @@ namespace { TemplateTypeParmTypeLoc TL, QualType ObjectType); - Sema::OwningExprResult TransformCallExpr(CallExpr *CE) { + ExprResult TransformCallExpr(CallExpr *CE) { getSema().CallsUndergoingInstantiation.push_back(CE); - OwningExprResult Result = + ExprResult Result = TreeTransform<TemplateInstantiator>::TransformCallExpr(CE); getSema().CallsUndergoingInstantiation.pop_back(); return move(Result); @@ -768,7 +768,7 @@ TemplateInstantiator::RebuildElaboratedType(ElaboratedTypeKeyword Keyword, NNS, T); } -Sema::OwningExprResult +ExprResult TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) { if (!E->isTypeDependent()) return SemaRef.Owned(E->Retain()); @@ -790,7 +790,7 @@ TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) { return getSema().Owned(PE); } -Sema::OwningExprResult +ExprResult TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E, NonTypeTemplateParmDecl *NTTP) { // If the corresponding template argument is NULL or non-existent, it's @@ -837,7 +837,7 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E, } -Sema::OwningExprResult +ExprResult TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) { NamedDecl *D = E->getDecl(); if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) { @@ -851,7 +851,7 @@ TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) { return TreeTransform<TemplateInstantiator>::TransformDeclRefExpr(E); } -Sema::OwningExprResult TemplateInstantiator::TransformCXXDefaultArgExpr( +ExprResult TemplateInstantiator::TransformCXXDefaultArgExpr( CXXDefaultArgExpr *E) { assert(!cast<FunctionDecl>(E->getParam()->getDeclContext())-> getDescribedFunctionTemplate() && @@ -1579,7 +1579,7 @@ Sema::InstantiateClassTemplateSpecializationMembers( TSK); } -Sema::OwningStmtResult +StmtResult Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) { if (!S) return Owned(S); @@ -1590,7 +1590,7 @@ Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) { return Instantiator.TransformStmt(S); } -Sema::OwningExprResult +ExprResult Sema::SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs) { if (!E) return Owned(E); diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 14ae73f466..5574a61df2 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -32,8 +32,6 @@ namespace { const MultiLevelTemplateArgumentList &TemplateArgs; public: - typedef Sema::OwningExprResult OwningExprResult; - TemplateDeclInstantiator(Sema &SemaRef, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs) : SemaRef(SemaRef), Owner(Owner), TemplateArgs(TemplateArgs) { } @@ -151,7 +149,7 @@ void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, Action::Unevaluated); if (Aligned->isAlignmentExpr()) { - OwningExprResult Result = SubstExpr(Aligned->getAlignmentExpr(), + ExprResult Result = SubstExpr(Aligned->getAlignmentExpr(), TemplateArgs); if (!Result.isInvalid()) AddAlignedAttr(Aligned->getLocation(), New, Result.takeAs<Expr>()); @@ -260,7 +258,7 @@ static bool InstantiateInitializationArguments(Sema &SemaRef, if (Args[I]->isDefaultArgument()) break; - Sema::OwningExprResult Arg = SemaRef.SubstExpr(Args[I], TemplateArgs); + ExprResult Arg = SemaRef.SubstExpr(Args[I], TemplateArgs); if (Arg.isInvalid()) return true; @@ -335,7 +333,7 @@ static bool InstantiateInitializer(Sema &S, Expr *Init, } } - Sema::OwningExprResult Result = S.SubstExpr(Init, TemplateArgs); + ExprResult Result = S.SubstExpr(Init, TemplateArgs); if (Result.isInvalid()) return true; @@ -496,7 +494,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) { // The bit-width expression is not potentially evaluated. EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); - OwningExprResult InstantiatedBitWidth + ExprResult InstantiatedBitWidth = SemaRef.SubstExpr(BitWidth, TemplateArgs); if (InstantiatedBitWidth.isInvalid()) { Invalid = true; @@ -584,12 +582,12 @@ Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) { // The expression in a static assertion is not potentially evaluated. EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); - OwningExprResult InstantiatedAssertExpr + ExprResult InstantiatedAssertExpr = SemaRef.SubstExpr(AssertExpr, TemplateArgs); if (InstantiatedAssertExpr.isInvalid()) return 0; - OwningExprResult Message(D->getMessage()); + ExprResult Message(D->getMessage()); D->getMessage()->Retain(); return SemaRef.ActOnStaticAssertDeclaration(D->getLocation(), InstantiatedAssertExpr.get(), @@ -617,7 +615,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { ECEnd = D->enumerator_end(); EC != ECEnd; ++EC) { // The specified value for the enumerator. - OwningExprResult Value = SemaRef.Owned((Expr *)0); + ExprResult Value = SemaRef.Owned((Expr *)0); if (Expr *UninstValue = EC->getInitExpr()) { // The enumerator's value expression is not potentially evaluated. EnterExpressionEvaluationContext Unevaluated(SemaRef, @@ -2106,7 +2104,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, } // Instantiate the function body. - OwningStmtResult Body = SubstStmt(Pattern, TemplateArgs); + StmtResult Body = SubstStmt(Pattern, TemplateArgs); if (Body.isInvalid()) Function->setInvalidDecl(); diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 89e0b60de0..8f869e0cfb 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -89,8 +89,6 @@ protected: Sema &SemaRef; public: - typedef Sema::OwningStmtResult OwningStmtResult; - typedef Sema::OwningExprResult OwningExprResult; typedef Sema::MultiExprArg MultiExprArg; typedef Sema::MultiStmtArg MultiStmtArg; @@ -105,8 +103,8 @@ public: return static_cast<const Derived&>(*this); } - static inline OwningExprResult Owned(Expr *E) { return E; } - static inline OwningStmtResult Owned(Stmt *S) { return S; } + static inline ExprResult Owned(Expr *E) { return E; } + static inline StmtResult Owned(Stmt *S) { return S; } /// \brief Retrieves a reference to the semantic analysis object used for /// this tree transform. @@ -220,7 +218,7 @@ public: /// other mechanism. /// /// \returns the transformed statement. - OwningStmtResult TransformStmt(Stmt *S); + StmtResult TransformStmt(Stmt *S); /// \brief Transform the given expression. /// @@ -230,7 +228,7 @@ public: /// other mechanism. /// /// \returns the transformed expression. - OwningExprResult TransformExpr(Expr *E); + ExprResult TransformExpr(Expr *E); /// \brief Transform the given declaration, which is referenced from a type /// or expression. @@ -337,13 +335,13 @@ public: TransformTemplateSpecializationType(const TemplateSpecializationType *T, QualType ObjectType); - OwningStmtResult TransformCompoundStmt(CompoundStmt *S, bool IsStmtExpr); - OwningExprResult TransformCXXNamedCastExpr(CXXNamedCastExpr *E); + StmtResult TransformCompoundStmt(CompoundStmt *S, bool IsStmtExpr); + ExprResult TransformCXXNamedCastExpr(CXXNamedCastExpr *E); #define STMT(Node, Parent) \ - OwningStmtResult Transform##Node(Node *S); + StmtResult Transform##Node(Node *S); #define EXPR(Node, Parent) \ - OwningExprResult Transform##Node(Node *E); + ExprResult Transform##Node(Node *E); #define ABSTRACT_STMT(Stmt) #include "clang/AST/StmtNodes.inc" @@ -709,7 +707,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildCompoundStmt(SourceLocation LBraceLoc, + StmtResult RebuildCompoundStmt(SourceLocation LBraceLoc, MultiStmtArg Statements, SourceLocation RBraceLoc, bool IsStmtExpr) { @@ -721,7 +719,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildCaseStmt(SourceLocation CaseLoc, + StmtResult RebuildCaseStmt(SourceLocation CaseLoc, Expr *LHS, SourceLocation EllipsisLoc, Expr *RHS, @@ -734,7 +732,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildCaseStmtBody(Stmt *S, Stmt *Body) { + StmtResult RebuildCaseStmtBody(Stmt *S, Stmt *Body) { getSema().ActOnCaseStmtBody(S, Body); return S; } @@ -743,7 +741,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildDefaultStmt(SourceLocation DefaultLoc, + StmtResult RebuildDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt) { return getSema().ActOnDefaultStmt(DefaultLoc, ColonLoc, SubStmt, @@ -754,7 +752,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildLabelStmt(SourceLocation IdentLoc, + StmtResult RebuildLabelStmt(SourceLocation IdentLoc, IdentifierInfo *Id, SourceLocation ColonLoc, Stmt *SubStmt) { @@ -765,7 +763,7 @@ public: /// /// 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, + StmtResult RebuildIfStmt(SourceLocation IfLoc, Sema::FullExprArg Cond, VarDecl *CondVar, Stmt *Then, SourceLocation ElseLoc, Stmt *Else) { return getSema().ActOnIfStmt(IfLoc, Cond, CondVar, Then, ElseLoc, Else); @@ -775,7 +773,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, + StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc, Expr *Cond, VarDecl *CondVar) { return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Cond, CondVar); @@ -785,7 +783,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildSwitchStmtBody(SourceLocation SwitchLoc, + StmtResult RebuildSwitchStmtBody(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body) { return getSema().ActOnFinishSwitchStmt(SwitchLoc, Switch, Body); } @@ -794,7 +792,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildWhileStmt(SourceLocation WhileLoc, + StmtResult RebuildWhileStmt(SourceLocation WhileLoc, Sema::FullExprArg Cond, VarDecl *CondVar, Stmt *Body) { @@ -805,7 +803,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildDoStmt(SourceLocation DoLoc, Stmt *Body, + StmtResult RebuildDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation LParenLoc, Expr *Cond, @@ -818,7 +816,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildForStmt(SourceLocation ForLoc, + StmtResult RebuildForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *Init, Sema::FullExprArg Cond, VarDecl *CondVar, Sema::FullExprArg Inc, @@ -832,7 +830,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildGotoStmt(SourceLocation GotoLoc, + StmtResult RebuildGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelStmt *Label) { return getSema().ActOnGotoStmt(GotoLoc, LabelLoc, Label->getID()); @@ -842,7 +840,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildIndirectGotoStmt(SourceLocation GotoLoc, + StmtResult RebuildIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *Target) { return getSema().ActOnIndirectGotoStmt(GotoLoc, StarLoc, Target); @@ -852,7 +850,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildReturnStmt(SourceLocation ReturnLoc, + StmtResult RebuildReturnStmt(SourceLocation ReturnLoc, Expr *Result) { return getSema().ActOnReturnStmt(ReturnLoc, Result); @@ -862,7 +860,7 @@ public: /// /// 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, + StmtResult RebuildDeclStmt(Decl **Decls, unsigned NumDecls, SourceLocation StartLoc, SourceLocation EndLoc) { return getSema().Owned( @@ -876,7 +874,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildAsmStmt(SourceLocation AsmLoc, + StmtResult RebuildAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, @@ -898,7 +896,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildObjCAtTryStmt(SourceLocation AtLoc, + StmtResult RebuildObjCAtTryStmt(SourceLocation AtLoc, Stmt *TryBody, MultiStmtArg CatchStmts, Stmt *Finally) { @@ -921,7 +919,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildObjCAtCatchStmt(SourceLocation AtLoc, + StmtResult RebuildObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParenLoc, VarDecl *Var, Stmt *Body) { @@ -933,7 +931,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildObjCAtFinallyStmt(SourceLocation AtLoc, + StmtResult RebuildObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body) { return getSema().ActOnObjCAtFinallyStmt(AtLoc, Body); } @@ -942,7 +940,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildObjCAtThrowStmt(SourceLocation AtLoc, + StmtResult RebuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Operand) { return getSema().BuildObjCAtThrowStmt(AtLoc, Operand); } @@ -951,7 +949,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildObjCAtSynchronizedStmt(SourceLocation AtLoc, + StmtResult RebuildObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *Object, Stmt *Body) { return getSema().ActOnObjCAtSynchronizedStmt(AtLoc, Object, @@ -962,7 +960,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildObjCForCollectionStmt(SourceLocation ForLoc, + StmtResult RebuildObjCForCollectionStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *Element, Expr *Collection, @@ -992,7 +990,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildCXXCatchStmt(SourceLocation CatchLoc, + StmtResult RebuildCXXCatchStmt(SourceLocation CatchLoc, VarDecl *ExceptionDecl, Stmt *Handler) { return Owned(new (getSema().Context) CXXCatchStmt(CatchLoc, ExceptionDecl, @@ -1003,7 +1001,7 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - OwningStmtResult RebuildCXXTryStmt(SourceLocation TryLoc, + StmtResult RebuildCXXTryStmt(SourceLocation TryLoc, Stmt *TryBlock, MultiStmtArg Handlers) { return getSema().ActOnCXXTryBlock(TryLoc, TryBlock, move(Handlers)); @@ -1013,7 +1011,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildDeclarationNameExpr(const CXXScopeSpec &SS, + ExprResult RebuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool RequiresADL) { return getSema().BuildDeclarationNameExpr(SS, R, RequiresADL); @@ -1024,7 +1022,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildDeclRefExpr(NestedNameSpecifier *Qualifier, + ExprResult RebuildDeclRefExpr(NestedNameSpecifier *Qualifier, SourceRange QualifierRange, ValueDecl *VD, const DeclarationNameInfo &NameInfo, @@ -1042,7 +1040,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildParenExpr(Expr *SubExpr, SourceLocation LParen, + ExprResult RebuildParenExpr(Expr *SubExpr, SourceLocation LParen, SourceLocation RParen) { return getSema().ActOnParenExpr(LParen, RParen, SubExpr); } @@ -1051,7 +1049,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXPseudoDestructorExpr(Expr *Base, + ExprResult RebuildCXXPseudoDestructorExpr(Expr *Base, SourceLocation OperatorLoc, bool isArrow, NestedNameSpecifier *Qualifier, @@ -1065,7 +1063,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildUnaryOperator(SourceLocation OpLoc, + ExprResult RebuildUnaryOperator(SourceLocation OpLoc, UnaryOperator::Opcode Opc, Expr *SubExpr) { return getSema().BuildUnaryOp(/*Scope=*/0, OpLoc, Opc, SubExpr); @@ -1075,7 +1073,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildOffsetOfExpr(SourceLocation OperatorLoc, + ExprResult RebuildOffsetOfExpr(SourceLocation OperatorLoc, TypeSourceInfo *Type, Action::OffsetOfComponent *Components, unsigned NumComponents, @@ -1088,7 +1086,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildSizeOfAlignOf(TypeSourceInfo *TInfo, + ExprResult RebuildSizeOfAlignOf(TypeSourceInfo *TInfo, SourceLocation OpLoc, bool isSizeOf, SourceRange R) { return getSema().CreateSizeOfAlignOfExpr(TInfo, OpLoc, isSizeOf, R); @@ -1099,9 +1097,9 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildSizeOfAlignOf(Expr *SubExpr, SourceLocation OpLoc, + ExprResult RebuildSizeOfAlignOf(Expr *SubExpr, SourceLocation OpLoc, bool isSizeOf, SourceRange R) { - OwningExprResult Result + ExprResult Result = getSema().CreateSizeOfAlignOfExpr(SubExpr, OpLoc, isSizeOf, R); if (Result.isInvalid()) return getSema().ExprError(); @@ -1113,7 +1111,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildArraySubscriptExpr(Expr *LHS, + ExprResult RebuildArraySubscriptExpr(Expr *LHS, SourceLocation LBracketLoc, Expr *RHS, SourceLocation RBracketLoc) { @@ -1126,7 +1124,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc, + ExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation *CommaLocs, SourceLocation RParenLoc) { @@ -1138,7 +1136,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildMemberExpr(Expr *Base, SourceLocation OpLoc, + ExprResult RebuildMemberExpr(Expr *Base, SourceLocation OpLoc, bool isArrow, NestedNameSpecifier *Qualifier, SourceRange QualifierRange, @@ -1186,7 +1184,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildBinaryOperator(SourceLocation OpLoc, + ExprResult RebuildBinaryOperator(SourceLocation OpLoc, BinaryOperator::Opcode Opc, Expr *LHS, Expr *RHS) { return getSema().BuildBinOp(/*Scope=*/0, OpLoc, Opc, LHS, RHS); @@ -1196,7 +1194,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildConditionalOperator(Expr *Cond, + ExprResult RebuildConditionalOperator(Expr *Cond, SourceLocation QuestionLoc, Expr *LHS, SourceLocation ColonLoc, @@ -1209,7 +1207,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCStyleCastExpr(SourceLocation LParenLoc, + ExprResult RebuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *SubExpr) { @@ -1221,7 +1219,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCompoundLiteralExpr(SourceLocation LParenLoc, + ExprResult RebuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *Init) { @@ -1233,7 +1231,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildExtVectorElementExpr(Expr *Base, + ExprResult RebuildExtVectorElementExpr(Expr *Base, SourceLocation OpLoc, SourceLocation AccessorLoc, IdentifierInfo &Accessor) { @@ -1251,11 +1249,11 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildInitList(SourceLocation LBraceLoc, + ExprResult RebuildInitList(SourceLocation LBraceLoc, MultiExprArg Inits, SourceLocation RBraceLoc, QualType ResultTy) { - OwningExprResult Result + ExprResult Result = SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc); if (Result.isInvalid() || ResultTy->isDependentType()) return move(Result); @@ -1271,12 +1269,12 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildDesignatedInitExpr(Designation &Desig, + ExprResult RebuildDesignatedInitExpr(Designation &Desig, MultiExprArg ArrayExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init) { - OwningExprResult Result + ExprResult Result = SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax, Init); if (Result.isInvalid()) @@ -1291,7 +1289,7 @@ public: /// 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) { + ExprResult RebuildImplicitValueInitExpr(QualType T) { return SemaRef.Owned(new (SemaRef.Context) ImplicitValueInitExpr(T)); } @@ -1299,7 +1297,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildVAArgExpr(SourceLocation BuiltinLoc, + ExprResult RebuildVAArgExpr(SourceLocation BuiltinLoc, Expr *SubExpr, TypeSourceInfo *TInfo, SourceLocation RParenLoc) { return getSema().BuildVAArgExpr(BuiltinLoc, @@ -1311,7 +1309,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildParenListExpr(SourceLocation LParenLoc, + ExprResult RebuildParenListExpr(SourceLocation LParenLoc, MultiExprArg SubExprs, SourceLocation RParenLoc) { return getSema().ActOnParenOrParenListExpr(LParenLoc, RParenLoc, @@ -1323,7 +1321,7 @@ public: /// 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, + ExprResult RebuildAddrLabelExpr(SourceLocation AmpAmpLoc, SourceLocation LabelLoc, LabelStmt *Label) { return getSema().ActOnAddrLabel(AmpAmpLoc, LabelLoc, Label->getID()); @@ -1333,7 +1331,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildStmtExpr(SourceLocation LParenLoc, + ExprResult RebuildStmtExpr(SourceLocation LParenLoc, Stmt *SubStmt, SourceLocation RParenLoc) { return getSema().ActOnStmtExpr(LParenLoc, SubStmt, RParenLoc); @@ -1343,7 +1341,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildTypesCompatibleExpr(SourceLocation BuiltinLoc, + ExprResult RebuildTypesCompatibleExpr(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo1, TypeSourceInfo *TInfo2, SourceLocation RParenLoc) { @@ -1356,7 +1354,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildChooseExpr(SourceLocation BuiltinLoc, + ExprResult RebuildChooseExpr(SourceLocation BuiltinLoc, Expr *Cond, Expr *LHS, Expr *RHS, SourceLocation RParenLoc) { return SemaRef.ActOnChooseExpr(BuiltinLoc, @@ -1372,7 +1370,7 @@ public: /// 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, + ExprResult RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op, SourceLocation OpLoc, Expr *Callee, Expr *First, @@ -1384,7 +1382,7 @@ public: /// By default, this routine dispatches to one of the more-specific routines /// for a particular named case, e.g., RebuildCXXStaticCastExpr(). /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXNamedCastExpr(SourceLocation OpLoc, + ExprResult RebuildCXXNamedCastExpr(SourceLocation OpLoc, Stmt::StmtClass Class, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, @@ -1426,7 +1424,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXStaticCastExpr(SourceLocation OpLoc, + ExprResult RebuildCXXStaticCastExpr(SourceLocation OpLoc, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, @@ -1443,7 +1441,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXDynamicCastExpr(SourceLocation OpLoc, + ExprResult RebuildCXXDynamicCastExpr(SourceLocation OpLoc, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, @@ -1460,7 +1458,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXReinterpretCastExpr(SourceLocation OpLoc, + ExprResult RebuildCXXReinterpretCastExpr(SourceLocation OpLoc, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, @@ -1477,7 +1475,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXConstCastExpr(SourceLocation OpLoc, + ExprResult RebuildCXXConstCastExpr(SourceLocation OpLoc, SourceLocation LAngleLoc, TypeSourceInfo *TInfo, SourceLocation RAngleLoc, @@ -1494,7 +1492,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXFunctionalCastExpr(SourceRange TypeRange, + ExprResult RebuildCXXFunctionalCastExpr(SourceRange TypeRange, TypeSourceInfo *TInfo, SourceLocation LParenLoc, Expr *Sub, @@ -1511,7 +1509,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXTypeidExpr(QualType TypeInfoType, + ExprResult RebuildCXXTypeidExpr(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc) { @@ -1523,7 +1521,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXTypeidExpr(QualType TypeInfoType, + ExprResult RebuildCXXTypeidExpr(QualType TypeInfoType, SourceLocation TypeidLoc, Expr *Operand, SourceLocation RParenLoc) { @@ -1536,7 +1534,7 @@ public: /// By default, builds a new "this" expression without performing any /// semantic analysis. Subclasses may override this routine to provide /// different behavior. - OwningExprResult RebuildCXXThisExpr(SourceLocation ThisLoc, + ExprResult RebuildCXXThisExpr(SourceLocation ThisLoc, QualType ThisType, bool isImplicit) { return getSema().Owned( @@ -1548,7 +1546,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXThrowExpr(SourceLocation ThrowLoc, Expr *Sub) { + ExprResult RebuildCXXThrowExpr(SourceLocation ThrowLoc, Expr *Sub) { return getSema().ActOnCXXThrow(ThrowLoc, Sub); } @@ -1557,7 +1555,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. - OwningExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc, + ExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc, ParmVarDecl *Param) { return getSema().Owned(CXXDefaultArgExpr::Create(getSema().Context, Loc, Param)); @@ -1567,7 +1565,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXScalarValueInitExpr(SourceLocation TypeStartLoc, + ExprResult RebuildCXXScalarValueInitExpr(SourceLocation TypeStartLoc, SourceLocation LParenLoc, QualType T, SourceLocation RParenLoc) { @@ -1581,7 +1579,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXNewExpr(SourceLocation StartLoc, + ExprResult RebuildCXXNewExpr(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, @@ -1612,7 +1610,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXDeleteExpr(SourceLocation StartLoc, + ExprResult RebuildCXXDeleteExpr(SourceLocation StartLoc, bool IsGlobalDelete, bool IsArrayForm, Expr *Operand) { @@ -1624,7 +1622,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildUnaryTypeTrait(UnaryTypeTrait Trait, + ExprResult RebuildUnaryTypeTrait(UnaryTypeTrait Trait, SourceLocation StartLoc, SourceLocation LParenLoc, QualType T, @@ -1638,7 +1636,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildDependentScopeDeclRefExpr(NestedNameSpecifier *NNS, + ExprResult RebuildDependentScopeDeclRefExpr(NestedNameSpecifier *NNS, SourceRange QualifierRange, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs) { @@ -1657,7 +1655,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildTemplateIdExpr(const CXXScopeSpec &SS, + ExprResult RebuildTemplateIdExpr(const CXXScopeSpec &SS, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo &TemplateArgs) { @@ -1668,7 +1666,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXConstructExpr(QualType T, + ExprResult RebuildCXXConstructExpr(QualType T, SourceLocation Loc, CXXConstructorDecl *Constructor, bool IsElidable, @@ -1689,7 +1687,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXTemporaryObjectExpr(SourceLocation TypeBeginLoc, + ExprResult RebuildCXXTemporaryObjectExpr(SourceLocation TypeBeginLoc, QualType T, SourceLocation LParenLoc, MultiExprArg Args, @@ -1707,7 +1705,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXUnresolvedConstructExpr(SourceLocation TypeBeginLoc, + ExprResult RebuildCXXUnresolvedConstructExpr(SourceLocation TypeBeginLoc, QualType T, SourceLocation LParenLoc, MultiExprArg Args, @@ -1726,7 +1724,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildCXXDependentScopeMemberExpr(Expr *BaseE, + ExprResult RebuildCXXDependentScopeMemberExpr(Expr *BaseE, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, @@ -1750,7 +1748,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildUnresolvedMemberExpr(Expr *BaseE, + ExprResult RebuildUnresolvedMemberExpr(Expr *BaseE, QualType BaseType, SourceLocation OperatorLoc, bool IsArrow, @@ -1773,7 +1771,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildObjCEncodeExpr(SourceLocation AtLoc, + ExprResult RebuildObjCEncodeExpr(SourceLocation AtLoc, TypeSourceInfo *EncodeTypeInfo, SourceLocation RParenLoc) { return SemaRef.Owned(SemaRef.BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo, @@ -1781,7 +1779,7 @@ public: } /// \brief Build a new Objective-C class message. - OwningExprResult RebuildObjCMessageExpr(TypeSourceInfo *ReceiverTypeInfo, + ExprResult RebuildObjCMessageExpr(TypeSourceInfo *ReceiverTypeInfo, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, @@ -1795,7 +1793,7 @@ public: } /// \brief Build a new Objective-C instance message. - OwningExprResult RebuildObjCMessageExpr(Expr *Receiver, + ExprResult RebuildObjCMessageExpr(Expr *Receiver, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, @@ -1812,7 +1810,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildObjCIvarRefExpr(Expr *BaseArg, ObjCIvarDecl *Ivar, + ExprResult RebuildObjCIvarRefExpr(Expr *BaseArg, ObjCIvarDecl *Ivar, SourceLocation IvarLoc, bool IsArrow, bool IsFreeIvar) { // FIXME: We lose track of the IsFreeIvar bit. @@ -1820,7 +1818,7 @@ public: Expr *Base = BaseArg; LookupResult R(getSema(), Ivar->getDeclName(), IvarLoc, Sema::LookupMemberName); - OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow, + ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow, /*FIME:*/IvarLoc, SS, 0, false); @@ -1841,7 +1839,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildObjCPropertyRefExpr(Expr *BaseArg, + ExprResult RebuildObjCPropertyRefExpr(Expr *BaseArg, ObjCPropertyDecl *Property, SourceLocation PropertyLoc) { CXXScopeSpec SS; @@ -1849,7 +1847,7 @@ public: LookupResult R(getSema(), Property->getDeclName(), PropertyLoc, Sema::LookupMemberName); bool IsArrow = false; - OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow, + ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow, /*FIME:*/PropertyLoc, SS, 0, false); if (Result.isInvalid()) @@ -1871,7 +1869,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildObjCImplicitSetterGetterRefExpr( + ExprResult RebuildObjCImplicitSetterGetterRefExpr( ObjCMethodDecl *Getter, QualType T, ObjCMethodDecl *Setter, @@ -1890,13 +1888,13 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildObjCIsaExpr(Expr *BaseArg, SourceLocation IsaLoc, + ExprResult RebuildObjCIsaExpr(Expr *BaseArg, SourceLocation IsaLoc, bool IsArrow) { CXXScopeSpec SS; Expr *Base = BaseArg; LookupResult R(getSema(), &getSema().Context.Idents.get("isa"), IsaLoc, Sema::LookupMemberName); - OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow, + ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow, /*FIME:*/IsaLoc, SS, 0, false); if (Result.isInvalid()) @@ -1916,7 +1914,7 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - OwningExprResult RebuildShuffleVectorExpr(SourceLocation BuiltinLoc, + ExprResult RebuildShuffleVectorExpr(SourceLocation BuiltinLoc, MultiExprArg SubExprs, SourceLocation RParenLoc) { // Find the declaration for __builtin_shufflevector @@ -1940,10 +1938,10 @@ public: Subs, NumSubExprs, Builtin->getCallResultType(), RParenLoc); - OwningExprResult OwnedCall(SemaRef.Owned(TheCall)); + ExprResult OwnedCall(SemaRef.Owned(TheCall)); // Type-check the __builtin_shufflevector expression. - OwningExprResult Result = SemaRef.SemaBuiltinShuffleVector(TheCall); + ExprResult Result = SemaRef.SemaBuiltinShuffleVector(TheCall); if (Result.isInvalid()) return SemaRef.ExprError(); @@ -1953,7 +1951,7 @@ public: }; template<typename Derived> -Sema::OwningStmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) { +StmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) { if (!S) return SemaRef.Owned(S); @@ -1972,7 +1970,7 @@ Sema::OwningStmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) { #define EXPR(Node, Parent) case Stmt::Node##Class: #include "clang/AST/StmtNodes.inc" { - Sema::OwningExprResult E = getDerived().TransformExpr(cast<Expr>(S)); + ExprResult E = getDerived().TransformExpr(cast<Expr>(S)); if (E.isInvalid()) return getSema().StmtError(); @@ -1985,7 +1983,7 @@ Sema::OwningStmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) { template<typename Derived> -Sema::OwningExprResult TreeTransform<Derived>::TransformExpr(Expr *E) { +ExprResult TreeTransform<Derived>::TransformExpr(Expr *E) { if (!E) return SemaRef.Owned(E); @@ -2273,7 +2271,7 @@ bool TreeTransform<Derived>::TransformTemplateArgument( if (SourceExpr) { EnterExpressionEvaluationContext Unevaluated(getSema(), Action::Unevaluated); - Sema::OwningExprResult E = getDerived().TransformExpr(SourceExpr); + ExprResult E = getDerived().TransformExpr(SourceExpr); SourceExpr = (E.isInvalid() ? 0 : E.take()); } @@ -2302,7 +2300,7 @@ bool TreeTransform<Derived>::TransformTemplateArgument( Expr *InputExpr = Input.getSourceExpression(); if (!InputExpr) InputExpr = Input.getArgument().getAsExpr(); - Sema::OwningExprResult E + ExprResult E = getDerived().TransformExpr(InputExpr); if (E.isInvalid()) return true; Output = TemplateArgumentLoc(TemplateArgument(E.take()), E.take()); @@ -2677,7 +2675,7 @@ TreeTransform<Derived>::TransformVariableArrayType(TypeLocBuilder &TLB, // Array bounds are not potentially evaluated contexts EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); - Sema::OwningExprResult SizeResult + ExprResult SizeResult = getDerived().TransformExpr(T->getSizeExpr()); if (SizeResult.isInvalid()) return QualType(); @@ -2718,7 +2716,7 @@ TreeTransform<Derived>::TransformDependentSizedArrayType(TypeLocBuilder &TLB, // Array bounds are not potentially evaluated contexts EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); - Sema::OwningExprResult SizeResult + ExprResult SizeResult = getDerived().TransformExpr(T->getSizeExpr()); if (SizeResult.isInvalid()) return QualType(); @@ -2764,7 +2762,7 @@ QualType TreeTransform<Derived>::TransformDependentSizedExtVectorType( // Vector sizes are not potentially evaluated contexts EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); - Sema::OwningExprResult Size = getDerived().TransformExpr(T->getSizeExpr()); + ExprResult Size = getDerived().TransformExpr(T->getSizeExpr()); if (Size.isInvalid()) return QualType(); @@ -3019,7 +3017,7 @@ QualType TreeTransform<Derived>::TransformTypeOfExprType(TypeLocBuilder &TLB, // typeof expressions are not potentially evaluated contexts EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); - Sema::OwningExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr()); + ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr()); if (E.isInvalid()) return QualType(); @@ -3074,7 +3072,7 @@ QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB, // decltype expressions are not potentially evaluated contexts EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); - Sema::OwningExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr()); + ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr()); if (E.isInvalid()) return QualType(); @@ -3427,26 +3425,26 @@ TreeTransform<Derived>::TransformObjCObjectPointerType(TypeLocBuilder &TLB, // Statement transformation //===----------------------------------------------------------------------===// template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformNullStmt(NullStmt *S) { return SemaRef.Owned(S->Retain()); } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S) { return getDerived().TransformCompoundStmt(S, false); } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S, bool IsStmtExpr) { bool SubStmtChanged = false; ASTOwningVector<Stmt*> Statements(getSema()); for (CompoundStmt::body_iterator B = S->body_begin(), BEnd = S->body_end(); B != BEnd; ++B) { - OwningStmtResult Result = getDerived().TransformStmt(*B); + StmtResult Result = getDerived().TransformStmt(*B); if (Result.isInvalid()) return getSema().StmtError(); @@ -3465,9 +3463,9 @@ TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S, } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) { - OwningExprResult LHS, RHS; + ExprResult LHS, RHS; { // The case value expressions are not potentially evaluated. EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated); @@ -3486,7 +3484,7 @@ TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) { // Build the case statement. // Case statements are always rebuilt so that they will attached to their // transformed switch statement. - OwningStmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(), + StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(), LHS.get(), S->getEllipsisLoc(), RHS.get(), @@ -3495,7 +3493,7 @@ TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) { return SemaRef.StmtError(); // Transform the statement following the case - OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt()); + StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt()); if (SubStmt.isInvalid()) return SemaRef.StmtError(); @@ -3504,10 +3502,10 @@ TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) { // Transform the statement following the default case - OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt()); + StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt()); if (SubStmt.isInvalid()) return SemaRef.StmtError(); @@ -3517,9 +3515,9 @@ TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S) { - OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt()); + StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt()); if (SubStmt.isInvalid()) return SemaRef.StmtError(); @@ -3530,10 +3528,10 @@ TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformIfStmt(IfStmt *S) { // Transform the condition - OwningExprResult Cond; + ExprResult Cond; VarDecl *ConditionVar = 0; if (S->getConditionVariable()) { ConditionVar @@ -3551,7 +3549,7 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) { // Convert the condition to a boolean value. if (S->getCond()) { - OwningExprResult CondE = getSema().ActOnBooleanCondition(0, + ExprResult CondE = getSema().ActOnBooleanCondition(0, S->getIfLoc(), Cond.get()); if (CondE.isInvalid()) @@ -3566,12 +3564,12 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) { return SemaRef.StmtError(); // Transform the "then" branch. - OwningStmtResult Then = getDerived().TransformStmt(S->getThen()); + StmtResult Then = getDerived().TransformStmt(S->getThen()); if (Then.isInvalid()) return SemaRef.StmtError(); // Transform the "else" branch. - OwningStmtResult Else = getDerived().TransformStmt(S->getElse()); + StmtResult Else = getDerived().TransformStmt(S->getElse()); if (Else.isInvalid()) return SemaRef.StmtError(); @@ -3588,10 +3586,10 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) { // Transform the condition. - OwningExprResult Cond; + ExprResult Cond; VarDecl *ConditionVar = 0; if (S->getConditionVariable()) { ConditionVar @@ -3609,14 +3607,14 @@ TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) { } // Rebuild the switch statement. - OwningStmtResult Switch + StmtResult Switch = getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Cond.get(), ConditionVar); if (Switch.isInvalid()) return SemaRef.StmtError(); // Transform the body of the switch statement. - OwningStmtResult Body = getDerived().TransformStmt(S->getBody()); + StmtResult Body = getDerived().TransformStmt(S->getBody()); if (Body.isInvalid()) return SemaRef.StmtError(); @@ -3626,10 +3624,10 @@ TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) { // Transform the condition - OwningExprResult Cond; + ExprResult Cond; VarDecl *ConditionVar = 0; if (S->getConditionVariable()) { ConditionVar @@ -3647,7 +3645,7 @@ TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) { if (S->getCond()) { // Convert the condition to a boolean value. - OwningExprResult CondE = getSema().ActOnBooleanCondition(0, + ExprResult CondE = getSema().ActOnBooleanCondition(0, S->getWhileLoc(), Cond.get()); if (CondE.isInvalid()) @@ -3661,7 +3659,7 @@ TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) { return SemaRef.StmtError(); // Transform the body - OwningStmtResult Body = getDerived().TransformStmt(S->getBody()); + StmtResult Body = getDerived().TransformStmt(S->getBody()); if (Body.isInvalid()) return SemaRef.StmtError(); @@ -3676,15 +3674,15 @@ TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformDoStmt(DoStmt *S) { // Transform the body - OwningStmtResult Body = getDerived().TransformStmt(S->getBody()); + StmtResult Body = getDerived().TransformStmt(S->getBody()); if (Body.isInvalid()) return SemaRef.StmtError(); // Transform the condition - OwningExprResult Cond = getDerived().TransformExpr(S->getCond()); + ExprResult Cond = getDerived().TransformExpr(S->getCond()); if (Cond.isInvalid()) return SemaRef.StmtError(); @@ -3699,15 +3697,15 @@ TreeTransform<Derived>::TransformDoStmt(DoStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformForStmt(ForStmt *S) { // Transform the initialization statement - OwningStmtResult Init = getDerived().TransformStmt(S->getInit()); + StmtResult Init = getDerived().TransformStmt(S->getInit()); if (Init.isInvalid()) return SemaRef.StmtError(); // Transform the condition - OwningExprResult Cond; + ExprResult Cond; VarDecl *ConditionVar = 0; if (S->getConditionVariable()) { ConditionVar @@ -3725,7 +3723,7 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) { if (S->getCond()) { // Convert the condition to a boolean value. - OwningExprResult CondE = getSema().ActOnBooleanCondition(0, + ExprResult CondE = getSema().ActOnBooleanCondition(0, S->getForLoc(), Cond.get()); if (CondE.isInvalid()) @@ -3740,7 +3738,7 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) { return SemaRef.StmtError(); // Transform the increment - OwningExprResult Inc = getDerived().TransformExpr(S->getInc()); + ExprResult Inc = getDerived().TransformExpr(S->getInc()); if (Inc.isInvalid()) return SemaRef.StmtError(); @@ -3749,7 +3747,7 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) { return SemaRef.StmtError(); // Transform the body - OwningStmtResult Body = getDerived().TransformStmt(S->getBody()); + StmtResult Body = getDerived().TransformStmt(S->getBody()); if (Body.isInvalid()) return SemaRef.StmtError(); @@ -3766,7 +3764,7 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) { // Goto statements must always be rebuilt, to resolve the label. return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(), @@ -3774,9 +3772,9 @@ TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) { - OwningExprResult Target = getDerived().TransformExpr(S->getTarget()); + ExprResult Target = getDerived().TransformExpr(S->getTarget()); if (Target.isInvalid()) return SemaRef.StmtError(); @@ -3789,21 +3787,21 @@ TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) { return SemaRef.Owned(S->Retain()); } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) { return SemaRef.Owned(S->Retain()); } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) { - Sema::OwningExprResult Result = getDerived().TransformExpr(S->getRetValue()); + ExprResult Result = getDerived().TransformExpr(S->getRetValue()); if (Result.isInvalid()) return SemaRef.StmtError(); @@ -3813,7 +3811,7 @@ TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) { bool DeclChanged = false; llvm::SmallVector<Decl *, 4> Decls; @@ -3838,21 +3836,21 @@ TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformSwitchCase(SwitchCase *S) { assert(false && "SwitchCase is abstract and cannot be transformed"); return SemaRef.Owned(S->Retain()); } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) { ASTOwningVector<Expr*> Constraints(getSema()); ASTOwningVector<Expr*> Exprs(getSema()); llvm::SmallVector<IdentifierInfo *, 4> Names; - OwningExprResult AsmString; + ExprResult AsmString; ASTOwningVector<Expr*> Clobbers(getSema()); bool ExprsChanged = false; @@ -3866,7 +3864,7 @@ TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) { // Transform the output expr. Expr *OutputExpr = S->getOutputExpr(I); - OwningExprResult Result = getDerived().TransformExpr(OutputExpr); + ExprResult Result = getDerived().TransformExpr(OutputExpr); if (Result.isInvalid()) return SemaRef.StmtError(); @@ -3884,7 +3882,7 @@ TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) { // Transform the input expr. Expr *InputExpr = S->getInputExpr(I); - OwningExprResult Result = getDerived().TransformExpr(InputExpr); + ExprResult Result = getDerived().TransformExpr(InputExpr); if (Result.isInvalid()) return SemaRef.StmtError(); @@ -3919,10 +3917,10 @@ TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) { template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) { // Transform the body of the @try. - OwningStmtResult TryBody = getDerived().TransformStmt(S->getTryBody()); + StmtResult TryBody = getDerived().TransformStmt(S->getTryBody()); if (TryBody.isInvalid()) return SemaRef.StmtError(); @@ -3930,7 +3928,7 @@ TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) { bool AnyCatchChanged = false; ASTOwningVector<Stmt*> CatchStmts(SemaRef); for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) { - OwningStmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I)); + StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I)); if (Catch.isInvalid()) return SemaRef.StmtError(); if (Catch.get() != S->getCatchStmt(I)) @@ -3939,7 +3937,7 @@ TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) { } // Transform the @finally statement (if present). - OwningStmtResult Finally; + StmtResult Finally; if (S->getFinallyStmt()) { Finally = getDerived().TransformStmt(S->getFinallyStmt()); if (Finally.isInvalid()) @@ -3959,7 +3957,7 @@ TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) { // Transform the @catch parameter, if there is one. VarDecl *Var = 0; @@ -3985,7 +3983,7 @@ TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) { return SemaRef.StmtError(); } - OwningStmtResult Body = getDerived().TransformStmt(S->getCatchBody()); + StmtResult Body = getDerived().TransformStmt(S->getCatchBody()); if (Body.isInvalid()) return SemaRef.StmtError(); @@ -3995,10 +3993,10 @@ TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { // Transform the body. - OwningStmtResult Body = getDerived().TransformStmt(S->getFinallyBody()); + StmtResult Body = getDerived().TransformStmt(S->getFinallyBody()); if (Body.isInvalid()) return SemaRef.StmtError(); @@ -4013,9 +4011,9 @@ TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) { - OwningExprResult Operand; + ExprResult Operand; if (S->getThrowExpr()) { Operand = getDerived().TransformExpr(S->getThrowExpr()); if (Operand.isInvalid()) @@ -4030,16 +4028,16 @@ TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformObjCAtSynchronizedStmt( ObjCAtSynchronizedStmt *S) { // Transform the object we are locking. - OwningExprResult Object = getDerived().TransformExpr(S->getSynchExpr()); + ExprResult Object = getDerived().TransformExpr(S->getSynchExpr()); if (Object.isInvalid()) return SemaRef.StmtError(); // Transform the body. - OwningStmtResult Body = getDerived().TransformStmt(S->getSynchBody()); + StmtResult Body = getDerived().TransformStmt(S->getSynchBody()); if (Body.isInvalid()) return SemaRef.StmtError(); @@ -4055,21 +4053,21 @@ TreeTransform<Derived>::TransformObjCAtSynchronizedStmt( } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformObjCForCollectionStmt( ObjCForCollectionStmt *S) { // Transform the element statement. - OwningStmtResult Element = getDerived().TransformStmt(S->getElement()); + StmtResult Element = getDerived().TransformStmt(S->getElement()); if (Element.isInvalid()) return SemaRef.StmtError(); // Transform the collection expression. - OwningExprResult Collection = getDerived().TransformExpr(S->getCollection()); + ExprResult Collection = getDerived().TransformExpr(S->getCollection()); if (Collection.isInvalid()) return SemaRef.StmtError(); // Transform the body. - OwningStmtResult Body = getDerived().TransformStmt(S->getBody()); + StmtResult Body = getDerived().TransformStmt(S->getBody()); if (Body.isInvalid()) return SemaRef.StmtError(); @@ -4091,7 +4089,7 @@ TreeTransform<Derived>::TransformObjCForCollectionStmt( template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) { // Transform the exception declaration, if any. VarDecl *Var = 0; @@ -4116,7 +4114,7 @@ TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) { } // Transform the actual exception handler. - OwningStmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock()); + StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock()); if (Handler.isInvalid()) return SemaRef.StmtError(); @@ -4131,10 +4129,10 @@ TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) { } template<typename Derived> -Sema::OwningStmtResult +StmtResult TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) { // Transform the try block itself. - OwningStmtResult TryBlock + StmtResult TryBlock = getDerived().TransformCompoundStmt(S->getTryBlock()); if (TryBlock.isInvalid()) return SemaRef.StmtError(); @@ -4143,7 +4141,7 @@ TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) { bool HandlerChanged = false; ASTOwningVector<Stmt*> Handlers(SemaRef); for (unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) { - OwningStmtResult Handler + StmtResult Handler = getDerived().TransformCXXCatchStmt(S->getHandler(I)); if (Handler.isInvalid()) return SemaRef.StmtError(); @@ -4165,13 +4163,13 @@ TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) { // Expression transformation //===----------------------------------------------------------------------===// template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) { NestedNameSpecifier *Qualifier = 0; if (E->getQualifier()) { @@ -4225,39 +4223,39 @@ TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformStringLiteral(StringLiteral *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) { - OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr()); + ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr()); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -4269,9 +4267,9 @@ TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformUnaryOperator(UnaryOperator *E) { - OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr()); + ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr()); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -4284,7 +4282,7 @@ TreeTransform<Derived>::TransformUnaryOperator(UnaryOperator *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) { // Transform the type. TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo()); @@ -4310,7 +4308,7 @@ TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) { switch (ON.getKind()) { case Node::Array: { Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex()); - OwningExprResult Index = getDerived().TransformExpr(FromIndex); + ExprResult Index = getDerived().TransformExpr(FromIndex); if (Index.isInvalid()) return getSema().ExprError(); @@ -4350,7 +4348,7 @@ TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { if (E->isArgumentType()) { TypeSourceInfo *OldT = E->getArgumentTypeInfo(); @@ -4367,7 +4365,7 @@ TreeTransform<Derived>::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { E->getSourceRange()); } - Sema::OwningExprResult SubExpr; + ExprResult SubExpr; { // C++0x [expr.sizeof]p1: // The operand is either an expression, which is an unevaluated operand @@ -4388,13 +4386,13 @@ TreeTransform<Derived>::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) { - OwningExprResult LHS = getDerived().TransformExpr(E->getLHS()); + ExprResult LHS = getDerived().TransformExpr(E->getLHS()); if (LHS.isInvalid()) return SemaRef.ExprError(); - OwningExprResult RHS = getDerived().TransformExpr(E->getRHS()); + ExprResult RHS = getDerived().TransformExpr(E->getRHS()); if (RHS.isInvalid()) return SemaRef.ExprError(); @@ -4411,10 +4409,10 @@ TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCallExpr(CallExpr *E) { // Transform the callee. - OwningExprResult Callee = getDerived().TransformExpr(E->getCallee()); + ExprResult Callee = getDerived().TransformExpr(E->getCallee()); if (Callee.isInvalid()) return SemaRef.ExprError(); @@ -4423,7 +4421,7 @@ TreeTransform<Derived>::TransformCallExpr(CallExpr *E) { ASTOwningVector<Expr*> Args(SemaRef); llvm::SmallVector<SourceLocation, 4> FakeCommaLocs; for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) { - OwningExprResult Arg = getDerived().TransformExpr(E->getArg(I)); + ExprResult Arg = getDerived().TransformExpr(E->getArg(I)); if (Arg.isInvalid()) return SemaRef.ExprError(); @@ -4450,9 +4448,9 @@ TreeTransform<Derived>::TransformCallExpr(CallExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) { - OwningExprResult Base = getDerived().TransformExpr(E->getBase()); + ExprResult Base = getDerived().TransformExpr(E->getBase()); if (Base.isInvalid()) return SemaRef.ExprError(); @@ -4529,13 +4527,13 @@ TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) { - OwningExprResult LHS = getDerived().TransformExpr(E->getLHS()); + ExprResult LHS = getDerived().TransformExpr(E->getLHS()); if (LHS.isInvalid()) return SemaRef.ExprError(); - OwningExprResult RHS = getDerived().TransformExpr(E->getRHS()); + ExprResult RHS = getDerived().TransformExpr(E->getRHS()); if (RHS.isInvalid()) return SemaRef.ExprError(); @@ -4549,24 +4547,24 @@ TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCompoundAssignOperator( CompoundAssignOperator *E) { return getDerived().TransformBinaryOperator(E); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) { - OwningExprResult Cond = getDerived().TransformExpr(E->getCond()); + ExprResult Cond = getDerived().TransformExpr(E->getCond()); if (Cond.isInvalid()) return SemaRef.ExprError(); - OwningExprResult LHS = getDerived().TransformExpr(E->getLHS()); + ExprResult LHS = getDerived().TransformExpr(E->getLHS()); if (LHS.isInvalid()) return SemaRef.ExprError(); - OwningExprResult RHS = getDerived().TransformExpr(E->getRHS()); + ExprResult RHS = getDerived().TransformExpr(E->getRHS()); if (RHS.isInvalid()) return SemaRef.ExprError(); @@ -4584,7 +4582,7 @@ TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *E) { // Implicit casts are eliminated during transformation, since they // will be recomputed by semantic analysis after transformation. @@ -4592,7 +4590,7 @@ TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) { TypeSourceInfo *OldT; TypeSourceInfo *NewT; @@ -4608,7 +4606,7 @@ TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) { return SemaRef.ExprError(); } - OwningExprResult SubExpr + ExprResult SubExpr = getDerived().TransformExpr(E->getSubExprAsWritten()); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -4625,14 +4623,14 @@ TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) { TypeSourceInfo *OldT = E->getTypeSourceInfo(); TypeSourceInfo *NewT = getDerived().TransformType(OldT); if (!NewT) return SemaRef.ExprError(); - OwningExprResult Init = getDerived().TransformExpr(E->getInitializer()); + ExprResult Init = getDerived().TransformExpr(E->getInitializer()); if (Init.isInvalid()) return SemaRef.ExprError(); @@ -4651,9 +4649,9 @@ TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) { - OwningExprResult Base = getDerived().TransformExpr(E->getBase()); + ExprResult Base = getDerived().TransformExpr(E->getBase()); if (Base.isInvalid()) return SemaRef.ExprError(); @@ -4670,13 +4668,13 @@ TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) { bool InitChanged = false; ASTOwningVector<Expr*, 4> Inits(SemaRef); for (unsigned I = 0, N = E->getNumInits(); I != N; ++I) { - OwningExprResult Init = getDerived().TransformExpr(E->getInit(I)); + ExprResult Init = getDerived().TransformExpr(E->getInit(I)); if (Init.isInvalid()) return SemaRef.ExprError(); @@ -4692,12 +4690,12 @@ TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) { Designation Desig; // transform the initializer value - OwningExprResult Init = getDerived().TransformExpr(E->getInit()); + ExprResult Init = getDerived().TransformExpr(E->getInit()); if (Init.isInvalid()) return SemaRef.ExprError(); @@ -4715,7 +4713,7 @@ TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) { } if (D->isArrayDesignator()) { - OwningExprResult Index = getDerived().TransformExpr(E->getArrayIndex(*D)); + ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(*D)); if (Index.isInvalid()) return SemaRef.ExprError(); @@ -4728,12 +4726,12 @@ TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) { } assert(D->isArrayRangeDesignator() && "New kind of designator?"); - OwningExprResult Start + ExprResult Start = getDerived().TransformExpr(E->getArrayRangeStart(*D)); if (Start.isInvalid()) return SemaRef.ExprError(); - OwningExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(*D)); + ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(*D)); if (End.isInvalid()) return SemaRef.ExprError(); @@ -4760,7 +4758,7 @@ TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformImplicitValueInitExpr( ImplicitValueInitExpr *E) { TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName()); @@ -4779,13 +4777,13 @@ TreeTransform<Derived>::TransformImplicitValueInitExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *E) { TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo()); if (!TInfo) return SemaRef.ExprError(); - OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr()); + ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr()); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -4799,12 +4797,12 @@ TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *E) { bool ArgumentChanged = false; ASTOwningVector<Expr*, 4> Inits(SemaRef); for (unsigned I = 0, N = E->getNumExprs(); I != N; ++I) { - OwningExprResult Init = getDerived().TransformExpr(E->getExpr(I)); + ExprResult Init = getDerived().TransformExpr(E->getExpr(I)); if (Init.isInvalid()) return SemaRef.ExprError(); @@ -4823,16 +4821,16 @@ TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *E) { /// rebuilds the expression, so that the label identifier can be resolved to /// the corresponding label statement by semantic analysis. template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *E) { return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(), E->getLabel()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) { - OwningStmtResult SubStmt + StmtResult SubStmt = getDerived().TransformCompoundStmt(E->getSubStmt(), true); if (SubStmt.isInvalid()) return SemaRef.ExprError(); @@ -4847,7 +4845,7 @@ TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformTypesCompatibleExpr(TypesCompatibleExpr *E) { TypeSourceInfo *TInfo1; TypeSourceInfo *TInfo2; @@ -4871,17 +4869,17 @@ TreeTransform<Derived>::TransformTypesCompatibleExpr(TypesCompatibleExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) { - OwningExprResult Cond = getDerived().TransformExpr(E->getCond()); + ExprResult Cond = getDerived().TransformExpr(E->getCond()); if (Cond.isInvalid()) return SemaRef.ExprError(); - OwningExprResult LHS = getDerived().TransformExpr(E->getLHS()); + ExprResult LHS = getDerived().TransformExpr(E->getLHS()); if (LHS.isInvalid()) return SemaRef.ExprError(); - OwningExprResult RHS = getDerived().TransformExpr(E->getRHS()); + ExprResult RHS = getDerived().TransformExpr(E->getRHS()); if (RHS.isInvalid()) return SemaRef.ExprError(); @@ -4897,13 +4895,13 @@ TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) { switch (E->getOperator()) { case OO_New: @@ -4918,7 +4916,7 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) { assert(E->getNumArgs() >= 1 && "Object call is missing arguments"); // Transform the object itself. - OwningExprResult Object = getDerived().TransformExpr(E->getArg(0)); + ExprResult Object = getDerived().TransformExpr(E->getArg(0)); if (Object.isInvalid()) return SemaRef.ExprError(); @@ -4934,7 +4932,7 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) { if (getDerived().DropCallArgument(E->getArg(I))) break; - OwningExprResult Arg = getDerived().TransformExpr(E->getArg(I)); + ExprResult Arg = getDerived().TransformExpr(E->getArg(I)); if (Arg.isInvalid()) return SemaRef.ExprError(); @@ -4970,15 +4968,15 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) { return SemaRef.ExprError(); } - OwningExprResult Callee = getDerived().TransformExpr(E->getCallee()); + ExprResult Callee = getDerived().TransformExpr(E->getCallee()); if (Callee.isInvalid()) return SemaRef.ExprError(); - OwningExprResult First = getDerived().TransformExpr(E->getArg(0)); + ExprResult First = getDerived().TransformExpr(E->getArg(0)); if (First.isInvalid()) return SemaRef.ExprError(); - OwningExprResult Second; + ExprResult Second; if (E->getNumArgs() == 2) { Second = getDerived().TransformExpr(E->getArg(1)); if (Second.isInvalid()) @@ -4999,13 +4997,13 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *E) { return getDerived().TransformCallExpr(E); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXNamedCastExpr(CXXNamedCastExpr *E) { TypeSourceInfo *OldT; TypeSourceInfo *NewT; @@ -5021,7 +5019,7 @@ TreeTransform<Derived>::TransformCXXNamedCastExpr(CXXNamedCastExpr *E) { return SemaRef.ExprError(); } - OwningExprResult SubExpr + ExprResult SubExpr = getDerived().TransformExpr(E->getSubExprAsWritten()); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -5049,32 +5047,32 @@ TreeTransform<Derived>::TransformCXXNamedCastExpr(CXXNamedCastExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) { return getDerived().TransformCXXNamedCastExpr(E); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *E) { return getDerived().TransformCXXNamedCastExpr(E); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXReinterpretCastExpr( CXXReinterpretCastExpr *E) { return getDerived().TransformCXXNamedCastExpr(E); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *E) { return getDerived().TransformCXXNamedCastExpr(E); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXFunctionalCastExpr( CXXFunctionalCastExpr *E) { TypeSourceInfo *OldT; @@ -5088,7 +5086,7 @@ TreeTransform<Derived>::TransformCXXFunctionalCastExpr( return SemaRef.ExprError(); } - OwningExprResult SubExpr + ExprResult SubExpr = getDerived().TransformExpr(E->getSubExprAsWritten()); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -5108,7 +5106,7 @@ TreeTransform<Derived>::TransformCXXFunctionalCastExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) { if (E->isTypeOperand()) { TypeSourceInfo *TInfo @@ -5132,7 +5130,7 @@ TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) { EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::PotentiallyPotentiallyEvaluated); - OwningExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand()); + ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand()); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -5147,20 +5145,20 @@ TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr( CXXNullPtrLiteralExpr *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) { TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName()); @@ -5176,9 +5174,9 @@ TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) { - OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr()); + ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr()); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -5190,7 +5188,7 @@ TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) { ParmVarDecl *Param = cast_or_null<ParmVarDecl>(getDerived().TransformDecl(E->getLocStart(), @@ -5206,7 +5204,7 @@ TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) { TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName()); @@ -5225,7 +5223,7 @@ TreeTransform<Derived>::TransformCXXScalarValueInitExpr(CXXScalarValueInitExpr * } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) { // Transform the type that we're allocating TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName()); @@ -5234,7 +5232,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) { return SemaRef.ExprError(); // Transform the size of the array we're allocating (if any). - OwningExprResult ArraySize = getDerived().TransformExpr(E->getArraySize()); + ExprResult ArraySize = getDerived().TransformExpr(E->getArraySize()); if (ArraySize.isInvalid()) return SemaRef.ExprError(); @@ -5242,7 +5240,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) { bool ArgumentChanged = false; ASTOwningVector<Expr*> PlacementArgs(SemaRef); for (unsigned I = 0, N = E->getNumPlacementArgs(); I != N; ++I) { - OwningExprResult Arg = getDerived().TransformExpr(E->getPlacementArg(I)); + ExprResult Arg = getDerived().TransformExpr(E->getPlacementArg(I)); if (Arg.isInvalid()) return SemaRef.ExprError(); @@ -5256,7 +5254,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) { if (getDerived().DropCallArgument(E->getConstructorArg(I))) break; - OwningExprResult Arg = getDerived().TransformExpr(E->getConstructorArg(I)); + ExprResult Arg = getDerived().TransformExpr(E->getConstructorArg(I)); if (Arg.isInvalid()) return SemaRef.ExprError(); @@ -5351,9 +5349,9 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) { - OwningExprResult Operand = getDerived().TransformExpr(E->getArgument()); + ExprResult Operand = getDerived().TransformExpr(E->getArgument()); if (Operand.isInvalid()) return SemaRef.ExprError(); @@ -5384,10 +5382,10 @@ TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXPseudoDestructorExpr( CXXPseudoDestructorExpr *E) { - OwningExprResult Base = getDerived().TransformExpr(E->getBase()); + ExprResult Base = getDerived().TransformExpr(E->getBase()); if (Base.isInvalid()) return SemaRef.ExprError(); @@ -5463,7 +5461,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformUnresolvedLookupExpr( UnresolvedLookupExpr *Old) { TemporaryBase Rebase(*this, Old->getNameLoc(), DeclarationName()); @@ -5545,7 +5543,7 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) { TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName()); @@ -5569,7 +5567,7 @@ TreeTransform<Derived>::TransformUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformDependentScopeDeclRefExpr( DependentScopeDeclRefExpr *E) { NestedNameSpecifier *NNS @@ -5612,7 +5610,7 @@ TreeTransform<Derived>::TransformDependentScopeDeclRefExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) { // CXXConstructExprs are always implicit, so when we have a // 1-argument construction we just transform that argument. @@ -5643,7 +5641,7 @@ TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) { break; } - OwningExprResult TransArg = getDerived().TransformExpr(*Arg); + ExprResult TransArg = getDerived().TransformExpr(*Arg); if (TransArg.isInvalid()) return SemaRef.ExprError(); @@ -5673,7 +5671,7 @@ TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) { /// Since CXXBindTemporaryExpr nodes are implicitly generated, we just /// transform the subexpression and return that. template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { return getDerived().TransformExpr(E->getSubExpr()); } @@ -5683,7 +5681,7 @@ TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { /// Since CXXBindReferenceExpr nodes are implicitly generated, we just /// transform the subexpression and return that. template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXBindReferenceExpr(CXXBindReferenceExpr *E) { return getDerived().TransformExpr(E->getSubExpr()); } @@ -5694,14 +5692,14 @@ TreeTransform<Derived>::TransformCXXBindReferenceExpr(CXXBindReferenceExpr *E) { /// Since CXXExprWithTemporaries nodes are implicitly generated, we /// just transform the subexpression and return that. template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXExprWithTemporaries( CXXExprWithTemporaries *E) { return getDerived().TransformExpr(E->getSubExpr()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXTemporaryObjectExpr( CXXTemporaryObjectExpr *E) { TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName()); @@ -5727,7 +5725,7 @@ TreeTransform<Derived>::TransformCXXTemporaryObjectExpr( break; } - OwningExprResult TransArg = getDerived().TransformExpr(*Arg); + ExprResult TransArg = getDerived().TransformExpr(*Arg); if (TransArg.isInvalid()) return SemaRef.ExprError(); @@ -5760,7 +5758,7 @@ TreeTransform<Derived>::TransformCXXTemporaryObjectExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXUnresolvedConstructExpr( CXXUnresolvedConstructExpr *E) { TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName()); @@ -5774,7 +5772,7 @@ TreeTransform<Derived>::TransformCXXUnresolvedConstructExpr( for (CXXUnresolvedConstructExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end(); Arg != ArgEnd; ++Arg) { - OwningExprResult TransArg = getDerived().TransformExpr(*Arg); + ExprResult TransArg = getDerived().TransformExpr(*Arg); if (TransArg.isInvalid()) return SemaRef.ExprError(); @@ -5799,11 +5797,11 @@ TreeTransform<Derived>::TransformCXXUnresolvedConstructExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr( CXXDependentScopeMemberExpr *E) { // Transform the base of the expression. - OwningExprResult Base((Expr*) 0); + ExprResult Base((Expr*) 0); Expr *OldBase; QualType BaseType; QualType ObjectType; @@ -5897,10 +5895,10 @@ TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old) { // Transform the base of the expression. - OwningExprResult Base((Expr*) 0); + ExprResult Base((Expr*) 0); QualType BaseType; if (!Old->isImplicitAccess()) { Base = getDerived().TransformExpr(Old->getBase()); @@ -5996,13 +5994,13 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old) } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) { TypeSourceInfo *EncodedTypeInfo = getDerived().TransformType(E->getEncodedTypeSourceInfo()); @@ -6019,13 +6017,13 @@ TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) { // Transform arguments. bool ArgChanged = false; ASTOwningVector<Expr*> Args(SemaRef); for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) { - OwningExprResult Arg = getDerived().TransformExpr(E->getArg(I)); + ExprResult Arg = getDerived().TransformExpr(E->getArg(I)); if (Arg.isInvalid()) return SemaRef.ExprError(); @@ -6057,7 +6055,7 @@ TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) { // Instance message: transform the receiver assert(E->getReceiverKind() == ObjCMessageExpr::Instance && "Only class and instance messages may be instantiated"); - OwningExprResult Receiver + ExprResult Receiver = getDerived().TransformExpr(E->getInstanceReceiver()); if (Receiver.isInvalid()) return SemaRef.ExprError(); @@ -6077,22 +6075,22 @@ TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *E) { return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) { // Transform the base expression. - OwningExprResult Base = getDerived().TransformExpr(E->getBase()); + ExprResult Base = getDerived().TransformExpr(E->getBase()); if (Base.isInvalid()) return SemaRef.ExprError(); @@ -6109,10 +6107,10 @@ TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { // Transform the base expression. - OwningExprResult Base = getDerived().TransformExpr(E->getBase()); + ExprResult Base = getDerived().TransformExpr(E->getBase()); if (Base.isInvalid()) return SemaRef.ExprError(); @@ -6128,7 +6126,7 @@ TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCImplicitSetterGetterRefExpr( ObjCImplicitSetterGetterRefExpr *E) { // If this implicit setter/getter refers to class methods, it cannot have any @@ -6137,7 +6135,7 @@ TreeTransform<Derived>::TransformObjCImplicitSetterGetterRefExpr( return SemaRef.Owned(E->Retain()); // Transform the base expression. - OwningExprResult Base = getDerived().TransformExpr(E->getBase()); + ExprResult Base = getDerived().TransformExpr(E->getBase()); if (Base.isInvalid()) return SemaRef.ExprError(); @@ -6158,17 +6156,17 @@ TreeTransform<Derived>::TransformObjCImplicitSetterGetterRefExpr( } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCSuperExpr(ObjCSuperExpr *E) { // Can never occur in a dependent context. return SemaRef.Owned(E->Retain()); } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) { // Transform the base expression. - OwningExprResult Base = getDerived().TransformExpr(E->getBase()); + ExprResult Base = getDerived().TransformExpr(E->getBase()); if (Base.isInvalid()) return SemaRef.ExprError(); @@ -6182,12 +6180,12 @@ TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) { bool ArgumentChanged = false; ASTOwningVector<Expr*> SubExprs(SemaRef); for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I) { - OwningExprResult SubExpr = getDerived().TransformExpr(E->getExpr(I)); + ExprResult SubExpr = getDerived().TransformExpr(E->getExpr(I)); if (SubExpr.isInvalid()) return SemaRef.ExprError(); @@ -6205,7 +6203,7 @@ TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) { SourceLocation CaretLoc(E->getExprLoc()); @@ -6236,7 +6234,7 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) { } // Transform the body - OwningStmtResult Body = getDerived().TransformStmt(E->getBody()); + StmtResult Body = getDerived().TransformStmt(E->getBody()); if (Body.isInvalid()) return SemaRef.ExprError(); // Set the parameters on the block decl. @@ -6256,7 +6254,7 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) { } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::TransformBlockDeclRefExpr(BlockDeclRefExpr *E) { NestedNameSpecifier *Qualifier = 0; @@ -6586,7 +6584,7 @@ TreeTransform<Derived>::RebuildTemplateName(NestedNameSpecifier *Qualifier, } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op, SourceLocation OpLoc, Expr *OrigCallee, @@ -6620,7 +6618,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op, // 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 + ExprResult Result = SemaRef.CreateBuiltinBinOp(OpLoc, Opc, First, Second); if (Result.isInvalid()) return SemaRef.ExprError(); @@ -6663,7 +6661,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op, // Create the overloaded operator invocation for binary operators. BinaryOperator::Opcode Opc = BinaryOperator::getOverloadedOpcode(Op); - OwningExprResult Result + ExprResult Result = SemaRef.CreateOverloadedBinOp(OpLoc, Opc, Functions, Args[0], Args[1]); if (Result.isInvalid()) return SemaRef.ExprError(); @@ -6672,7 +6670,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op, } template<typename Derived> -Sema::OwningExprResult +ExprResult TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(Expr *Base, SourceLocation OperatorLoc, bool isArrow, |