252 changes: 116 additions & 136 deletions clang/lib/Sema/SemaExpr.cpp

Large diffs are not rendered by default.

177 changes: 79 additions & 98 deletions clang/lib/Sema/SemaExprCXX.cpp

Large diffs are not rendered by default.

96 changes: 39 additions & 57 deletions clang/lib/Sema/SemaExprMember.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,10 @@ Sema::ActOnDependentMemberExpr(Expr *BaseExpr, QualType BaseType,

// Get the type being accessed in BaseType. If this is an arrow, the BaseExpr
// must have pointer type, and the accessed type is the pointee.
return Owned(CXXDependentScopeMemberExpr::Create(Context, BaseExpr, BaseType,
IsArrow, OpLoc,
SS.getWithLocInContext(Context),
TemplateKWLoc,
FirstQualifierInScope,
NameInfo, TemplateArgs));
return CXXDependentScopeMemberExpr::Create(
Context, BaseExpr, BaseType, IsArrow, OpLoc,
SS.getWithLocInContext(Context), TemplateKWLoc, FirstQualifierInScope,
NameInfo, TemplateArgs);
}

/// We know that the given qualified member reference points only to
Expand Down Expand Up @@ -683,7 +681,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,

// Explicit member accesses.
} else {
ExprResult BaseResult = Owned(Base);
ExprResult BaseResult = Base;
ExprResult Result =
LookupMemberExpr(R, BaseResult, IsArrow, OpLoc,
SS, /*ObjCImpDecl*/ nullptr, TemplateArgs != nullptr);
Expand All @@ -692,10 +690,8 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
return ExprError();
Base = BaseResult.get();

if (Result.isInvalid()) {
Owned(Base);
if (Result.isInvalid())
return ExprError();
}

if (Result.get())
return Result;
Expand Down Expand Up @@ -825,7 +821,7 @@ Sema::BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS,
fakeFoundDecl, memberNameInfo).get();
}

return Owned(result);
return result;
}

static ExprResult
Expand Down Expand Up @@ -996,7 +992,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
TemplateKWLoc, MemberNameInfo,
TemplateArgs, R.begin(), R.end());

return Owned(MemExpr);
return MemExpr;
}

assert(R.isSingleResult());
Expand Down Expand Up @@ -1033,10 +1029,8 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
}

// Check the use of this member.
if (ShouldCheckUse && DiagnoseUseOfDecl(MemberDecl, MemberLoc)) {
Owned(BaseExpr);
if (ShouldCheckUse && DiagnoseUseOfDecl(MemberDecl, MemberLoc))
return ExprError();
}

if (FieldDecl *FD = dyn_cast<FieldDecl>(MemberDecl))
return BuildFieldReferenceExpr(*this, BaseExpr, IsArrow,
Expand All @@ -1054,10 +1048,10 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
OpLoc);

if (VarDecl *Var = dyn_cast<VarDecl>(MemberDecl)) {
return Owned(BuildMemberExpr(*this, Context, BaseExpr, IsArrow, SS,
TemplateKWLoc, Var, FoundDecl, MemberNameInfo,
Var->getType().getNonReferenceType(),
VK_LValue, OK_Ordinary));
return BuildMemberExpr(*this, Context, BaseExpr, IsArrow, SS, TemplateKWLoc,
Var, FoundDecl, MemberNameInfo,
Var->getType().getNonReferenceType(), VK_LValue,
OK_Ordinary);
}

if (CXXMethodDecl *MemberFn = dyn_cast<CXXMethodDecl>(MemberDecl)) {
Expand All @@ -1071,21 +1065,18 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
type = MemberFn->getType();
}

return Owned(BuildMemberExpr(*this, Context, BaseExpr, IsArrow, SS,
TemplateKWLoc, MemberFn, FoundDecl,
MemberNameInfo, type, valueKind,
OK_Ordinary));
return BuildMemberExpr(*this, Context, BaseExpr, IsArrow, SS, TemplateKWLoc,
MemberFn, FoundDecl, MemberNameInfo, type, valueKind,
OK_Ordinary);
}
assert(!isa<FunctionDecl>(MemberDecl) && "member function not C++ method?");

if (EnumConstantDecl *Enum = dyn_cast<EnumConstantDecl>(MemberDecl)) {
return Owned(BuildMemberExpr(*this, Context, BaseExpr, IsArrow, SS,
TemplateKWLoc, Enum, FoundDecl, MemberNameInfo,
Enum->getType(), VK_RValue, OK_Ordinary));
return BuildMemberExpr(*this, Context, BaseExpr, IsArrow, SS, TemplateKWLoc,
Enum, FoundDecl, MemberNameInfo, Enum->getType(),
VK_RValue, OK_Ordinary);
}

Owned(BaseExpr);

// We found something that we didn't expect. Complain.
if (isa<TypeDecl>(MemberDecl))
Diag(MemberLoc, diag::err_typecheck_member_reference_type)
Expand Down Expand Up @@ -1219,7 +1210,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,

// Returning valid-but-null is how we indicate to the caller that
// the lookup result was filled in.
return Owned((Expr*) nullptr);
return ExprResult((Expr *)nullptr);
}

// Handle ivar access to Objective-C objects.
Expand All @@ -1246,9 +1237,8 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
// But we only actually find it this way on objects of type 'id',
// apparently.
if (OTy->isObjCId() && Member->isStr("isa"))
return Owned(new (Context) ObjCIsaExpr(BaseExpr.get(), IsArrow, MemberLoc,
OpLoc,
Context.getObjCClassType()));
return new (Context) ObjCIsaExpr(BaseExpr.get(), IsArrow, MemberLoc,
OpLoc, Context.getObjCClassType());
if (ShouldTryAgainWithRedefinitionType(*this, BaseExpr))
return LookupMemberExpr(R, BaseExpr, IsArrow, OpLoc, SS,
ObjCImpDecl, HasTemplateArgs);
Expand Down Expand Up @@ -1378,7 +1368,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
}
}

return Owned(Result);
return Result;
}

// Objective-C property access.
Expand Down Expand Up @@ -1412,12 +1402,9 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
if (DiagnoseUseOfDecl(PD, MemberLoc))
return ExprError();

return Owned(new (Context) ObjCPropertyRefExpr(PD,
Context.PseudoObjectTy,
VK_LValue,
OK_ObjCProperty,
MemberLoc,
BaseExpr.get()));
return new (Context)
ObjCPropertyRefExpr(PD, Context.PseudoObjectTy, VK_LValue,
OK_ObjCProperty, MemberLoc, BaseExpr.get());
}

if (ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(PMDecl)) {
Expand All @@ -1434,10 +1421,9 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
SetterSel, Context))
SMD = dyn_cast<ObjCMethodDecl>(SDecl);

return Owned(new (Context) ObjCPropertyRefExpr(OMD, SMD,
Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
MemberLoc, BaseExpr.get()));
return new (Context)
ObjCPropertyRefExpr(OMD, SMD, Context.PseudoObjectTy, VK_LValue,
OK_ObjCProperty, MemberLoc, BaseExpr.get());
}
}
// Use of id.member can only be for a property reference. Do not
Expand Down Expand Up @@ -1489,10 +1475,9 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
return ExprError();

if (Getter || Setter) {
return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
MemberLoc, BaseExpr.get()));
return new (Context) ObjCPropertyRefExpr(
Getter, Setter, Context.PseudoObjectTy, VK_LValue, OK_ObjCProperty,
MemberLoc, BaseExpr.get());
}

if (ShouldTryAgainWithRedefinitionType(*this, BaseExpr))
Expand All @@ -1519,8 +1504,8 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
if (ret.isNull())
return ExprError();

return Owned(new (Context) ExtVectorElementExpr(ret, VK, BaseExpr.get(),
*Member, MemberLoc));
return new (Context)
ExtVectorElementExpr(ret, VK, BaseExpr.get(), *Member, MemberLoc);
}

// Adjust builtin-sel to the appropriate redefinition type if that's
Expand Down Expand Up @@ -1635,17 +1620,15 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
NameInfo, TemplateArgs);
} else {
LookupResult R(*this, NameInfo, LookupMemberName);
ExprResult BaseResult = Owned(Base);
ExprResult BaseResult = Base;
Result = LookupMemberExpr(R, BaseResult, IsArrow, OpLoc,
SS, ObjCImpDecl, TemplateArgs != nullptr);
if (BaseResult.isInvalid())
return ExprError();
Base = BaseResult.get();

if (Result.isInvalid()) {
Owned(Base);
if (Result.isInvalid())
return ExprError();
}

if (Result.get()) {
// The only way a reference to a destructor can be used is to
Expand Down Expand Up @@ -1725,10 +1708,9 @@ BuildFieldReferenceExpr(Sema &S, Expr *BaseExpr, bool IsArrow,
FoundDecl, Field);
if (Base.isInvalid())
return ExprError();
return S.Owned(BuildMemberExpr(S, S.Context, Base.get(), IsArrow, SS,
/*TemplateKWLoc=*/SourceLocation(),
Field, FoundDecl, MemberNameInfo,
MemberType, VK, OK));
return BuildMemberExpr(S, S.Context, Base.get(), IsArrow, SS,
/*TemplateKWLoc=*/SourceLocation(), Field, FoundDecl,
MemberNameInfo, MemberType, VK, OK);
}

/// Builds an implicit member access expression. The current context
Expand Down
104 changes: 42 additions & 62 deletions clang/lib/Sema/SemaExprObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ ExprResult Sema::BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number) {
ParamDecl);
ExprResult ConvertedNumber = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(Number));
Number);
if (ConvertedNumber.isInvalid())
return ExprError();
Number = ConvertedNumber.get();
Expand Down Expand Up @@ -445,7 +445,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
if (ValueExpr->isTypeDependent()) {
ObjCBoxedExpr *BoxedExpr =
new (Context) ObjCBoxedExpr(ValueExpr, Context.DependentTy, nullptr, SR);
return Owned(BoxedExpr);
return BoxedExpr;
}
ObjCMethodDecl *BoxingMethod = nullptr;
QualType BoxedType;
Expand Down Expand Up @@ -586,7 +586,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
ParamDecl);
ExprResult ConvertedValueExpr = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(ValueExpr));
ValueExpr);
if (ConvertedValueExpr.isInvalid())
return ExprError();
ValueExpr = ConvertedValueExpr.get();
Expand Down Expand Up @@ -624,13 +624,9 @@ ExprResult Sema::BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr,
BaseExpr = Result.get();

// Build the pseudo-object expression.
return Owned(ObjCSubscriptRefExpr::Create(Context,
BaseExpr,
IndexExpr,
Context.PseudoObjectTy,
getterMethod,
setterMethod, RB));

return ObjCSubscriptRefExpr::Create(Context, BaseExpr, IndexExpr,
Context.PseudoObjectTy, getterMethod,
setterMethod, RB);
}

ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
Expand Down Expand Up @@ -1398,7 +1394,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,

InitializedEntity Entity = InitializedEntity::InitializeParameter(Context,
param);
ExprResult ArgE = PerformCopyInitialization(Entity, SelLoc, Owned(argExpr));
ExprResult ArgE = PerformCopyInitialization(Entity, SelLoc, argExpr);
if (ArgE.isInvalid())
IsError = true;
else
Expand Down Expand Up @@ -1583,14 +1579,13 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
if (DiagnoseUseOfDecl(PD, MemberLoc))
return ExprError();
if (Super)
return Owned(new (Context) ObjCPropertyRefExpr(PD, Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
MemberLoc,
SuperLoc, SuperType));
return new (Context)
ObjCPropertyRefExpr(PD, Context.PseudoObjectTy, VK_LValue,
OK_ObjCProperty, MemberLoc, SuperLoc, SuperType);
else
return Owned(new (Context) ObjCPropertyRefExpr(PD, Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
MemberLoc, BaseExpr));
return new (Context)
ObjCPropertyRefExpr(PD, Context.PseudoObjectTy, VK_LValue,
OK_ObjCProperty, MemberLoc, BaseExpr);
}
// Check protocols on qualified interfaces.
for (const auto *I : OPT->quals())
Expand All @@ -1600,19 +1595,13 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
return ExprError();

if (Super)
return Owned(new (Context) ObjCPropertyRefExpr(PD,
Context.PseudoObjectTy,
VK_LValue,
OK_ObjCProperty,
MemberLoc,
SuperLoc, SuperType));
return new (Context) ObjCPropertyRefExpr(
PD, Context.PseudoObjectTy, VK_LValue, OK_ObjCProperty, MemberLoc,
SuperLoc, SuperType);
else
return Owned(new (Context) ObjCPropertyRefExpr(PD,
Context.PseudoObjectTy,
VK_LValue,
OK_ObjCProperty,
MemberLoc,
BaseExpr));
return new (Context)
ObjCPropertyRefExpr(PD, Context.PseudoObjectTy, VK_LValue,
OK_ObjCProperty, MemberLoc, BaseExpr);
}
// If that failed, look for an "implicit" property by seeing if the nullary
// selector is implemented.
Expand Down Expand Up @@ -1658,16 +1647,13 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,

if (Getter || Setter) {
if (Super)
return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
MemberLoc,
SuperLoc, SuperType));
return new (Context)
ObjCPropertyRefExpr(Getter, Setter, Context.PseudoObjectTy, VK_LValue,
OK_ObjCProperty, MemberLoc, SuperLoc, SuperType);
else
return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
MemberLoc, BaseExpr));
return new (Context)
ObjCPropertyRefExpr(Getter, Setter, Context.PseudoObjectTy, VK_LValue,
OK_ObjCProperty, MemberLoc, BaseExpr);

}

Expand Down Expand Up @@ -1798,18 +1784,14 @@ ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,

if (Getter || Setter) {
if (IsSuper)
return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
propertyNameLoc,
receiverNameLoc,
Context.getObjCInterfaceType(IFace)));

return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
propertyNameLoc,
receiverNameLoc, IFace));
return new (Context)
ObjCPropertyRefExpr(Getter, Setter, Context.PseudoObjectTy, VK_LValue,
OK_ObjCProperty, propertyNameLoc, receiverNameLoc,
Context.getObjCInterfaceType(IFace));

return new (Context) ObjCPropertyRefExpr(
Getter, Setter, Context.PseudoObjectTy, VK_LValue, OK_ObjCProperty,
propertyNameLoc, receiverNameLoc, IFace);
}
return ExprError(Diag(propertyNameLoc, diag::err_property_not_found)
<< &propertyName << Context.getObjCInterfaceType(IFace));
Expand Down Expand Up @@ -2103,11 +2085,10 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
unsigned NumArgs = ArgsIn.size();
Expr **Args = ArgsIn.data();
assert(SuperLoc.isInvalid() && "Message to super with dependent type");
return Owned(ObjCMessageExpr::Create(Context, ReceiverType,
VK_RValue, LBracLoc, ReceiverTypeInfo,
Sel, SelectorLocs, /*Method=*/nullptr,
makeArrayRef(Args, NumArgs),RBracLoc,
isImplicit));
return ObjCMessageExpr::Create(
Context, ReceiverType, VK_RValue, LBracLoc, ReceiverTypeInfo, Sel,
SelectorLocs, /*Method=*/nullptr, makeArrayRef(Args, NumArgs), RBracLoc,
isImplicit);
}

// Find the class to which we are sending this message.
Expand Down Expand Up @@ -2297,11 +2278,10 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
unsigned NumArgs = ArgsIn.size();
Expr **Args = ArgsIn.data();
assert(SuperLoc.isInvalid() && "Message to super with dependent type");
return Owned(ObjCMessageExpr::Create(Context, Context.DependentTy,
VK_RValue, LBracLoc, Receiver, Sel,
SelectorLocs, /*Method=*/nullptr,
makeArrayRef(Args, NumArgs),
RBracLoc, isImplicit));
return ObjCMessageExpr::Create(
Context, Context.DependentTy, VK_RValue, LBracLoc, Receiver, Sel,
SelectorLocs, /*Method=*/nullptr, makeArrayRef(Args, NumArgs),
RBracLoc, isImplicit);
}

// If necessary, apply function/array conversion to the receiver.
Expand Down Expand Up @@ -2674,7 +2654,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
// The implicit assignment to self means we also don't want to
// consume the result.
Result->setDelegateInitCall(true);
return Owned(Result);
return Result;
}
}

Expand Down
104 changes: 44 additions & 60 deletions clang/lib/Sema/SemaInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
// compatible structure or union type. In the latter case, the
// initial value of the object, including unnamed members, is
// that of the expression.
ExprResult ExprRes = SemaRef.Owned(expr);
ExprResult ExprRes = expr;
if ((ElemType->isRecordType() || ElemType->isVectorType()) &&
SemaRef.CheckSingleAssignmentConstraints(ElemType, ExprRes,
!VerifyOnly)
Expand Down Expand Up @@ -930,8 +930,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
if (!VerifyOnly) {
// We cannot initialize this element, so let
// PerformCopyInitialization produce the appropriate diagnostic.
SemaRef.PerformCopyInitialization(Entity, SourceLocation(),
SemaRef.Owned(expr),
SemaRef.PerformCopyInitialization(Entity, SourceLocation(), expr,
/*TopLevelOfInitList=*/true);
}
hadError = true;
Expand Down Expand Up @@ -1019,15 +1018,14 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
}

if (VerifyOnly) {
if (!SemaRef.CanPerformCopyInitialization(Entity, SemaRef.Owned(expr)))
if (!SemaRef.CanPerformCopyInitialization(Entity,expr))
hadError = true;
++Index;
return;
}

ExprResult Result =
SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(),
SemaRef.Owned(expr),
SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr,
/*TopLevelOfInitList=*/true);

Expr *ResultExpr = nullptr;
Expand Down Expand Up @@ -1082,16 +1080,15 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity,
}

if (VerifyOnly) {
if (!SemaRef.CanPerformCopyInitialization(Entity, SemaRef.Owned(expr)))
if (!SemaRef.CanPerformCopyInitialization(Entity,expr))
hadError = true;
++Index;
return;
}

ExprResult Result =
SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(),
SemaRef.Owned(expr),
/*TopLevelOfInitList=*/true);
SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr,
/*TopLevelOfInitList=*/true);

if (Result.isInvalid())
hadError = true;
Expand Down Expand Up @@ -1130,16 +1127,15 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
Expr *Init = IList->getInit(Index);
if (!isa<InitListExpr>(Init) && Init->getType()->isVectorType()) {
if (VerifyOnly) {
if (!SemaRef.CanPerformCopyInitialization(Entity, SemaRef.Owned(Init)))
if (!SemaRef.CanPerformCopyInitialization(Entity, Init))
hadError = true;
++Index;
return;
}

ExprResult Result =
SemaRef.PerformCopyInitialization(Entity, Init->getLocStart(),
SemaRef.Owned(Init),
/*TopLevelOfInitList=*/true);
ExprResult Result =
SemaRef.PerformCopyInitialization(Entity, Init->getLocStart(), Init,
/*TopLevelOfInitList=*/true);

Expr *ResultExpr = nullptr;
if (Result.isInvalid())
Expand Down Expand Up @@ -2446,7 +2442,7 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig,
Diag(DIE->getLocStart(), diag::ext_designated_init)
<< DIE->getSourceRange();

return Owned(DIE);
return DIE;
}

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -5010,7 +5006,7 @@ static ExprResult CopyObject(Sema &S,
S.BuildCXXDefaultArgExpr(Loc, Constructor, Parm);
}

return S.Owned(CurInitExpr);
return CurInitExpr;
}

// Determine the arguments required to actually perform the
Expand Down Expand Up @@ -5169,7 +5165,7 @@ PerformConstructorInitialization(Sema &S,
S.DefineImplicitDefaultConstructor(Loc, Constructor);
}

ExprResult CurInit = S.Owned((Expr *)nullptr);
ExprResult CurInit((Expr *)nullptr);

// C++ [over.match.copy]p1:
// - When initializing a temporary to be bound to the first parameter
Expand Down Expand Up @@ -5204,13 +5200,10 @@ PerformConstructorInitialization(Sema &S,
? SourceRange(LBraceLoc, RBraceLoc)
: Kind.getParenRange();

CurInit = S.Owned(
new (S.Context) CXXTemporaryObjectExpr(S.Context, Constructor,
TSInfo, ConstructorArgs,
ParenOrBraceRange,
HadMultipleCandidates,
IsListInitialization,
ConstructorInitRequiresZeroInit));
CurInit = new (S.Context) CXXTemporaryObjectExpr(
S.Context, Constructor, TSInfo, ConstructorArgs, ParenOrBraceRange,
HadMultipleCandidates, IsListInitialization,
ConstructorInitRequiresZeroInit);
} else {
CXXConstructExpr::ConstructionKind ConstructKind =
CXXConstructExpr::CK_Complete;
Expand Down Expand Up @@ -5589,7 +5582,7 @@ InitializationSequence::Perform(Sema &S,

// No steps means no initialization.
if (Steps.empty())
return S.Owned((Expr *)nullptr);
return ExprResult((Expr *)nullptr);

if (S.getLangOpts().CPlusPlus11 && Entity.getType()->isReferenceType() &&
Args.size() == 1 && isa<InitListExpr>(Args[0]) &&
Expand Down Expand Up @@ -5622,7 +5615,7 @@ InitializationSequence::Perform(Sema &S,
*ResultType = Entity.getDecl() ? Entity.getDecl()->getType() :
Entity.getType();

ExprResult CurInit = S.Owned((Expr *)nullptr);
ExprResult CurInit((Expr *)nullptr);

// For initialization steps that start with a single initializer,
// grab the only argument out the Args and place it into the "current"
Expand Down Expand Up @@ -5721,11 +5714,9 @@ InitializationSequence::Perform(Sema &S,
(Step->Kind == SK_CastDerivedToBaseXValue ?
VK_XValue :
VK_RValue);
CurInit = S.Owned(ImplicitCastExpr::Create(S.Context,
Step->Type,
CK_DerivedToBase,
CurInit.get(),
&BasePath, VK));
CurInit =
ImplicitCastExpr::Create(S.Context, Step->Type, CK_DerivedToBase,
CurInit.get(), &BasePath, VK);
break;
}

Expand Down Expand Up @@ -5803,7 +5794,7 @@ InitializationSequence::Perform(Sema &S,
MTE->getType().isDestructedType()))
S.ExprNeedsCleanups = true;

CurInit = S.Owned(MTE);
CurInit = MTE;
break;
}

Expand Down Expand Up @@ -5904,11 +5895,9 @@ InitializationSequence::Perform(Sema &S,
}
}

CurInit = S.Owned(ImplicitCastExpr::Create(S.Context,
CurInit.get()->getType(),
CastKind, CurInit.get(),
nullptr,
CurInit.get()->getValueKind()));
CurInit = ImplicitCastExpr::Create(S.Context, CurInit.get()->getType(),
CastKind, CurInit.get(), nullptr,
CurInit.get()->getValueKind());
if (MaybeBindToTemp)
CurInit = S.MaybeBindToTemporary(CurInit.getAs<Expr>());
if (RequiresCopy)
Expand All @@ -5933,11 +5922,9 @@ InitializationSequence::Perform(Sema &S,

case SK_LValueToRValue: {
assert(CurInit.get()->isGLValue() && "cannot load from a prvalue");
CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, Step->Type,
CK_LValueToRValue,
CurInit.get(),
/*BasePath=*/nullptr,
VK_RValue));
CurInit = ImplicitCastExpr::Create(S.Context, Step->Type,
CK_LValueToRValue, CurInit.get(),
/*BasePath=*/nullptr, VK_RValue);
break;
}

Expand Down Expand Up @@ -5993,7 +5980,7 @@ InitializationSequence::Perform(Sema &S,
CurInit.get();
CurInit = shouldBindAsTemporary(InitEntity)
? S.MaybeBindToTemporary(StructuredInitList)
: S.Owned(StructuredInitList);
: StructuredInitList;
break;
}

Expand Down Expand Up @@ -6023,7 +6010,7 @@ InitializationSequence::Perform(Sema &S,
}

case SK_UnwrapInitList:
CurInit = S.Owned(cast<InitListExpr>(CurInit.get())->getInit(0));
CurInit = cast<InitListExpr>(CurInit.get())->getInit(0);
break;

case SK_RewrapInitList: {
Expand All @@ -6034,7 +6021,7 @@ InitializationSequence::Perform(Sema &S,
ILE->setSyntacticForm(Syntactic);
ILE->setType(E->getType());
ILE->setValueKind(E->getValueKind());
CurInit = S.Owned(ILE);
CurInit = ILE;
break;
}

Expand Down Expand Up @@ -6075,12 +6062,11 @@ InitializationSequence::Perform(Sema &S,
TSInfo = S.Context.getTrivialTypeSourceInfo(Step->Type,
Kind.getRange().getBegin());

CurInit = S.Owned(new (S.Context) CXXScalarValueInitExpr(
TSInfo->getType().getNonLValueExprType(S.Context),
TSInfo,
Kind.getRange().getEnd()));
CurInit = new (S.Context) CXXScalarValueInitExpr(
TSInfo->getType().getNonLValueExprType(S.Context), TSInfo,
Kind.getRange().getEnd());
} else {
CurInit = S.Owned(new (S.Context) ImplicitValueInitExpr(Step->Type));
CurInit = new (S.Context) ImplicitValueInitExpr(Step->Type);
}
break;
}
Expand Down Expand Up @@ -6165,16 +6151,15 @@ InitializationSequence::Perform(Sema &S,
case SK_PassByIndirectCopyRestore:
case SK_PassByIndirectRestore:
checkIndirectCopyRestoreSource(S, CurInit.get());
CurInit = S.Owned(new (S.Context)
ObjCIndirectCopyRestoreExpr(CurInit.get(), Step->Type,
Step->Kind == SK_PassByIndirectCopyRestore));
CurInit = new (S.Context) ObjCIndirectCopyRestoreExpr(
CurInit.get(), Step->Type,
Step->Kind == SK_PassByIndirectCopyRestore);
break;

case SK_ProduceObjCObject:
CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, Step->Type,
CK_ARCProduceObject,
CurInit.get(), nullptr,
VK_RValue));
CurInit =
ImplicitCastExpr::Create(S.Context, Step->Type, CK_ARCProduceObject,
CurInit.get(), nullptr, VK_RValue);
break;

case SK_StdInitializerList: {
Expand All @@ -6197,8 +6182,7 @@ InitializationSequence::Perform(Sema &S,
ExtendingEntity->getDecl());

// Wrap it in a construction of a std::initializer_list<T>.
CurInit = S.Owned(
new (S.Context) CXXStdInitializerListExpr(Step->Type, MTE));
CurInit = new (S.Context) CXXStdInitializerListExpr(Step->Type, MTE);

// Bind the result, in case the library has given initializer_list a
// non-trivial destructor.
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaObjCProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
InitializedEntity::InitializeResult(PropertyDiagLoc,
getterMethod->getReturnType(),
/*NRVO=*/false),
PropertyDiagLoc, Owned(IvarRefExpr));
PropertyDiagLoc, IvarRefExpr);
if (!Res.isInvalid()) {
Expr *ResExpr = Res.getAs<Expr>();
if (ResExpr)
Expand Down
9 changes: 4 additions & 5 deletions clang/lib/Sema/SemaOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,8 @@ StmtResult Sema::ActOnOpenMPParallelDirective(ArrayRef<OMPClause *> Clauses,

getCurFunction()->setHasBranchProtectedScope();

return Owned(
OMPParallelDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt));
return OMPParallelDirective::Create(Context, StartLoc, EndLoc, Clauses,
AStmt);
}

StmtResult Sema::ActOnOpenMPSimdDirective(ArrayRef<OMPClause *> Clauses,
Expand All @@ -828,8 +828,7 @@ StmtResult Sema::ActOnOpenMPSimdDirective(ArrayRef<OMPClause *> Clauses,
// FIXME: Checking loop canonical form, collapsing etc.

getCurFunction()->setHasBranchProtectedScope();
return Owned(
OMPSimdDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt));
return OMPSimdDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt);
}

OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
Expand Down Expand Up @@ -963,7 +962,7 @@ ExprResult Sema::VerifyPositiveIntegerConstantInClause(Expr *E,
return ExprError();
if (E->isValueDependent() || E->isTypeDependent() ||
E->isInstantiationDependent() || E->containsUnexpandedParameterPack())
return Owned(E);
return E;
llvm::APSInt Result;
ExprResult ICE = VerifyIntegerConstantExpression(E, &Result);
if (ICE.isInvalid())
Expand Down
86 changes: 37 additions & 49 deletions clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ CreateFunctionRefExpr(Sema &S, FunctionDecl *Fn, NamedDecl *FoundDecl,

S.MarkDeclRefReferenced(DRE);

ExprResult E = S.Owned(DRE);
ExprResult E = DRE;
E = S.DefaultFunctionArrayConversion(E.get());
if (E.isInvalid())
return ExprError();
Expand Down Expand Up @@ -4557,7 +4557,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
InitializedEntity Entity =
InitializedEntity::InitializeParameter(S.Context, ToType,
/*Consumed=*/false);
if (S.CanPerformCopyInitialization(Entity, S.Owned(From))) {
if (S.CanPerformCopyInitialization(Entity, From)) {
Result.setUserDefined();
Result.UserDefined.Before.setAsIdentityConversion();
// Initializer lists don't have a type.
Expand Down Expand Up @@ -4884,7 +4884,7 @@ Sema::PerformObjectArgumentInitialization(Expr *From,
if (!Context.hasSameType(From->getType(), DestType))
From = ImpCastExprToType(From, DestType, CK_NoOp,
From->getValueKind()).get();
return Owned(From);
return From;
}

/// TryContextuallyConvertToBool - Attempt to contextually convert the
Expand Down Expand Up @@ -5166,7 +5166,7 @@ diagnoseAmbiguousConversion(Sema &SemaRef, SourceLocation Loc, Expr *From,
QualType ConvTy = Conv->getConversionType().getNonReferenceType();
Converter.noteAmbiguous(SemaRef, Conv, ConvTy);
}
return SemaRef.Owned(From);
return From;
}

static bool
Expand Down Expand Up @@ -5299,7 +5299,7 @@ ExprResult Sema::PerformContextualImplicitConversion(
SourceLocation Loc, Expr *From, ContextualImplicitConverter &Converter) {
// We can't perform any more checking for type-dependent expressions.
if (From->isTypeDependent())
return Owned(From);
return From;

// Process placeholders immediately.
if (From->hasPlaceholderType()) {
Expand All @@ -5322,7 +5322,7 @@ ExprResult Sema::PerformContextualImplicitConversion(
if (!RecordTy || !getLangOpts().CPlusPlus) {
if (!Converter.Suppress)
Converter.diagnoseNoMatch(*this, Loc, T) << From->getSourceRange();
return Owned(From);
return From;
}

// We must have a complete class type.
Expand All @@ -5339,7 +5339,7 @@ ExprResult Sema::PerformContextualImplicitConversion(
} IncompleteDiagnoser(Converter, From);

if (RequireCompleteType(Loc, T, IncompleteDiagnoser))
return Owned(From);
return From;

// Look for a conversion to an integral or enumeration type.
UnresolvedSet<4>
Expand Down Expand Up @@ -10153,7 +10153,7 @@ bool Sema::ResolveAndFixSingleFunctionTemplateSpecialization(

// Fix the expression to refer to 'fn'.
SingleFunctionExpression =
Owned(FixOverloadedFunctionReference(SrcExpr.get(), found, fn));
FixOverloadedFunctionReference(SrcExpr.get(), found, fn);

// If desired, do function-to-pointer decay.
if (doFunctionPointerConverion) {
Expand Down Expand Up @@ -10546,7 +10546,7 @@ bool Sema::buildOverloadedCallSet(Scope *S, Expr *Fn,
Context.DependentTy, VK_RValue,
RParenLoc);
CE->setTypeDependent(true);
*Result = Owned(CE);
*Result = CE;
return true;
}
return false;
Expand Down Expand Up @@ -10713,22 +10713,18 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,

if (Input->isTypeDependent()) {
if (Fns.empty())
return Owned(new (Context) UnaryOperator(Input,
Opc,
Context.DependentTy,
VK_RValue, OK_Ordinary,
OpLoc));
return new (Context) UnaryOperator(Input, Opc, Context.DependentTy,
VK_RValue, OK_Ordinary, OpLoc);

CXXRecordDecl *NamingClass = nullptr; // lookup ignores member operators
UnresolvedLookupExpr *Fn
= UnresolvedLookupExpr::Create(Context, NamingClass,
NestedNameSpecifierLoc(), OpNameInfo,
/*ADL*/ true, IsOverloaded(Fns),
Fns.begin(), Fns.end());
return Owned(new (Context) CXXOperatorCallExpr(Context, Op, Fn, ArgsArray,
Context.DependentTy,
VK_RValue,
OpLoc, false));
return new (Context)
CXXOperatorCallExpr(Context, Op, Fn, ArgsArray, Context.DependentTy,
VK_RValue, OpLoc, false);
}

// Build an empty overload set.
Expand Down Expand Up @@ -10892,20 +10888,14 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// If there are no functions to store, just build a dependent
// BinaryOperator or CompoundAssignment.
if (Opc <= BO_Assign || Opc > BO_OrAssign)
return Owned(new (Context) BinaryOperator(Args[0], Args[1], Opc,
Context.DependentTy,
VK_RValue, OK_Ordinary,
OpLoc,
FPFeatures.fp_contract));

return Owned(new (Context) CompoundAssignOperator(Args[0], Args[1], Opc,
Context.DependentTy,
VK_LValue,
OK_Ordinary,
Context.DependentTy,
Context.DependentTy,
OpLoc,
FPFeatures.fp_contract));
return new (Context) BinaryOperator(
Args[0], Args[1], Opc, Context.DependentTy, VK_RValue, OK_Ordinary,
OpLoc, FPFeatures.fp_contract);

return new (Context) CompoundAssignOperator(
Args[0], Args[1], Opc, Context.DependentTy, VK_LValue, OK_Ordinary,
Context.DependentTy, Context.DependentTy, OpLoc,
FPFeatures.fp_contract);
}

// FIXME: save results of ADL from here?
Expand All @@ -10917,9 +10907,9 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
NestedNameSpecifierLoc(), OpNameInfo,
/*ADL*/ true, IsOverloaded(Fns),
Fns.begin(), Fns.end());
return Owned(new (Context) CXXOperatorCallExpr(Context, Op, Fn, Args,
Context.DependentTy, VK_RValue,
OpLoc, FPFeatures.fp_contract));
return new (Context)
CXXOperatorCallExpr(Context, Op, Fn, Args, Context.DependentTy,
VK_RValue, OpLoc, FPFeatures.fp_contract);
}

// Always do placeholder-like conversions on the RHS.
Expand Down Expand Up @@ -10985,7 +10975,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
PerformCopyInitialization(
InitializedEntity::InitializeParameter(Context,
FnDecl->getParamDecl(0)),
SourceLocation(), Owned(Args[1]));
SourceLocation(), Args[1]);
if (Arg1.isInvalid())
return ExprError();

Expand All @@ -11001,15 +10991,15 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
ExprResult Arg0 = PerformCopyInitialization(
InitializedEntity::InitializeParameter(Context,
FnDecl->getParamDecl(0)),
SourceLocation(), Owned(Args[0]));
SourceLocation(), Args[0]);
if (Arg0.isInvalid())
return ExprError();

ExprResult Arg1 =
PerformCopyInitialization(
InitializedEntity::InitializeParameter(Context,
FnDecl->getParamDecl(1)),
SourceLocation(), Owned(Args[1]));
SourceLocation(), Args[1]);
if (Arg1.isInvalid())
return ExprError();
Args[0] = LHS = Arg0.getAs<Expr>();
Expand Down Expand Up @@ -11168,11 +11158,9 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
UnresolvedSetIterator());
// Can't add any actual overloads yet

return Owned(new (Context) CXXOperatorCallExpr(Context, OO_Subscript, Fn,
Args,
Context.DependentTy,
VK_RValue,
RLoc, false));
return new (Context)
CXXOperatorCallExpr(Context, OO_Subscript, Fn, Args,
Context.DependentTy, VK_RValue, RLoc, false);
}

// Handle placeholders on both operands.
Expand Down Expand Up @@ -11222,7 +11210,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
Context,
FnDecl->getParamDecl(0)),
SourceLocation(),
Owned(Args[1]));
Args[1]);
if (InputInit.isInvalid())
return ExprError();

Expand Down Expand Up @@ -11574,7 +11562,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
SourceLocation RParenLoc) {
if (checkPlaceholderForOverload(*this, Obj))
return ExprError();
ExprResult Object = Owned(Obj);
ExprResult Object = Obj;

UnbridgedCastsSet UnbridgedCasts;
if (checkArgPlaceholdersForOverload(*this, Args, UnbridgedCasts))
Expand Down Expand Up @@ -11728,9 +11716,9 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
if (Call.isInvalid())
return ExprError();
// Record usage of conversion in an implicit cast.
Call = Owned(ImplicitCastExpr::Create(Context, Call.get()->getType(),
CK_UserDefinedConversion,
Call.get(), nullptr, VK_RValue));
Call = ImplicitCastExpr::Create(Context, Call.get()->getType(),
CK_UserDefinedConversion, Call.get(),
nullptr, VK_RValue);

return ActOnCallExpr(S, Call.get(), LParenLoc, Args, RParenLoc);
}
Expand Down Expand Up @@ -12282,7 +12270,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
ExprResult Sema::FixOverloadedFunctionReference(ExprResult E,
DeclAccessPair Found,
FunctionDecl *Fn) {
return Owned(FixOverloadedFunctionReference((Expr *)E.get(), Found, Fn));
return FixOverloadedFunctionReference(E.get(), Found, Fn);
}

} // end namespace clang
109 changes: 50 additions & 59 deletions clang/lib/Sema/SemaStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ StmtResult Sema::ActOnExprStmt(ExprResult FE) {
// operand, even incomplete types.

// Same thing in for stmt first clause (when expr) and third clause.
return Owned(static_cast<Stmt*>(FE.get()));
return StmtResult(FE.getAs<Stmt>());
}


Expand All @@ -60,7 +60,7 @@ StmtResult Sema::ActOnExprStmtError() {

StmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc,
bool HasLeadingEmptyMacro) {
return Owned(new (Context) NullStmt(SemiLoc, HasLeadingEmptyMacro));
return new (Context) NullStmt(SemiLoc, HasLeadingEmptyMacro);
}

StmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg, SourceLocation StartLoc,
Expand All @@ -70,7 +70,7 @@ StmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg, SourceLocation StartLoc,
// If we have an invalid decl, just return an error.
if (DG.isNull()) return StmtError();

return Owned(new (Context) DeclStmt(DG, StartLoc, EndLoc));
return new (Context) DeclStmt(DG, StartLoc, EndLoc);
}

void Sema::ActOnForEachDeclStmt(DeclGroupPtrTy dg) {
Expand Down Expand Up @@ -344,7 +344,7 @@ StmtResult Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R,
DiagnoseEmptyLoopBody(Elts[i], Elts[i + 1]);
}

return Owned(new (Context) CompoundStmt(Context, Elts, L, R));
return new (Context) CompoundStmt(Context, Elts, L, R);
}

StmtResult
Expand Down Expand Up @@ -384,7 +384,7 @@ Sema::ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal,
CaseStmt *CS = new (Context) CaseStmt(LHSVal, RHSVal, CaseLoc, DotDotDotLoc,
ColonLoc);
getCurFunction()->SwitchStack.back()->addSwitchCase(CS);
return Owned(CS);
return CS;
}

/// ActOnCaseStmtBody - This installs a statement as the body of a case.
Expand All @@ -402,12 +402,12 @@ Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc,

if (getCurFunction()->SwitchStack.empty()) {
Diag(DefaultLoc, diag::err_default_not_in_switch);
return Owned(SubStmt);
return SubStmt;
}

DefaultStmt *DS = new (Context) DefaultStmt(DefaultLoc, ColonLoc, SubStmt);
getCurFunction()->SwitchStack.back()->addSwitchCase(DS);
return Owned(DS);
return DS;
}

StmtResult
Expand All @@ -417,7 +417,7 @@ Sema::ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl,
if (TheDecl->getStmt()) {
Diag(IdentLoc, diag::err_redefinition_of_label) << TheDecl->getDeclName();
Diag(TheDecl->getLocation(), diag::note_previous_definition);
return Owned(SubStmt);
return SubStmt;
}

// Otherwise, things are good. Fill in the declaration and return it.
Expand All @@ -427,15 +427,15 @@ Sema::ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl,
TheDecl->setLocStart(IdentLoc);
TheDecl->setLocation(IdentLoc);
}
return Owned(LS);
return LS;
}

StmtResult Sema::ActOnAttributedStmt(SourceLocation AttrLoc,
ArrayRef<const Attr*> Attrs,
Stmt *SubStmt) {
// Fill in the declaration and return it.
AttributedStmt *LS = AttributedStmt::Create(Context, AttrLoc, Attrs, SubStmt);
return Owned(LS);
return LS;
}

StmtResult
Expand Down Expand Up @@ -471,8 +471,8 @@ Sema::ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar,

DiagnoseUnusedExprResult(elseStmt);

return Owned(new (Context) IfStmt(Context, IfLoc, ConditionVar, ConditionExpr,
thenStmt, ElseLoc, elseStmt));
return new (Context) IfStmt(Context, IfLoc, ConditionVar, ConditionExpr,
thenStmt, ElseLoc, elseStmt);
}

/// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
Expand Down Expand Up @@ -661,7 +661,7 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond,

SwitchStmt *SS = new (Context) SwitchStmt(Context, ConditionVar, Cond);
getCurFunction()->SwitchStack.push_back(SS);
return Owned(SS);
return SS;
}

static void AdjustAPSInt(llvm::APSInt &Val, unsigned BitWidth, bool IsSigned) {
Expand Down Expand Up @@ -1151,7 +1151,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
if (CaseListIsErroneous)
return StmtError();

return Owned(SS);
return SS;
}

void
Expand Down Expand Up @@ -1225,8 +1225,8 @@ Sema::ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond,
if (isa<NullStmt>(Body))
getCurCompoundScope().setHasEmptyLoopBodies();

return Owned(new (Context) WhileStmt(Context, ConditionVar, ConditionExpr,
Body, WhileLoc));
return new (Context)
WhileStmt(Context, ConditionVar, ConditionExpr, Body, WhileLoc);
}

StmtResult
Expand All @@ -1248,7 +1248,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,

DiagnoseUnusedExprResult(Body);

return Owned(new (Context) DoStmt(Body, Cond, DoLoc, WhileLoc, CondRParen));
return new (Context) DoStmt(Body, Cond, DoLoc, WhileLoc, CondRParen);
}

namespace {
Expand Down Expand Up @@ -1632,10 +1632,8 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
if (isa<NullStmt>(Body))
getCurCompoundScope().setHasEmptyLoopBodies();

return Owned(new (Context) ForStmt(Context, First,
SecondResult.get(), ConditionVar,
Third, Body, ForLoc, LParenLoc,
RParenLoc));
return new (Context) ForStmt(Context, First, SecondResult.get(), ConditionVar,
Third, Body, ForLoc, LParenLoc, RParenLoc);
}

/// In an Objective C collection iteration statement:
Expand All @@ -1661,7 +1659,7 @@ Sema::CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) {
return ExprError();

// Bail out early if we've got a type-dependent expression.
if (collection->isTypeDependent()) return Owned(collection);
if (collection->isTypeDependent()) return collection;

// Perform normal l-value conversion.
ExprResult result = DefaultFunctionArrayLvalueConversion(collection);
Expand Down Expand Up @@ -1723,7 +1721,7 @@ Sema::CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) {
}

// Wrap up any cleanups in the expression.
return Owned(collection);
return collection;
}

StmtResult
Expand Down Expand Up @@ -1802,9 +1800,8 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
if (CollectionExprResult.isInvalid())
return StmtError();

return Owned(new (Context) ObjCForCollectionStmt(First,
CollectionExprResult.get(),
nullptr, ForLoc, RParenLoc));
return new (Context) ObjCForCollectionStmt(First, CollectionExprResult.get(),
nullptr, ForLoc, RParenLoc);
}

/// Finish building a variable declaration for a for-range statement.
Expand Down Expand Up @@ -2173,9 +2170,8 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation ColonLoc,
// Find the array bound.
ExprResult BoundExpr;
if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(UnqAT))
BoundExpr = Owned(IntegerLiteral::Create(Context, CAT->getSize(),
Context.getPointerDiffType(),
RangeLoc));
BoundExpr = IntegerLiteral::Create(
Context, CAT->getSize(), Context.getPointerDiffType(), RangeLoc);
else if (const VariableArrayType *VAT =
dyn_cast<VariableArrayType>(UnqAT))
BoundExpr = VAT->getSizeExpr();
Expand Down Expand Up @@ -2332,11 +2328,9 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation ColonLoc,
if (Kind == BFRK_Check)
return StmtResult();

return Owned(new (Context) CXXForRangeStmt(RangeDS,
cast_or_null<DeclStmt>(BeginEndDecl.get()),
NotEqExpr.get(), IncrExpr.get(),
LoopVarDS, /*Body=*/nullptr,
ForLoc, ColonLoc, RParenLoc));
return new (Context) CXXForRangeStmt(
RangeDS, cast_or_null<DeclStmt>(BeginEndDecl.get()), NotEqExpr.get(),
IncrExpr.get(), LoopVarDS, /*Body=*/nullptr, ForLoc, ColonLoc, RParenLoc);
}

/// FinishObjCForCollectionStmt - Attach the body to a objective-C foreach
Expand Down Expand Up @@ -2375,7 +2369,7 @@ StmtResult Sema::ActOnGotoStmt(SourceLocation GotoLoc,
LabelDecl *TheDecl) {
getCurFunction()->setHasBranchIntoScope();
TheDecl->markUsed(Context);
return Owned(new (Context) GotoStmt(TheDecl, GotoLoc, LabelLoc));
return new (Context) GotoStmt(TheDecl, GotoLoc, LabelLoc);
}

StmtResult
Expand All @@ -2385,7 +2379,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,
if (!E->isTypeDependent()) {
QualType ETy = E->getType();
QualType DestTy = Context.getPointerType(Context.VoidTy.withConst());
ExprResult ExprRes = Owned(E);
ExprResult ExprRes = E;
AssignConvertType ConvTy =
CheckSingleAssignmentConstraints(DestTy, ExprRes);
if (ExprRes.isInvalid())
Expand All @@ -2402,7 +2396,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,

getCurFunction()->setHasIndirectGoto();

return Owned(new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E));
return new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E);
}

StmtResult
Expand All @@ -2413,7 +2407,7 @@ Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) {
return StmtError(Diag(ContinueLoc, diag::err_continue_not_in_loop));
}

return Owned(new (Context) ContinueStmt(ContinueLoc));
return new (Context) ContinueStmt(ContinueLoc);
}

StmtResult
Expand All @@ -2424,7 +2418,7 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) {
return StmtError(Diag(BreakLoc, diag::err_break_not_in_loop_or_switch));
}

return Owned(new (Context) BreakStmt(BreakLoc));
return new (Context) BreakStmt(BreakLoc);
}

/// \brief Determine whether the given expression is a candidate for
Expand Down Expand Up @@ -2725,7 +2719,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
if (CurCap->HasImplicitReturnType || NRVOCandidate)
FunctionScopes.back()->Returns.push_back(Result);

return Owned(Result);
return Result;
}

/// Deduce the return type for a function from a returned expression, per
Expand Down Expand Up @@ -2921,7 +2915,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
D = diag::ext_return_has_void_expr;
}
else {
ExprResult Result = Owned(RetValExp);
ExprResult Result = RetValExp;
Result = IgnoredValueConversions(Result.get());
if (Result.isInvalid())
return StmtError();
Expand Down Expand Up @@ -3034,7 +3028,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
if (Result->getNRVOCandidate())
FunctionScopes.back()->Returns.push_back(Result);

return Owned(Result);
return Result;
}

StmtResult
Expand All @@ -3045,12 +3039,12 @@ Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
if (Var && Var->isInvalidDecl())
return StmtError();

return Owned(new (Context) ObjCAtCatchStmt(AtLoc, RParen, Var, Body));
return new (Context) ObjCAtCatchStmt(AtLoc, RParen, Var, Body);
}

StmtResult
Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body) {
return Owned(new (Context) ObjCAtFinallyStmt(AtLoc, Body));
return new (Context) ObjCAtFinallyStmt(AtLoc, Body);
}

StmtResult
Expand All @@ -3061,10 +3055,8 @@ Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try,

getCurFunction()->setHasBranchProtectedScope();
unsigned NumCatchStmts = CatchStmts.size();
return Owned(ObjCAtTryStmt::Create(Context, AtLoc, Try,
CatchStmts.data(),
NumCatchStmts,
Finally));
return ObjCAtTryStmt::Create(Context, AtLoc, Try, CatchStmts.data(),
NumCatchStmts, Finally);
}

StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw) {
Expand All @@ -3089,7 +3081,7 @@ StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw) {
}
}

return Owned(new (Context) ObjCAtThrowStmt(AtLoc, Throw));
return new (Context) ObjCAtThrowStmt(AtLoc, Throw);
}

StmtResult
Expand Down Expand Up @@ -3136,7 +3128,7 @@ Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SyncExpr,
Stmt *SyncBody) {
// We can't jump into or indirect-jump out of a @synchronized block.
getCurFunction()->setHasBranchProtectedScope();
return Owned(new (Context) ObjCAtSynchronizedStmt(AtLoc, SyncExpr, SyncBody));
return new (Context) ObjCAtSynchronizedStmt(AtLoc, SyncExpr, SyncBody);
}

/// ActOnCXXCatchBlock - Takes an exception declaration and a handler block
Expand All @@ -3145,15 +3137,14 @@ StmtResult
Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl,
Stmt *HandlerBlock) {
// There's nothing to test that ActOnExceptionDecl didn't already test.
return Owned(new (Context) CXXCatchStmt(CatchLoc,
cast_or_null<VarDecl>(ExDecl),
HandlerBlock));
return new (Context)
CXXCatchStmt(CatchLoc, cast_or_null<VarDecl>(ExDecl), HandlerBlock);
}

StmtResult
Sema::ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body) {
getCurFunction()->setHasBranchProtectedScope();
return Owned(new (Context) ObjCAutoreleasePoolStmt(AtLoc, Body));
return new (Context) ObjCAutoreleasePoolStmt(AtLoc, Body);
}

namespace {
Expand Down Expand Up @@ -3247,7 +3238,7 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
// Neither of these are explicitly forbidden, but every compiler detects them
// and warns.

return Owned(CXXTryStmt::Create(Context, TryLoc, TryBlock, Handlers));
return CXXTryStmt::Create(Context, TryLoc, TryBlock, Handlers);
}

StmtResult
Expand All @@ -3259,7 +3250,7 @@ Sema::ActOnSEHTryBlock(bool IsCXXTry,

getCurFunction()->setHasBranchProtectedScope();

return Owned(SEHTryStmt::Create(Context,IsCXXTry,TryLoc,TryBlock,Handler));
return SEHTryStmt::Create(Context,IsCXXTry,TryLoc,TryBlock,Handler);
}

StmtResult
Expand All @@ -3274,14 +3265,14 @@ Sema::ActOnSEHExceptBlock(SourceLocation Loc,
<< FilterExpr->getType());
}

return Owned(SEHExceptStmt::Create(Context,Loc,FilterExpr,Block));
return SEHExceptStmt::Create(Context,Loc,FilterExpr,Block);
}

StmtResult
Sema::ActOnSEHFinallyBlock(SourceLocation Loc,
Stmt *Block) {
assert(Block);
return Owned(SEHFinallyStmt::Create(Context,Loc,Block));
return SEHFinallyStmt::Create(Context,Loc,Block);
}

StmtResult Sema::BuildMSDependentExistsStmt(SourceLocation KeywordLoc,
Expand Down Expand Up @@ -3474,5 +3465,5 @@ StmtResult Sema::ActOnCapturedRegionEnd(Stmt *S) {
PopDeclContext();
PopFunctionScopeInfo();

return Owned(Res);
return Res;
}
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaStmtAsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
return StmtError();
}

return Owned(NS);
return NS;
}

ExprResult Sema::LookupInlineAsmIdentifier(CXXScopeSpec &SS,
Expand Down Expand Up @@ -484,5 +484,5 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc,
/*IsVolatile*/ true, AsmToks, NumOutputs, NumInputs,
Constraints, Exprs, AsmString,
Clobbers, EndLoc);
return Owned(NS);
return NS;
}
55 changes: 23 additions & 32 deletions clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,10 @@ Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS,
// perform the double-lookup check.
NamedDecl *FirstQualifierInScope = nullptr;

return Owned(CXXDependentScopeMemberExpr::Create(Context,
/*This*/ nullptr, ThisType,
/*IsArrow*/ true,
/*Op*/ SourceLocation(),
SS.getWithLocInContext(Context),
TemplateKWLoc,
FirstQualifierInScope,
NameInfo,
TemplateArgs));
return CXXDependentScopeMemberExpr::Create(
Context, /*This*/ nullptr, ThisType, /*IsArrow*/ true,
/*Op*/ SourceLocation(), SS.getWithLocInContext(Context), TemplateKWLoc,
FirstQualifierInScope, NameInfo, TemplateArgs);
}

return BuildDependentDeclRefExpr(SS, TemplateKWLoc, NameInfo, TemplateArgs);
Expand All @@ -440,11 +435,9 @@ Sema::BuildDependentDeclRefExpr(const CXXScopeSpec &SS,
SourceLocation TemplateKWLoc,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs) {
return Owned(DependentScopeDeclRefExpr::Create(Context,
SS.getWithLocInContext(Context),
TemplateKWLoc,
NameInfo,
TemplateArgs));
return DependentScopeDeclRefExpr::Create(
Context, SS.getWithLocInContext(Context), TemplateKWLoc, NameInfo,
TemplateArgs);
}

/// DiagnoseTemplateParameterShadow - Produce a diagnostic complaining
Expand Down Expand Up @@ -2869,7 +2862,7 @@ ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
RequiresADL, TemplateArgs,
R.begin(), R.end());

return Owned(ULE);
return ULE;
}

// We actually only call this from template instantiation.
Expand Down Expand Up @@ -3452,11 +3445,9 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param,
// so it was provided with a template keyword. However, its source
// location is not stored in the template argument structure.
SourceLocation TemplateKWLoc;
ExprResult E = Owned(DependentScopeDeclRefExpr::Create(Context,
SS.getWithLocInContext(Context),
TemplateKWLoc,
NameInfo,
nullptr));
ExprResult E = DependentScopeDeclRefExpr::Create(
Context, SS.getWithLocInContext(Context), TemplateKWLoc, NameInfo,
nullptr);

// If we parsed the template argument as a pack expansion, create a
// pack expansion expression.
Expand Down Expand Up @@ -4732,7 +4723,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
if (InstantiatedParamType->isDependentType() || Arg->isTypeDependent()) {
// FIXME: Produce a cloned, canonical expression?
Converted = TemplateArgument(Arg);
return Owned(Arg);
return Arg;
}

// C++ [temp.arg.nontype]p5:
Expand Down Expand Up @@ -4776,7 +4767,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
// we should be able to diagnose that prior to instantiation.
if (Arg->isValueDependent()) {
Converted = TemplateArgument(Arg);
return Owned(Arg);
return Arg;
}

// C++ [temp.arg.nontype]p1:
Expand Down Expand Up @@ -4878,7 +4869,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
// The argument is value-dependent. Create a new
// TemplateArgument with the converted expression.
Converted = TemplateArgument(Arg);
return Owned(Arg);
return Arg;
}

QualType IntegerType = Context.getCanonicalType(ParamType);
Expand Down Expand Up @@ -4932,7 +4923,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
ParamType->isEnumeralType()
? Context.getCanonicalType(ParamType)
: IntegerType);
return Owned(Arg);
return Arg;
}

QualType ArgType = Arg->getType();
Expand Down Expand Up @@ -4980,13 +4971,13 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
ParamType,
Arg, Converted))
return ExprError();
return Owned(Arg);
return Arg;
}

if (CheckTemplateArgumentPointerToMember(*this, Param, ParamType, Arg,
Converted))
return ExprError();
return Owned(Arg);
return Arg;
}

if (ParamType->isPointerType()) {
Expand All @@ -5001,7 +4992,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
ParamType,
Arg, Converted))
return ExprError();
return Owned(Arg);
return Arg;
}

if (const ReferenceType *ParamRefType = ParamType->getAs<ReferenceType>()) {
Expand Down Expand Up @@ -5032,14 +5023,14 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
ParamType,
Arg, Converted))
return ExprError();
return Owned(Arg);
return Arg;
}

// Deal with parameters of type std::nullptr_t.
if (ParamType->isNullPtrType()) {
if (Arg->isTypeDependent() || Arg->isValueDependent()) {
Converted = TemplateArgument(Arg);
return Owned(Arg);
return Arg;
}

switch (isNullPointerValueTemplateArgument(*this, Param, ParamType, Arg)) {
Expand All @@ -5055,7 +5046,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
case NPV_NullPointer:
Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
Converted = TemplateArgument(ParamType, /*isNullPtr*/true);
return Owned(Arg);
return Arg;
}
}

Expand All @@ -5066,7 +5057,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
if (CheckTemplateArgumentPointerToMember(*this, Param, ParamType, Arg,
Converted))
return ExprError();
return Owned(Arg);
return Arg;
}

/// \brief Check a template argument against its corresponding
Expand Down Expand Up @@ -5295,7 +5286,7 @@ Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg,
Loc, Loc);
}

return Owned(E);
return E;
}

/// \brief Match two template parameters within template parameter lists.
Expand Down
18 changes: 8 additions & 10 deletions clang/lib/Sema/SemaTemplateInstantiate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ TemplateName TemplateInstantiator::TransformTemplateName(CXXScopeSpec &SS,
ExprResult
TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) {
if (!E->isTypeDependent())
return SemaRef.Owned(E);
return E;

return getSema().BuildPredefinedExpr(E->getLocation(), E->getIdentType());
}
Expand All @@ -1098,7 +1098,7 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E,
// arguments left unspecified.
if (!TemplateArgs.hasTemplateArgument(NTTP->getDepth(),
NTTP->getPosition()))
return SemaRef.Owned(E);
return E;

TemplateArgument Arg = TemplateArgs(NTTP->getDepth(), NTTP->getPosition());
if (NTTP->isParameterPack()) {
Expand Down Expand Up @@ -1138,7 +1138,7 @@ ExprResult TemplateInstantiator::transformNonTypeTemplateParmRef(
// case we just return that expression.
if (arg.getKind() == TemplateArgument::Expression) {
Expr *argExpr = arg.getAsExpr();
result = SemaRef.Owned(argExpr);
result = argExpr;
type = argExpr->getType();

} else if (arg.getKind() == TemplateArgument::Declaration ||
Expand Down Expand Up @@ -1186,18 +1186,16 @@ ExprResult TemplateInstantiator::transformNonTypeTemplateParmRef(
if (result.isInvalid()) return ExprError();

Expr *resultExpr = result.get();
return SemaRef.Owned(new (SemaRef.Context)
SubstNonTypeTemplateParmExpr(type,
resultExpr->getValueKind(),
loc, parm, resultExpr));
return new (SemaRef.Context) SubstNonTypeTemplateParmExpr(
type, resultExpr->getValueKind(), loc, parm, resultExpr);
}

ExprResult
TemplateInstantiator::TransformSubstNonTypeTemplateParmPackExpr(
SubstNonTypeTemplateParmPackExpr *E) {
if (getSema().ArgumentPackSubstitutionIndex == -1) {
// We aren't expanding the parameter pack, so just return ourselves.
return getSema().Owned(E);
return E;
}

TemplateArgument Arg = E->getArgumentPack();
Expand Down Expand Up @@ -2571,7 +2569,7 @@ Sema::InstantiateClassTemplateSpecializationMembers(
StmtResult
Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!S)
return Owned(S);
return S;

TemplateInstantiator Instantiator(*this, TemplateArgs,
SourceLocation(),
Expand All @@ -2582,7 +2580,7 @@ Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) {
ExprResult
Sema::SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!E)
return Owned(E);
return E;

TemplateInstantiator Instantiator(*this, TemplateArgs,
SourceLocation(),
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ void TemplateDeclInstantiator::InstantiateEnumDefinition(
EnumConstantDecl *LastEnumConst = nullptr;
for (auto *EC : Pattern->enumerators()) {
// The specified value for the enumerator.
ExprResult Value = SemaRef.Owned((Expr *)nullptr);
ExprResult Value((Expr *)nullptr);
if (Expr *UninstValue = EC->getInitExpr()) {
// The enumerator's value expression is a constant expression.
EnterExpressionEvaluationContext Unevaluated(SemaRef,
Expand All @@ -753,7 +753,7 @@ void TemplateDeclInstantiator::InstantiateEnumDefinition(
// Drop the initial value and continue.
bool isInvalid = false;
if (Value.isInvalid()) {
Value = SemaRef.Owned((Expr *)nullptr);
Value = nullptr;
isInvalid = true;
}

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaTemplateVariadic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,8 @@ ExprResult Sema::CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
}

// Create the pack expansion expression and source-location information.
return Owned(new (Context) PackExpansionExpr(Context.DependentTy, Pattern,
EllipsisLoc, NumExpansions));
return new (Context)
PackExpansionExpr(Context.DependentTy, Pattern, EllipsisLoc, NumExpansions);
}

/// \brief Retrieve the depth and index of a parameter pack.
Expand Down
229 changes: 111 additions & 118 deletions clang/lib/Sema/TreeTransform.h

Large diffs are not rendered by default.