r209812 - Refactoring. Remove Owned method from Sema.
Nikola Smiljanic
popizdeh at gmail.com
Thu May 29 07:05:12 PDT 2014
Author: nikola
Date: Thu May 29 09:05:12 2014
New Revision: 209812
URL: http://llvm.org/viewvc/llvm-project?rev=209812&view=rev
Log:
Refactoring. Remove Owned method from Sema.
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaExprMember.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Sema/SemaStmtAsm.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu May 29 09:05:12 2014
@@ -1036,10 +1036,6 @@ public:
/// \brief Retrieve the module loader associated with the preprocessor.
ModuleLoader &getModuleLoader() const;
- ExprResult Owned(Expr* E) { return E; }
- ExprResult Owned(ExprResult R) { return R; }
- StmtResult Owned(Stmt* S) { return S; }
-
void ActOnEndOfTranslationUnit();
void CheckDelegatingCtorCycles();
@@ -7699,8 +7695,8 @@ public:
Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp,
NonStandardCompositeType);
- E1 = Owned(E1Tmp);
- E2 = Owned(E2Tmp);
+ E1 = E1Tmp;
+ E2 = E2Tmp;
return Composite;
}
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Thu May 29 09:05:12 2014
@@ -328,7 +328,7 @@ ExprResult Sema::ImpCastExprToType(Expr
QualType TypeTy = Context.getCanonicalType(Ty);
if (ExprTy == TypeTy)
- return Owned(E);
+ return E;
// If this is a derived-to-base cast to a through a virtual base, we
// need a vtable.
@@ -346,11 +346,11 @@ ExprResult Sema::ImpCastExprToType(Expr
if (ImpCast->getCastKind() == Kind && (!BasePath || BasePath->empty())) {
ImpCast->setType(Ty);
ImpCast->setValueKind(VK);
- return Owned(E);
+ return E;
}
}
- return Owned(ImplicitCastExpr::Create(Context, Ty, Kind, E, BasePath, VK));
+ return ImplicitCastExpr::Create(Context, Ty, Kind, E, BasePath, VK);
}
/// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Thu May 29 09:05:12 2014
@@ -93,7 +93,7 @@ namespace {
CK_Dependent, castExpr, nullptr,
castExpr->getValueKind());
}
- return Self.Owned(castExpr);
+ return castExpr;
}
// Internal convenience methods.
@@ -239,7 +239,7 @@ ExprResult
Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
TypeSourceInfo *DestTInfo, Expr *E,
SourceRange AngleBrackets, SourceRange Parens) {
- ExprResult Ex = Owned(E);
+ ExprResult Ex = E;
QualType DestType = DestTInfo->getType();
// If the type is dependent, we won't do the semantic analysis now.
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu May 29 09:05:12 2014
@@ -101,7 +101,7 @@ static bool SemaBuiltinAddressof(Sema &S
if (checkArgCount(S, TheCall, 1))
return true;
- ExprResult Arg(S.Owned(TheCall->getArg(0)));
+ ExprResult Arg(TheCall->getArg(0));
QualType ResultType = S.CheckAddressOfOperand(Arg, TheCall->getLocStart());
if (ResultType.isNull())
return true;
@@ -113,7 +113,7 @@ static bool SemaBuiltinAddressof(Sema &S
ExprResult
Sema::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
- ExprResult TheCallResult(Owned(TheCall));
+ ExprResult TheCallResult(TheCall);
// Find out if any arguments are required to be integer constant expressions.
unsigned ICEArguments = 0;
@@ -1219,7 +1219,7 @@ ExprResult Sema::SemaAtomicOpsOverloaded
Diag(AE->getLocStart(), diag::err_atomic_load_store_uses_lib) <<
((Op == AtomicExpr::AO__c11_atomic_load) ? 0 : 1);
- return Owned(AE);
+ return AE;
}
@@ -1861,9 +1861,9 @@ ExprResult Sema::SemaBuiltinShuffleVecto
TheCall->setArg(i, nullptr);
}
- return Owned(new (Context) ShuffleVectorExpr(Context, exprs, resType,
- TheCall->getCallee()->getLocStart(),
- TheCall->getRParenLoc()));
+ return new (Context) ShuffleVectorExpr(Context, exprs, resType,
+ TheCall->getCallee()->getLocStart(),
+ TheCall->getRParenLoc());
}
/// SemaConvertVectorExpr - Handle __builtin_convertvector
@@ -1892,9 +1892,8 @@ ExprResult Sema::SemaConvertVectorExpr(E
<< E->getSourceRange());
}
- return Owned(new (Context) ConvertVectorExpr(E, TInfo, DstTy, VK, OK,
- BuiltinLoc, RParenLoc));
-
+ return new (Context)
+ ConvertVectorExpr(E, TInfo, DstTy, VK, OK, BuiltinLoc, RParenLoc);
}
/// SemaBuiltinPrefetch - Handle __builtin_prefetch.
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu May 29 09:05:12 2014
@@ -11453,7 +11453,7 @@ ExprResult Sema::VerifyBitField(SourceLo
// If the bit-width is type- or value-dependent, don't try to check
// it now.
if (BitWidth->isValueDependent() || BitWidth->isTypeDependent())
- return Owned(BitWidth);
+ return BitWidth;
llvm::APSInt Value;
ExprResult ICE = VerifyIntegerConstantExpression(BitWidth, &Value);
@@ -11500,7 +11500,7 @@ ExprResult Sema::VerifyBitField(SourceLo
}
}
- return Owned(BitWidth);
+ return BitWidth;
}
/// ActOnField - Each field of a C struct/union is passed into this in order
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu May 29 09:05:12 2014
@@ -2833,7 +2833,7 @@ Sema::BuildDelegatingInitializer(TypeSou
// initializer. However, deconstructing the ASTs is a dicey process,
// and this approach is far more likely to get the corner cases right.
if (CurContext->isDependentContext())
- DelegationInit = Owned(Init);
+ DelegationInit = Init;
return new (Context) CXXCtorInitializer(Context, TInfo, InitRange.getBegin(),
DelegationInit.getAs<Expr>(),
@@ -2962,7 +2962,7 @@ Sema::BuildBaseInitializer(QualType Base
// initializer. However, deconstructing the ASTs is a dicey process,
// and this approach is far more likely to get the corner cases right.
if (CurContext->isDependentContext())
- BaseInit = Owned(Init);
+ BaseInit = Init;
return new (Context) CXXCtorInitializer(Context, BaseTInfo,
BaseSpec->isVirtual(),
@@ -9030,7 +9030,7 @@ buildMemcpyForAssignmentOp(Sema &S, Sour
Loc, CallArgs, Loc);
assert(!Call.isInvalid() && "Call to __builtin_memcpy cannot fail!");
- return S.Owned(Call.getAs<Stmt>());
+ return Call.getAs<Stmt>();
}
/// \brief Builds a statement that copies/moves the given entity from \p From to
@@ -10585,12 +10585,11 @@ Sema::BuildCXXConstructExpr(SourceLocati
unsigned ConstructKind,
SourceRange ParenRange) {
MarkFunctionReferenced(ConstructLoc, Constructor);
- return Owned(CXXConstructExpr::Create(Context, DeclInitType, ConstructLoc,
- Constructor, Elidable, ExprArgs,
- HadMultipleCandidates,
- IsListInitialization, RequiresZeroInit,
- static_cast<CXXConstructExpr::ConstructionKind>(ConstructKind),
- ParenRange));
+ return CXXConstructExpr::Create(
+ Context, DeclInitType, ConstructLoc, Constructor, Elidable, ExprArgs,
+ HadMultipleCandidates, IsListInitialization, RequiresZeroInit,
+ static_cast<CXXConstructExpr::ConstructionKind>(ConstructKind),
+ ParenRange);
}
void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) {
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu May 29 09:05:12 2014
@@ -456,7 +456,7 @@ ExprResult Sema::DefaultFunctionArrayCon
E = ImpCastExprToType(E, Context.getArrayDecayedType(Ty),
CK_ArrayToPointerDecay).get();
}
- return Owned(E);
+ return E;
}
static void CheckForNullPointerDereference(Sema &S, Expr *E) {
@@ -545,7 +545,7 @@ ExprResult Sema::DefaultLvalueConversion
// C++ [conv.lval]p1:
// A glvalue of a non-function, non-array type T can be
// converted to a prvalue.
- if (!E->isGLValue()) return Owned(E);
+ if (!E->isGLValue()) return E;
QualType T = E->getType();
assert(!T.isNull() && "r-value conversion on typeless expression?");
@@ -556,7 +556,7 @@ ExprResult Sema::DefaultLvalueConversion
(E->getType() == Context.OverloadTy ||
T->isDependentType() ||
T->isRecordType()))
- return Owned(E);
+ return E;
// The C standard is actually really unclear on this point, and
// DR106 tells us what the result should be but not why. It's
@@ -564,7 +564,7 @@ ExprResult Sema::DefaultLvalueConversion
// lvalue-to-rvalue at all. Note that expressions of unqualified
// 'void' type are never l-values, but qualified void can be.
if (T->isVoidType())
- return Owned(E);
+ return E;
// OpenCL usually rejects direct accesses to values of 'half' type.
if (getLangOpts().OpenCL && !getOpenCLOptions().cl_khr_fp16 &&
@@ -611,16 +611,16 @@ ExprResult Sema::DefaultLvalueConversion
E->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
ExprNeedsCleanups = true;
- ExprResult Res = Owned(ImplicitCastExpr::Create(Context, T, CK_LValueToRValue,
- E, nullptr, VK_RValue));
+ ExprResult Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E,
+ nullptr, VK_RValue);
// C11 6.3.2.1p2:
// ... if the lvalue has atomic type, the value has the non-atomic version
// of the type of the lvalue ...
if (const AtomicType *Atomic = T->getAs<AtomicType>()) {
T = Atomic->getValueType().getUnqualifiedType();
- Res = Owned(ImplicitCastExpr::Create(Context, T, CK_AtomicToNonAtomic,
- Res.get(), nullptr, VK_RValue));
+ Res = ImplicitCastExpr::Create(Context, T, CK_AtomicToNonAtomic, Res.get(),
+ nullptr, VK_RValue);
}
return Res;
@@ -652,7 +652,7 @@ ExprResult Sema::CallExprUnaryConversion
Res = DefaultLvalueConversion(Res.get());
if (Res.isInvalid())
return ExprError();
- return Owned(Res.get());
+ return Res.get();
}
/// UsualUnaryConversions - Performs various conversions that are common to most
@@ -694,15 +694,15 @@ ExprResult Sema::UsualUnaryConversions(E
QualType PTy = Context.isPromotableBitField(E);
if (!PTy.isNull()) {
E = ImpCastExprToType(E, PTy, CK_IntegralCast).get();
- return Owned(E);
+ return E;
}
if (Ty->isPromotableIntegerType()) {
QualType PT = Context.getPromotedIntegerType(Ty);
E = ImpCastExprToType(E, PT, CK_IntegralCast).get();
- return Owned(E);
+ return E;
}
}
- return Owned(E);
+ return E;
}
/// DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
@@ -739,14 +739,13 @@ ExprResult Sema::DefaultArgumentPromotio
if (getLangOpts().CPlusPlus && E->isGLValue() && !isUnevaluatedContext()) {
ExprResult Temp = PerformCopyInitialization(
InitializedEntity::InitializeTemporary(E->getType()),
- E->getExprLoc(),
- Owned(E));
+ E->getExprLoc(), E);
if (Temp.isInvalid())
return ExprError();
E = Temp.get();
}
- return Owned(E);
+ return E;
}
/// Determine the degree of POD-ness for an expression.
@@ -896,7 +895,7 @@ ExprResult Sema::DefaultVariadicArgument
diag::err_call_incomplete_argument))
return ExprError();
- return Owned(E);
+ return E;
}
/// \brief Converts an integer to complex float type. Helper function of
@@ -1386,10 +1385,9 @@ Sema::CreateGenericSelectionExpr(SourceL
// If we determined that the generic selection is result-dependent, don't
// try to compute the result expression.
if (IsResultDependent)
- return Owned(new (Context) GenericSelectionExpr(
- Context, KeyLoc, ControllingExpr,
- Types, Exprs,
- DefaultLoc, RParenLoc, ContainsUnexpandedParameterPack));
+ return new (Context) GenericSelectionExpr(
+ Context, KeyLoc, ControllingExpr, Types, Exprs, DefaultLoc, RParenLoc,
+ ContainsUnexpandedParameterPack);
SmallVector<unsigned, 1> CompatIndices;
unsigned DefaultIndex = -1U;
@@ -1441,11 +1439,9 @@ Sema::CreateGenericSelectionExpr(SourceL
unsigned ResultIndex =
CompatIndices.size() ? CompatIndices[0] : DefaultIndex;
- return Owned(new (Context) GenericSelectionExpr(
- Context, KeyLoc, ControllingExpr,
- Types, Exprs,
- DefaultLoc, RParenLoc, ContainsUnexpandedParameterPack,
- ResultIndex));
+ return new (Context) GenericSelectionExpr(
+ Context, KeyLoc, ControllingExpr, Types, Exprs, DefaultLoc, RParenLoc,
+ ContainsUnexpandedParameterPack, ResultIndex);
}
/// getUDSuffixLoc - Create a SourceLocation for a ud-suffix, given the
@@ -1545,7 +1541,7 @@ Sema::ActOnStringLiteral(const Token *St
&StringTokLocs[0],
StringTokLocs.size());
if (Literal.getUDSuffix().empty())
- return Owned(Lit);
+ return Lit;
// We're building a user-defined literal.
IdentifierInfo *UDSuffix = &Context.Idents.get(Literal.getUDSuffix());
@@ -1683,7 +1679,7 @@ Sema::BuildDeclRefExpr(ValueDecl *D, Qua
if (FD && FD->isBitField())
E->setObjectKind(OK_BitField);
- return Owned(E);
+ return E;
}
/// Decomposes the given name into a DeclarationNameInfo, its location, and
@@ -2019,7 +2015,7 @@ ExprResult Sema::ActOnIdExpression(Scope
return ExprError();
if (Expr *Ex = E.getAs<Expr>())
- return Owned(Ex);
+ return Ex;
}
}
@@ -2059,10 +2055,10 @@ ExprResult Sema::ActOnIdExpression(Scope
// Since the 'this' expression is synthesized, we don't need to
// perform the double-lookup check.
NamedDecl *FirstQualifierInScope = nullptr;
- return Owned(CXXDependentScopeMemberExpr::Create(
+ return CXXDependentScopeMemberExpr::Create(
Context, /*This=*/nullptr, ThisType, /*IsArrow=*/true,
/*Op=*/SourceLocation(), SS.getWithLocInContext(Context),
- TemplateKWLoc, FirstQualifierInScope, NameInfo, TemplateArgs));
+ TemplateKWLoc, FirstQualifierInScope, NameInfo, TemplateArgs);
}
}
@@ -2304,7 +2300,7 @@ Sema::LookupInObjCMethod(LookupResult &L
<< FixItHint::CreateInsertion(Loc, "self->");
}
- return Owned(Result);
+ return Result;
}
} else if (CurMethod->isInstanceMethod()) {
// We should warn if a local variable hides an ivar.
@@ -2337,7 +2333,7 @@ Sema::LookupInObjCMethod(LookupResult &L
}
}
// Sentinel value saying that we didn't do anything special.
- return Owned((Expr*) nullptr);
+ return ExprResult((Expr *)nullptr);
}
/// \brief Cast a base object to a member's actual type.
@@ -2364,7 +2360,7 @@ Sema::PerformObjectMemberConversion(Expr
NamedDecl *Member) {
CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Member->getDeclContext());
if (!RD)
- return Owned(From);
+ return From;
QualType DestRecordType;
QualType DestType;
@@ -2384,7 +2380,7 @@ Sema::PerformObjectMemberConversion(Expr
}
} else if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Member)) {
if (Method->isStatic())
- return Owned(From);
+ return From;
DestType = Method->getThisType(Context);
DestRecordType = DestType->getPointeeType();
@@ -2398,15 +2394,15 @@ Sema::PerformObjectMemberConversion(Expr
}
} else {
// No conversion necessary.
- return Owned(From);
+ return From;
}
if (DestType->isDependentType() || FromType->isDependentType())
- return Owned(From);
+ return From;
// If the unqualified types are the same, no conversion is necessary.
if (Context.hasSameUnqualifiedType(FromRecordType, DestRecordType))
- return Owned(From);
+ return From;
SourceRange FromRange = From->getSourceRange();
SourceLocation FromLoc = FromRange.getBegin();
@@ -2457,7 +2453,7 @@ Sema::PerformObjectMemberConversion(Expr
// If the qualifier type was the same as the destination type,
// we're done.
if (Context.hasSameUnqualifiedType(FromRecordType, DestRecordType))
- return Owned(From);
+ return From;
}
}
@@ -2614,7 +2610,7 @@ Sema::BuildDeclarationNameExpr(const CXX
NeedsADL, R.isOverloadedResult(),
R.begin(), R.end());
- return Owned(ULE);
+ return ULE;
}
/// \brief Complete semantic analysis for a reference to the given declaration.
@@ -2861,7 +2857,7 @@ ExprResult Sema::BuildPredefinedExpr(Sou
ResTy = Context.getConstantArrayType(ResTy, LengthI, ArrayType::Normal, 0);
}
- return Owned(new (Context) PredefinedExpr(Loc, ResTy, IT));
+ return new (Context) PredefinedExpr(Loc, ResTy, IT);
}
ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind) {
@@ -2916,7 +2912,7 @@ ExprResult Sema::ActOnCharacterConstant(
Tok.getLocation());
if (Literal.getUDSuffix().empty())
- return Owned(Lit);
+ return Lit;
// We're building a user-defined literal.
IdentifierInfo *UDSuffix = &Context.Idents.get(Literal.getUDSuffix());
@@ -2935,8 +2931,8 @@ ExprResult Sema::ActOnCharacterConstant(
ExprResult Sema::ActOnIntegerConstant(SourceLocation Loc, uint64_t Val) {
unsigned IntSize = Context.getTargetInfo().getIntWidth();
- return Owned(IntegerLiteral::Create(Context, llvm::APInt(IntSize, Val),
- Context.IntTy, Loc));
+ return IntegerLiteral::Create(Context, llvm::APInt(IntSize, Val),
+ Context.IntTy, Loc);
}
static Expr *BuildFloatingLiteral(Sema &S, NumericLiteralParser &Literal,
@@ -3227,12 +3223,12 @@ ExprResult Sema::ActOnNumericConstant(co
Res = new (Context) ImaginaryLiteral(Res,
Context.getComplexType(Res->getType()));
- return Owned(Res);
+ return Res;
}
ExprResult Sema::ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E) {
assert(E && "ActOnParenExpr() missing expr");
- return Owned(new (Context) ParenExpr(L, R, E));
+ return new (Context) ParenExpr(L, R, E);
}
static bool CheckVecStepTraitOperandType(Sema &S, QualType T,
@@ -3532,9 +3528,8 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Typ
return ExprError();
// C99 6.5.3.4p4: the type (an unsigned integer type) is size_t.
- return Owned(new (Context) UnaryExprOrTypeTraitExpr(ExprKind, TInfo,
- Context.getSizeType(),
- OpLoc, R.getEnd()));
+ return new (Context) UnaryExprOrTypeTraitExpr(
+ ExprKind, TInfo, Context.getSizeType(), OpLoc, R.getEnd());
}
/// \brief Build a sizeof or alignof expression given an expression
@@ -3573,9 +3568,8 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Exp
}
// C99 6.5.3.4p4: the type (an unsigned integer type) is size_t.
- return Owned(new (Context) UnaryExprOrTypeTraitExpr(
- ExprKind, E, Context.getSizeType(), OpLoc,
- E->getSourceRange().getEnd()));
+ return new (Context) UnaryExprOrTypeTraitExpr(
+ ExprKind, E, Context.getSizeType(), OpLoc, E->getSourceRange().getEnd());
}
/// ActOnUnaryExprOrTypeTraitExpr - Handle @c sizeof(type) and @c sizeof @c
@@ -3699,10 +3693,8 @@ Sema::ActOnArraySubscriptExpr(Scope *S,
// Build an unanalyzed expression if either operand is type-dependent.
if (getLangOpts().CPlusPlus &&
(base->isTypeDependent() || idx->isTypeDependent())) {
- return Owned(new (Context) ArraySubscriptExpr(base, idx,
- Context.DependentTy,
- VK_LValue, OK_Ordinary,
- rbLoc));
+ return new (Context) ArraySubscriptExpr(base, idx, Context.DependentTy,
+ VK_LValue, OK_Ordinary, rbLoc);
}
// Use C++ overloaded-operator rules if either operand has record
@@ -3862,8 +3854,8 @@ Sema::CreateBuiltinArraySubscriptExpr(Ex
assert(VK == VK_RValue || LangOpts.CPlusPlus ||
!ResultType.isCForbiddenLValueType());
- return Owned(new (Context) ArraySubscriptExpr(LHSExp, RHSExp,
- ResultType, VK, OK, RLoc));
+ return new (Context)
+ ArraySubscriptExpr(LHSExp, RHSExp, ResultType, VK, OK, RLoc);
}
ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
@@ -3922,7 +3914,7 @@ ExprResult Sema::BuildCXXDefaultArgExpr(
Expr *Arg = Result.getAs<Expr>();
CheckCompletedExpr(Arg, Param->getOuterLocStart());
// Build the default argument expression.
- return Owned(CXXDefaultArgExpr::Create(Context, CallLoc, Param, Arg));
+ return CXXDefaultArgExpr::Create(Context, CallLoc, Param, Arg);
}
// If the default expression creates temporaries, we need to
@@ -3949,7 +3941,7 @@ ExprResult Sema::BuildCXXDefaultArgExpr(
// as being "referenced".
MarkDeclarationsReferencedInExpr(Param->getDefaultArg(),
/*SkipLocalVariables=*/true);
- return Owned(CXXDefaultArgExpr::Create(Context, CallLoc, Param));
+ return CXXDefaultArgExpr::Create(Context, CallLoc, Param);
}
@@ -4201,11 +4193,8 @@ bool Sema::GatherArgumentsForCall(Source
if (CFAudited)
Entity.setParameterCFAudited();
- ExprResult ArgE = PerformCopyInitialization(Entity,
- SourceLocation(),
- Owned(Arg),
- IsListInitialization,
- AllowExplicit);
+ ExprResult ArgE = PerformCopyInitialization(
+ Entity, SourceLocation(), Arg, IsListInitialization, AllowExplicit);
if (ArgE.isInvalid())
return true;
@@ -4405,9 +4394,8 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn,
ArgExprs.back()->getLocEnd()));
}
- return Owned(new (Context) CallExpr(Context, Fn, None,
- Context.VoidTy, VK_RValue,
- RParenLoc));
+ return new (Context)
+ CallExpr(Context, Fn, None, Context.VoidTy, VK_RValue, RParenLoc);
}
if (Fn->getType() == Context.PseudoObjectTy) {
ExprResult result = CheckPlaceholderExpr(Fn);
@@ -4427,20 +4415,19 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn,
if (Dependent) {
if (ExecConfig) {
- return Owned(new (Context) CUDAKernelCallExpr(
+ return new (Context) CUDAKernelCallExpr(
Context, Fn, cast<CallExpr>(ExecConfig), ArgExprs,
- Context.DependentTy, VK_RValue, RParenLoc));
+ Context.DependentTy, VK_RValue, RParenLoc);
} else {
- return Owned(new (Context) CallExpr(Context, Fn, ArgExprs,
- Context.DependentTy, VK_RValue,
- RParenLoc));
+ return new (Context) CallExpr(
+ Context, Fn, ArgExprs, Context.DependentTy, VK_RValue, RParenLoc);
}
}
// Determine whether this is a call to an object (C++ [over.call.object]).
if (Fn->getType()->isRecordType())
- return Owned(BuildCallToObjectOfClassType(S, Fn, LParenLoc,
- ArgExprs, RParenLoc));
+ return BuildCallToObjectOfClassType(S, Fn, LParenLoc, ArgExprs,
+ RParenLoc);
if (Fn->getType() == Context.UnknownAnyTy) {
ExprResult result = rebuildUnknownAnyFunction(*this, Fn);
@@ -4543,8 +4530,7 @@ ExprResult Sema::ActOnAsTypeExpr(Expr *E
<< DstTy
<< SrcTy
<< E->getSourceRange());
- return Owned(new (Context) AsTypeExpr(E, DstTy, VK, OK, BuiltinLoc,
- RParenLoc));
+ return new (Context) AsTypeExpr(E, DstTy, VK, OK, BuiltinLoc, RParenLoc);
}
/// ActOnConvertVectorExpr - create a new convert-vector expression from the
@@ -4692,9 +4678,8 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
if (Proto && i < Proto->getNumParams()) {
InitializedEntity Entity = InitializedEntity::InitializeParameter(
Context, Proto->getParamType(i), Proto->isParamConsumed(i));
- ExprResult ArgE = PerformCopyInitialization(Entity,
- SourceLocation(),
- Owned(Arg));
+ ExprResult ArgE =
+ PerformCopyInitialization(Entity, SourceLocation(), Arg);
if (ArgE.isInvalid())
return true;
@@ -4833,7 +4818,7 @@ Sema::ActOnInitList(SourceLocation LBrac
InitListExpr *E = new (Context) InitListExpr(Context, LBraceLoc, InitArgList,
RBraceLoc);
E->setType(Context.VoidTy); // FIXME: just a place holder for now.
- return Owned(E);
+ return E;
}
/// Do an explicit extend of the given block pointer if we're in ARC.
@@ -5115,7 +5100,7 @@ ExprResult Sema::CheckExtVectorCast(Sour
return ExprError();
}
Kind = CK_BitCast;
- return Owned(CastExpr);
+ return CastExpr;
}
// All non-pointer scalars can be cast to ExtVector type. The appropriate
@@ -5127,14 +5112,14 @@ ExprResult Sema::CheckExtVectorCast(Sour
<< DestTy << SrcTy << R;
QualType DestElemTy = DestTy->getAs<ExtVectorType>()->getElementType();
- ExprResult CastExprRes = Owned(CastExpr);
+ ExprResult CastExprRes = CastExpr;
CastKind CK = PrepareScalarCast(CastExprRes, DestElemTy);
if (CastExprRes.isInvalid())
return ExprError();
CastExpr = ImpCastExprToType(CastExprRes.get(), DestElemTy, CK).get();
Kind = CK_VectorSplat;
- return Owned(CastExpr);
+ return CastExpr;
}
ExprResult
@@ -5288,7 +5273,7 @@ ExprResult
Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *OrigExpr) {
ParenListExpr *E = dyn_cast<ParenListExpr>(OrigExpr);
if (!E)
- return Owned(OrigExpr);
+ return OrigExpr;
ExprResult Result(E->getExpr(0));
@@ -5305,7 +5290,7 @@ ExprResult Sema::ActOnParenListExpr(Sour
SourceLocation R,
MultiExprArg Val) {
Expr *expr = new (Context) ParenListExpr(Context, L, Val, R);
- return Owned(expr);
+ return expr;
}
/// \brief Emit a specialized diagnostic when one expression is a null pointer
@@ -5999,7 +5984,7 @@ ExprResult Sema::ActOnConditionalOp(Sour
ExprValueKind VK = VK_RValue;
ExprObjectKind OK = OK_Ordinary;
- ExprResult Cond = Owned(CondExpr), LHS = Owned(LHSExpr), RHS = Owned(RHSExpr);
+ ExprResult Cond = CondExpr, LHS = LHSExpr, RHS = RHSExpr;
QualType result = CheckConditionalOperands(Cond, LHS, RHS,
VK, OK, QuestionLoc);
if (result.isNull() || Cond.isInvalid() || LHS.isInvalid() ||
@@ -6010,14 +5995,13 @@ ExprResult Sema::ActOnConditionalOp(Sour
RHS.get());
if (!commonExpr)
- return Owned(new (Context) ConditionalOperator(Cond.get(), QuestionLoc,
- LHS.get(), ColonLoc,
- RHS.get(), result, VK, OK));
-
- return Owned(new (Context)
- BinaryConditionalOperator(commonExpr, opaqueValue, Cond.get(), LHS.get(),
- RHS.get(), QuestionLoc, ColonLoc, result, VK,
- OK));
+ return new (Context)
+ ConditionalOperator(Cond.get(), QuestionLoc, LHS.get(), ColonLoc,
+ RHS.get(), result, VK, OK);
+
+ return new (Context) BinaryConditionalOperator(
+ commonExpr, opaqueValue, Cond.get(), LHS.get(), RHS.get(), QuestionLoc,
+ ColonLoc, result, VK, OK);
}
// checkPointerTypesForAssignment - This is a very tricky routine (despite
@@ -6522,9 +6506,8 @@ static void ConstructTransparentUnion(Se
// Build a compound literal constructing a value of the transparent
// union type from this initializer list.
TypeSourceInfo *unionTInfo = C.getTrivialTypeSourceInfo(UnionType);
- EResult = S.Owned(
- new (C) CompoundLiteralExpr(SourceLocation(), unionTInfo, UnionType,
- VK_RValue, Initializer, false));
+ EResult = new (C) CompoundLiteralExpr(SourceLocation(), unionTInfo, UnionType,
+ VK_RValue, Initializer, false);
}
Sema::AssignConvertType
@@ -6667,7 +6650,7 @@ Sema::CheckSingleAssignmentConstraints(Q
(CheckObjCBridgeRelatedConversions(E->getLocStart(),
LHSType, E->getType(), E) ||
ConversionToObjCStringLiteralCheck(LHSType, E))) {
- RHS = Owned(E);
+ RHS = E;
return Compatible;
}
@@ -8227,7 +8210,7 @@ inline QualType Sema::CheckBitwiseOperan
return InvalidOperands(Loc, LHS, RHS);
}
- ExprResult LHSResult = Owned(LHS), RHSResult = Owned(RHS);
+ ExprResult LHSResult = LHS, RHSResult = RHS;
QualType compType = UsualArithmeticConversions(LHSResult, RHSResult,
IsCompAssign);
if (LHSResult.isInvalid() || RHSResult.isInvalid())
@@ -9220,7 +9203,7 @@ ExprResult Sema::CreateBuiltinBinOp(Sour
RHSExpr = Init.get();
}
- ExprResult LHS = Owned(LHSExpr), RHS = Owned(RHSExpr);
+ ExprResult LHS = LHSExpr, RHS = RHSExpr;
QualType ResultTy; // Result type of the binary operator.
// The following two variables are used for compound assignment operators
QualType CompLHSTy; // Type of LHS after promotions for computation
@@ -9355,18 +9338,16 @@ ExprResult Sema::CreateBuiltinBinOp(Sour
DiagnoseDirectIsaAccess(*this, OIRE, OpLoc, RHS.get());
if (CompResultTy.isNull())
- return Owned(new (Context) BinaryOperator(LHS.get(), RHS.get(), Opc,
- ResultTy, VK, OK, OpLoc,
- FPFeatures.fp_contract));
+ return new (Context) BinaryOperator(LHS.get(), RHS.get(), Opc, ResultTy, VK,
+ OK, OpLoc, FPFeatures.fp_contract);
if (getLangOpts().CPlusPlus && LHS.get()->getObjectKind() !=
OK_ObjCProperty) {
VK = VK_LValue;
OK = LHS.get()->getObjectKind();
}
- return Owned(new (Context) CompoundAssignOperator(LHS.get(), RHS.get(), Opc,
- ResultTy, VK, OK, CompLHSTy,
- CompResultTy, OpLoc,
- FPFeatures.fp_contract));
+ return new (Context) CompoundAssignOperator(
+ LHS.get(), RHS.get(), Opc, ResultTy, VK, OK, CompLHSTy, CompResultTy,
+ OpLoc, FPFeatures.fp_contract);
}
/// DiagnoseBitwisePrecedence - Emit a warning when bitwise and comparison
@@ -9694,7 +9675,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So
ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
UnaryOperatorKind Opc,
Expr *InputExpr) {
- ExprResult Input = Owned(InputExpr);
+ ExprResult Input = InputExpr;
ExprValueKind VK = VK_RValue;
ExprObjectKind OK = OK_Ordinary;
QualType resultType;
@@ -9848,8 +9829,8 @@ ExprResult Sema::CreateBuiltinUnaryOp(So
if (Opc != UO_AddrOf && Opc != UO_Deref)
CheckArrayAccess(Input.get());
- return Owned(new (Context) UnaryOperator(Input.get(), Opc, resultType,
- VK, OK, OpLoc));
+ return new (Context)
+ UnaryOperator(Input.get(), Opc, resultType, VK, OK, OpLoc);
}
/// \brief Determine whether the given expression is a qualified member
@@ -9952,8 +9933,8 @@ ExprResult Sema::ActOnAddrLabel(SourceLo
LabelDecl *TheDecl) {
TheDecl->markUsed(Context);
// Create the AST node. The address of a label always has type 'void*'.
- return Owned(new (Context) AddrLabelExpr(OpLoc, LabLoc, TheDecl,
- Context.getPointerType(Context.VoidTy)));
+ return new (Context) AddrLabelExpr(OpLoc, LabLoc, TheDecl,
+ Context.getPointerType(Context.VoidTy));
}
/// Given the last statement in a statement-expression, check whether
@@ -10069,7 +10050,7 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc
Expr *ResStmtExpr = new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc);
if (StmtExprMayBindToTemp)
return MaybeBindToTemporary(ResStmtExpr);
- return Owned(ResStmtExpr);
+ return ResStmtExpr;
}
ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
@@ -10242,8 +10223,8 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
CurrentType = MemberDecl->getType().getNonReferenceType();
}
- return Owned(OffsetOfExpr::Create(Context, Context.getSizeType(), BuiltinLoc,
- TInfo, Comps, Exprs, RParenLoc));
+ return OffsetOfExpr::Create(Context, Context.getSizeType(), BuiltinLoc, TInfo,
+ Comps, Exprs, RParenLoc);
}
ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
@@ -10301,10 +10282,9 @@ ExprResult Sema::ActOnChooseExpr(SourceL
OK = ActiveExpr->getObjectKind();
}
- return Owned(new (Context) ChooseExpr(BuiltinLoc, CondExpr, LHSExpr, RHSExpr,
- resType, VK, OK, RPLoc, CondIsTrue,
- resType->isDependentType(),
- ValueDependent));
+ return new (Context)
+ ChooseExpr(BuiltinLoc, CondExpr, LHSExpr, RHSExpr, resType, VK, OK, RPLoc,
+ CondIsTrue, resType->isDependentType(), ValueDependent);
}
//===----------------------------------------------------------------------===//
@@ -10584,7 +10564,7 @@ ExprResult Sema::ActOnBlockStmtExpr(Sour
}
}
- return Owned(Result);
+ return Result;
}
ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
@@ -10677,7 +10657,7 @@ ExprResult Sema::BuildVAArgExpr(SourceLo
}
QualType T = TInfo->getType().getNonLValueExprType(Context);
- return Owned(new (Context) VAArgExpr(BuiltinLoc, E, TInfo, RPLoc, T));
+ return new (Context) VAArgExpr(BuiltinLoc, E, TInfo, RPLoc, T);
}
ExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) {
@@ -10695,7 +10675,7 @@ ExprResult Sema::ActOnGNUNullExpr(Source
llvm_unreachable("I don't know size of pointer!");
}
- return Owned(new (Context) GNUNullExpr(Ty, TokenLoc));
+ return new (Context) GNUNullExpr(Ty, TokenLoc);
}
bool
@@ -11018,7 +10998,7 @@ Sema::VerifyIntegerConstantExpression(Ex
if (!getLangOpts().CPlusPlus11 && E->isIntegerConstantExpr(Context)) {
if (Result)
*Result = E->EvaluateKnownConstInt(Context);
- return Owned(E);
+ return E;
}
Expr::EvalResult EvalResult;
@@ -11036,7 +11016,7 @@ Sema::VerifyIntegerConstantExpression(Ex
if (Folded && getLangOpts().CPlusPlus11 && Notes.empty()) {
if (Result)
*Result = EvalResult.Val.getInt();
- return Owned(E);
+ return E;
}
// If our only note is the usual "invalid subexpression" note, just point
@@ -11064,7 +11044,7 @@ Sema::VerifyIntegerConstantExpression(Ex
if (Result)
*Result = EvalResult.Val.getInt();
- return Owned(E);
+ return E;
}
namespace {
@@ -11646,7 +11626,7 @@ static bool captureInBlock(BlockScopeInf
= S.PerformCopyInitialization(
InitializedEntity::InitializeBlock(Var->getLocation(),
CaptureType, false),
- Loc, S.Owned(DeclRef));
+ Loc, DeclRef);
// Build a full-expression copy expression if initialization
// succeeded and used a non-trivial constructor. Recover from
@@ -12709,7 +12689,7 @@ ExprResult Sema::CheckBooleanCondition(E
}
}
- return Owned(E);
+ return E;
}
ExprResult Sema::ActOnBooleanCondition(Scope *S, SourceLocation Loc,
@@ -13035,7 +13015,7 @@ ExprResult RebuildUnknownAnyExpr::VisitI
if (!Result.isUsable()) return ExprError();
E->setSubExpr(Result.get());
- return S.Owned(E);
+ return E;
} else if (E->getCastKind() == CK_LValueToRValue) {
assert(E->getValueKind() == VK_RValue);
assert(E->getObjectKind() == OK_Ordinary);
@@ -13051,7 +13031,7 @@ ExprResult RebuildUnknownAnyExpr::VisitI
if (!Result.isUsable()) return ExprError();
E->setSubExpr(Result.get());
- return S.Owned(E);
+ return E;
} else {
llvm_unreachable("Unhandled cast type!");
}
@@ -13111,7 +13091,7 @@ ExprResult RebuildUnknownAnyExpr::resolv
VD->setType(DestType);
E->setType(Type);
E->setValueKind(ValueKind);
- return S.Owned(E);
+ return E;
}
/// Check a cast of an unknown-any type. We intentionally only
@@ -13154,7 +13134,7 @@ ExprResult Sema::checkUnknownAnyArg(Sour
InitializedEntity entity =
InitializedEntity::InitializeParameter(Context, paramType,
/*consumed*/ false);
- return PerformCopyInitialization(entity, callLoc, Owned(arg));
+ return PerformCopyInitialization(entity, callLoc, arg);
}
static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *E) {
@@ -13204,7 +13184,7 @@ static ExprResult diagnoseUnknownAnyExpr
/// Returns true if there was an error and no recovery was possible.
ExprResult Sema::CheckPlaceholderExpr(Expr *E) {
const BuiltinType *placeholderType = E->getType()->getAsPlaceholderType();
- if (!placeholderType) return Owned(E);
+ if (!placeholderType) return E;
switch (placeholderType->getKind()) {
@@ -13212,7 +13192,7 @@ ExprResult Sema::CheckPlaceholderExpr(Ex
case BuiltinType::Overload: {
// Try to resolve a single function template specialization.
// This is obligatory.
- ExprResult result = Owned(E);
+ ExprResult result = E;
if (ResolveAndFixSingleFunctionTemplateSpecialization(result, false)) {
return result;
@@ -13226,7 +13206,7 @@ ExprResult Sema::CheckPlaceholderExpr(Ex
// Bound member functions.
case BuiltinType::BoundMember: {
- ExprResult result = Owned(E);
+ ExprResult result = E;
tryToRecoverWithCall(result, PDiag(diag::err_bound_member_function),
/*complain*/ true);
return result;
@@ -13236,7 +13216,7 @@ ExprResult Sema::CheckPlaceholderExpr(Ex
case BuiltinType::ARCUnbridgedCast: {
Expr *realCast = stripARCUnbridgedCast(E);
diagnoseARCUnbridgedCast(realCast);
- return Owned(realCast);
+ return realCast;
}
// Expressions of unknown type.
@@ -13287,6 +13267,6 @@ Sema::ActOnObjCBoolLiteral(SourceLocatio
}
if (Context.getBOOLDecl())
BoolT = Context.getBOOLType();
- return Owned(new (Context) ObjCBoolLiteralExpr(Kind == tok::kw___objc_yes,
- BoolT, OpLoc));
+ return new (Context)
+ ObjCBoolLiteralExpr(Kind == tok::kw___objc_yes, BoolT, OpLoc);
}
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu May 29 09:05:12 2014
@@ -379,9 +379,8 @@ ExprResult Sema::BuildCXXTypeId(QualType
RequireCompleteType(TypeidLoc, T, diag::err_incomplete_typeid))
return ExprError();
- return Owned(new (Context) CXXTypeidExpr(TypeInfoType.withConst(),
- Operand,
- SourceRange(TypeidLoc, RParenLoc)));
+ return new (Context) CXXTypeidExpr(TypeInfoType.withConst(), Operand,
+ SourceRange(TypeidLoc, RParenLoc));
}
/// \brief Build a C++ typeid expression with an expression operand.
@@ -434,9 +433,8 @@ ExprResult Sema::BuildCXXTypeId(QualType
}
}
- return Owned(new (Context) CXXTypeidExpr(TypeInfoType.withConst(),
- E,
- SourceRange(TypeidLoc, RParenLoc)));
+ return new (Context) CXXTypeidExpr(TypeInfoType.withConst(), E,
+ SourceRange(TypeidLoc, RParenLoc));
}
/// ActOnCXXTypeidOfType - Parse typeid( type-id ) or typeid (expression);
@@ -502,9 +500,8 @@ ExprResult Sema::BuildCXXUuidof(QualType
}
}
- return Owned(new (Context) CXXUuidofExpr(TypeInfoType.withConst(),
- Operand,
- SourceRange(TypeidLoc, RParenLoc)));
+ return new (Context) CXXUuidofExpr(TypeInfoType.withConst(), Operand,
+ SourceRange(TypeidLoc, RParenLoc));
}
/// \brief Build a Microsoft __uuidof expression with an expression operand.
@@ -523,9 +520,8 @@ ExprResult Sema::BuildCXXUuidof(QualType
}
}
- return Owned(new (Context) CXXUuidofExpr(TypeInfoType.withConst(),
- E,
- SourceRange(TypeidLoc, RParenLoc)));
+ return new (Context) CXXUuidofExpr(TypeInfoType.withConst(), E,
+ SourceRange(TypeidLoc, RParenLoc));
}
/// ActOnCXXUuidof - Parse __uuidof( type-id ) or __uuidof (expression);
@@ -567,14 +563,14 @@ ExprResult
Sema::ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) {
assert((Kind == tok::kw_true || Kind == tok::kw_false) &&
"Unknown C++ Boolean value!");
- return Owned(new (Context) CXXBoolLiteralExpr(Kind == tok::kw_true,
- Context.BoolTy, OpLoc));
+ return new (Context)
+ CXXBoolLiteralExpr(Kind == tok::kw_true, Context.BoolTy, OpLoc);
}
/// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
ExprResult
Sema::ActOnCXXNullPtrLiteral(SourceLocation Loc) {
- return Owned(new (Context) CXXNullPtrLiteralExpr(Context.NullPtrTy, Loc));
+ return new (Context) CXXNullPtrLiteralExpr(Context.NullPtrTy, Loc);
}
/// ActOnCXXThrow - Parse throw expressions.
@@ -629,8 +625,8 @@ ExprResult Sema::BuildCXXThrow(SourceLoc
Ex = ExRes.get();
}
- return Owned(new (Context) CXXThrowExpr(Ex, Context.VoidTy, OpLoc,
- IsThrownVarInScope));
+ return new (Context)
+ CXXThrowExpr(Ex, Context.VoidTy, OpLoc, IsThrownVarInScope);
}
/// CheckCXXThrowOperand - Validate the operand of a throw.
@@ -702,7 +698,7 @@ ExprResult Sema::CheckCXXThrowOperand(So
// If the exception has class type, we need additional handling.
const RecordType *RecordTy = Ty->getAs<RecordType>();
if (!RecordTy)
- return Owned(E);
+ return E;
CXXRecordDecl *RD = cast<CXXRecordDecl>(RecordTy->getDecl());
// If we are throwing a polymorphic class type or pointer thereof,
@@ -711,22 +707,22 @@ ExprResult Sema::CheckCXXThrowOperand(So
// If a pointer is thrown, the referenced object will not be destroyed.
if (isPointer)
- return Owned(E);
+ return E;
// If the class has a destructor, we must be able to call it.
if (RD->hasIrrelevantDestructor())
- return Owned(E);
+ return E;
CXXDestructorDecl *Destructor = LookupDestructor(RD);
if (!Destructor)
- return Owned(E);
+ return E;
MarkFunctionReferenced(E->getExprLoc(), Destructor);
CheckDestructorAccess(E->getExprLoc(), Destructor,
PDiag(diag::err_access_dtor_exception) << Ty);
if (DiagnoseUseOfDecl(Destructor, E->getExprLoc()))
return ExprError();
- return Owned(E);
+ return E;
}
QualType Sema::getCurrentThisType() {
@@ -853,7 +849,7 @@ ExprResult Sema::ActOnCXXThis(SourceLoca
if (ThisTy.isNull()) return Diag(Loc, diag::err_invalid_this_use);
CheckCXXThisCapture(Loc);
- return Owned(new (Context) CXXThisExpr(Loc, ThisTy, /*isImplicit=*/false));
+ return new (Context) CXXThisExpr(Loc, ThisTy, /*isImplicit=*/false);
}
bool Sema::isThisOutsideMemberFunctionBody(QualType BaseType) {
@@ -897,10 +893,8 @@ Sema::BuildCXXTypeConstructExpr(TypeSour
SourceLocation TyBeginLoc = TInfo->getTypeLoc().getBeginLoc();
if (Ty->isDependentType() || CallExpr::hasAnyTypeDependentArguments(Exprs)) {
- return Owned(CXXUnresolvedConstructExpr::Create(Context, TInfo,
- LParenLoc,
- Exprs,
- RParenLoc));
+ return CXXUnresolvedConstructExpr::Create(Context, TInfo, LParenLoc, Exprs,
+ RParenLoc);
}
bool ListInitialization = LParenLoc.isInvalid();
@@ -956,9 +950,9 @@ Sema::BuildCXXTypeConstructExpr(TypeSour
// want, since it will be treated as an initializer list in further
// processing. Explicitly insert a cast here.
QualType ResultType = Result.get()->getType();
- Result = Owned(CXXFunctionalCastExpr::Create(
+ Result = CXXFunctionalCastExpr::Create(
Context, ResultType, Expr::getValueKindForType(TInfo->getType()), TInfo,
- CK_NoOp, Result.get(), /*Path=*/ nullptr, LParenLoc, RParenLoc));
+ CK_NoOp, Result.get(), /*Path=*/nullptr, LParenLoc, RParenLoc);
}
// FIXME: Improve AST representation?
@@ -1501,7 +1495,7 @@ Sema::BuildCXXNew(SourceRange Range, boo
// we don't want the initialized object to be destructed.
if (CXXBindTemporaryExpr *Binder =
dyn_cast_or_null<CXXBindTemporaryExpr>(FullInit.get()))
- FullInit = Owned(Binder->getSubExpr());
+ FullInit = Binder->getSubExpr();
Initializer = FullInit.get();
}
@@ -1536,13 +1530,11 @@ Sema::BuildCXXNew(SourceRange Range, boo
}
}
- return Owned(new (Context) CXXNewExpr(Context, UseGlobal, OperatorNew,
- OperatorDelete,
- UsualArrayDeleteWantsSize,
- PlacementArgs, TypeIdParens,
- ArraySize, initStyle, Initializer,
- ResultType, AllocTypeInfo,
- Range, DirectInitRange));
+ return new (Context)
+ CXXNewExpr(Context, UseGlobal, OperatorNew, OperatorDelete,
+ UsualArrayDeleteWantsSize, PlacementArgs, TypeIdParens,
+ ArraySize, initStyle, Initializer, ResultType, AllocTypeInfo,
+ Range, DirectInitRange);
}
/// \brief Checks that a type is suitable as the allocated type
@@ -2241,7 +2233,7 @@ Sema::ActOnCXXDelete(SourceLocation Star
//
// DR599 amends "pointer type" to "pointer to object type" in both cases.
- ExprResult Ex = Owned(ExE);
+ ExprResult Ex = ExE;
FunctionDecl *OperatorDelete = nullptr;
bool ArrayFormAsWritten = ArrayForm;
bool UsualArrayDeleteWantsSize = false;
@@ -2432,10 +2424,9 @@ Sema::ActOnCXXDelete(SourceLocation Star
}
}
- return Owned(new (Context) CXXDeleteExpr(Context.VoidTy, UseGlobal, ArrayForm,
- ArrayFormAsWritten,
- UsualArrayDeleteWantsSize,
- OperatorDelete, Ex.get(), StartLoc));
+ return new (Context) CXXDeleteExpr(
+ Context.VoidTy, UseGlobal, ArrayForm, ArrayFormAsWritten,
+ UsualArrayDeleteWantsSize, OperatorDelete, Ex.get(), StartLoc);
}
/// \brief Check the use of the given variable as a C++ condition in an if,
@@ -2459,14 +2450,10 @@ ExprResult Sema::CheckConditionVariable(
diag::err_invalid_use_of_array_type)
<< ConditionVar->getSourceRange());
- ExprResult Condition =
- Owned(DeclRefExpr::Create(Context, NestedNameSpecifierLoc(),
- SourceLocation(),
- ConditionVar,
- /*enclosing*/ false,
- ConditionVar->getLocation(),
- ConditionVar->getType().getNonReferenceType(),
- VK_LValue));
+ ExprResult Condition = DeclRefExpr::Create(
+ Context, NestedNameSpecifierLoc(), SourceLocation(), ConditionVar,
+ /*enclosing*/ false, ConditionVar->getLocation(),
+ ConditionVar->getType().getNonReferenceType(), VK_LValue);
MarkDeclRefReferenced(cast<DeclRefExpr>(Condition.get()));
@@ -2577,11 +2564,9 @@ static ExprResult BuildCXXCastArgument(S
if (Result.isInvalid())
return ExprError();
// Record usage of conversion in an implicit cast.
- Result = S.Owned(ImplicitCastExpr::Create(S.Context,
- Result.get()->getType(),
- CK_UserDefinedConversion,
- Result.get(), nullptr,
- Result.get()->getValueKind()));
+ Result = ImplicitCastExpr::Create(S.Context, Result.get()->getType(),
+ CK_UserDefinedConversion, Result.get(),
+ nullptr, Result.get()->getValueKind());
S.CheckMemberOperatorAccess(CastLoc, From, /*arg*/ nullptr, FoundDecl);
@@ -2677,7 +2662,7 @@ Sema::PerformImplicitConversion(Expr *Fr
}
// Everything went well.
- return Owned(From);
+ return From;
}
/// PerformImplicitConversion - Perform an implicit conversion of the
@@ -3011,7 +2996,7 @@ Sema::PerformImplicitConversion(Expr *Fr
}
case ICK_TransparentUnionConversion: {
- ExprResult FromRes = Owned(From);
+ ExprResult FromRes = From;
Sema::AssignConvertType ConvTy =
CheckTransparentUnionArgumentConstraints(ToType, FromRes);
if (FromRes.isInvalid())
@@ -3074,7 +3059,7 @@ Sema::PerformImplicitConversion(Expr *Fr
VK_RValue, nullptr, CCK).get();
}
- return Owned(From);
+ return From;
}
/// \brief Check the completeness of a type in a unary type trait.
@@ -4002,9 +3987,8 @@ ExprResult Sema::BuildArrayTypeTrait(Arr
// returns 'size_t'. On Windows, the primary platform for the Embarcadero
// compiler, there is no difference. On several other platforms this is an
// important distinction.
- return Owned(new (Context) ArrayTypeTraitExpr(KWLoc, ATT, TSInfo, Value,
- DimExpr, RParen,
- Context.getSizeType()));
+ return new (Context) ArrayTypeTraitExpr(KWLoc, ATT, TSInfo, Value, DimExpr,
+ RParen, Context.getSizeType());
}
ExprResult Sema::ActOnExpressionTrait(ExpressionTrait ET,
@@ -4042,8 +4026,8 @@ ExprResult Sema::BuildExpressionTrait(Ex
bool Value = EvaluateExpressionTrait(ET, Queried);
- return Owned(new (Context) ExpressionTraitExpr(KWLoc, ET, Queried, Value,
- RParen, Context.BoolTy));
+ return new (Context)
+ ExpressionTraitExpr(KWLoc, ET, Queried, Value, RParen, Context.BoolTy);
}
QualType Sema::CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS,
@@ -4845,7 +4829,7 @@ ExprResult Sema::MaybeBindToTemporary(Ex
// If the result is a glvalue, we shouldn't bind it.
if (!E->isRValue())
- return Owned(E);
+ return E;
// In ARC, calls that return a retainable type can return retained,
// in which case we have to insert a consuming cast.
@@ -4888,7 +4872,7 @@ ExprResult Sema::MaybeBindToTemporary(Ex
// we don't want any extra casts here.
} else if (isa<CastExpr>(E) &&
isa<BlockExpr>(cast<CastExpr>(E)->getSubExpr())) {
- return Owned(E);
+ return E;
// For message sends and property references, we try to find an
// actual method. FIXME: we should infer retention by selector in
@@ -4913,23 +4897,23 @@ ExprResult Sema::MaybeBindToTemporary(Ex
// return an object.
if (!ReturnsRetained &&
D && D->getMethodFamily() == OMF_performSelector)
- return Owned(E);
+ return E;
}
// Don't reclaim an object of Class type.
if (!ReturnsRetained && E->getType()->isObjCARCImplicitlyUnretainedType())
- return Owned(E);
+ return E;
ExprNeedsCleanups = true;
CastKind ck = (ReturnsRetained ? CK_ARCConsumeObject
: CK_ARCReclaimReturnedObject);
- return Owned(ImplicitCastExpr::Create(Context, E->getType(), ck, E, nullptr,
- VK_RValue));
+ return ImplicitCastExpr::Create(Context, E->getType(), ck, E, nullptr,
+ VK_RValue);
}
if (!getLangOpts().CPlusPlus)
- return Owned(E);
+ return E;
// Search for the base element type (cf. ASTContext::getBaseElementType) with
// a fast path for the common case that the type is directly a RecordType.
@@ -4947,7 +4931,7 @@ ExprResult Sema::MaybeBindToTemporary(Ex
T = cast<ArrayType>(T)->getElementType().getTypePtr();
break;
default:
- return Owned(E);
+ return E;
}
}
@@ -4955,7 +4939,7 @@ ExprResult Sema::MaybeBindToTemporary(Ex
// not processing a decltype expression.
CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
if (RD->isInvalidDecl() || RD->isDependentContext())
- return Owned(E);
+ return E;
bool IsDecltype = ExprEvalContexts.back().IsDecltype;
CXXDestructorDecl *Destructor = IsDecltype ? nullptr : LookupDestructor(RD);
@@ -4970,7 +4954,7 @@ ExprResult Sema::MaybeBindToTemporary(Ex
// If destructor is trivial, we can avoid the extra copy.
if (Destructor->isTrivial())
- return Owned(E);
+ return E;
// We need a cleanup, but we don't need to remember the temporary.
ExprNeedsCleanups = true;
@@ -4982,7 +4966,7 @@ ExprResult Sema::MaybeBindToTemporary(Ex
if (IsDecltype)
ExprEvalContexts.back().DelayedDecltypeBinds.push_back(Bind);
- return Owned(Bind);
+ return Bind;
}
ExprResult
@@ -4990,7 +4974,7 @@ Sema::MaybeCreateExprWithCleanups(ExprRe
if (SubExpr.isInvalid())
return ExprError();
- return Owned(MaybeCreateExprWithCleanups(SubExpr.get()));
+ return MaybeCreateExprWithCleanups(SubExpr.get());
}
Expr *Sema::MaybeCreateExprWithCleanups(Expr *SubExpr) {
@@ -5056,7 +5040,7 @@ ExprResult Sema::ActOnDecltypeExpression
if (SubExpr.isInvalid())
return ExprError();
if (SubExpr.get() == PE->getSubExpr())
- return Owned(E);
+ return E;
return ActOnParenExpr(PE->getLParen(), PE->getRParen(), SubExpr.get());
}
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) {
@@ -5065,13 +5049,10 @@ ExprResult Sema::ActOnDecltypeExpression
if (RHS.isInvalid())
return ExprError();
if (RHS.get() == BO->getRHS())
- return Owned(E);
- return Owned(new (Context) BinaryOperator(BO->getLHS(), RHS.get(),
- BO_Comma, BO->getType(),
- BO->getValueKind(),
- BO->getObjectKind(),
- BO->getOperatorLoc(),
- BO->isFPContractable()));
+ return E;
+ return new (Context) BinaryOperator(
+ BO->getLHS(), RHS.get(), BO_Comma, BO->getType(), BO->getValueKind(),
+ BO->getObjectKind(), BO->getOperatorLoc(), BO->isFPContractable());
}
}
@@ -5089,7 +5070,7 @@ ExprResult Sema::ActOnDecltypeExpression
// In MS mode, don't perform any extra checking of call return types within a
// decltype expression.
if (getLangOpts().MSVCCompat)
- return Owned(E);
+ return E;
// Perform the semantic checks we delayed until this point.
for (unsigned I = 0, N = ExprEvalContexts.back().DelayedDecltypeCalls.size();
@@ -5132,7 +5113,7 @@ ExprResult Sema::ActOnDecltypeExpression
}
// Possibly strip off the top CXXBindTemporaryExpr.
- return Owned(E);
+ return E;
}
/// Note a set of 'operator->' functions that were used for a member access.
@@ -5186,7 +5167,7 @@ Sema::ActOnStartCXXMemberReference(Scope
ObjectType = ParsedType::make(BaseType);
MayBePseudoDestructor = true;
- return Owned(Base);
+ return Base;
}
// C++ [over.match.oper]p8:
@@ -5276,7 +5257,7 @@ Sema::ActOnStartCXXMemberReference(Scope
} else if (!BaseType->isRecordType()) {
ObjectType = ParsedType();
MayBePseudoDestructor = true;
- return Owned(Base);
+ return Base;
}
// The object type must be complete (or dependent), or
@@ -5442,7 +5423,7 @@ ExprResult Sema::BuildPseudoDestructorEx
Destructed);
if (HasTrailingLParen)
- return Owned(Result);
+ return Result;
return DiagnoseDtorReference(Destructed.getLocation(), Result);
}
@@ -5664,8 +5645,8 @@ ExprResult Sema::BuildCXXMemberCallExpr(
ExprResult Sema::BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand,
SourceLocation RParen) {
CanThrowResult CanThrow = canThrow(Operand);
- return Owned(new (Context) CXXNoexceptExpr(Context.BoolTy, Operand,
- CanThrow, KeyLoc, RParen));
+ return new (Context)
+ CXXNoexceptExpr(Context.BoolTy, Operand, CanThrow, KeyLoc, RParen);
}
ExprResult Sema::ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation,
@@ -5733,7 +5714,7 @@ static bool IsSpecialDiscardedValue(Expr
ExprResult Sema::IgnoredValueConversions(Expr *E) {
if (E->hasPlaceholderType()) {
ExprResult result = CheckPlaceholderExpr(E);
- if (result.isInvalid()) return Owned(E);
+ if (result.isInvalid()) return E;
E = result.get();
}
@@ -5749,7 +5730,7 @@ ExprResult Sema::IgnoredValueConversions
if (!getLangOpts().CPlusPlus && E->getType()->isFunctionType())
return DefaultFunctionArrayConversion(E);
- return Owned(E);
+ return E;
}
if (getLangOpts().CPlusPlus) {
@@ -5762,10 +5743,10 @@ ExprResult Sema::IgnoredValueConversions
IsSpecialDiscardedValue(E)) {
ExprResult Res = DefaultLvalueConversion(E);
if (Res.isInvalid())
- return Owned(E);
+ return E;
E = Res.get();
}
- return Owned(E);
+ return E;
}
// GCC seems to also exclude expressions of incomplete enum type.
@@ -5773,19 +5754,19 @@ ExprResult Sema::IgnoredValueConversions
if (!T->getDecl()->isComplete()) {
// FIXME: stupid workaround for a codegen bug!
E = ImpCastExprToType(E, Context.VoidTy, CK_ToVoid).get();
- return Owned(E);
+ return E;
}
}
ExprResult Res = DefaultFunctionArrayLvalueConversion(E);
if (Res.isInvalid())
- return Owned(E);
+ return E;
E = Res.get();
if (!E->getType()->isVoidType())
RequireCompleteType(E->getExprLoc(), E->getType(),
diag::err_incomplete_type);
- return Owned(E);
+ return E;
}
// If we can unambiguously determine whether Var can never be used
@@ -5924,7 +5905,7 @@ ExprResult Sema::ActOnFinishFullExpr(Exp
bool DiscardedValue,
bool IsConstexpr,
bool IsLambdaInitCaptureInitializer) {
- ExprResult FullExpr = Owned(FE);
+ ExprResult FullExpr = FE;
if (!FullExpr.get())
return ExprError();
Modified: cfe/trunk/lib/Sema/SemaExprMember.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprMember.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprMember.cpp Thu May 29 09:05:12 2014
@@ -455,12 +455,10 @@ Sema::ActOnDependentMemberExpr(Expr *Bas
// 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
@@ -683,7 +681,7 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
// Explicit member accesses.
} else {
- ExprResult BaseResult = Owned(Base);
+ ExprResult BaseResult = Base;
ExprResult Result =
LookupMemberExpr(R, BaseResult, IsArrow, OpLoc,
SS, /*ObjCImpDecl*/ nullptr, TemplateArgs != nullptr);
@@ -692,10 +690,8 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
return ExprError();
Base = BaseResult.get();
- if (Result.isInvalid()) {
- Owned(Base);
+ if (Result.isInvalid())
return ExprError();
- }
if (Result.get())
return Result;
@@ -825,7 +821,7 @@ Sema::BuildAnonymousStructUnionMemberRef
fakeFoundDecl, memberNameInfo).get();
}
- return Owned(result);
+ return result;
}
static ExprResult
@@ -996,7 +992,7 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
TemplateKWLoc, MemberNameInfo,
TemplateArgs, R.begin(), R.end());
- return Owned(MemExpr);
+ return MemExpr;
}
assert(R.isSingleResult());
@@ -1033,10 +1029,8 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
}
// 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,
@@ -1054,10 +1048,10 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
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)) {
@@ -1071,21 +1065,18 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
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)
@@ -1219,7 +1210,7 @@ Sema::LookupMemberExpr(LookupResult &R,
// 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.
@@ -1246,9 +1237,8 @@ Sema::LookupMemberExpr(LookupResult &R,
// 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);
@@ -1378,7 +1368,7 @@ Sema::LookupMemberExpr(LookupResult &R,
}
}
- return Owned(Result);
+ return Result;
}
// Objective-C property access.
@@ -1412,12 +1402,9 @@ Sema::LookupMemberExpr(LookupResult &R,
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)) {
@@ -1434,10 +1421,9 @@ Sema::LookupMemberExpr(LookupResult &R,
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
@@ -1489,10 +1475,9 @@ Sema::LookupMemberExpr(LookupResult &R,
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))
@@ -1519,8 +1504,8 @@ Sema::LookupMemberExpr(LookupResult &R,
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
@@ -1635,17 +1620,15 @@ ExprResult Sema::ActOnMemberAccessExpr(S
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
@@ -1725,10 +1708,9 @@ BuildFieldReferenceExpr(Sema &S, Expr *B
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
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Thu May 29 09:05:12 2014
@@ -296,7 +296,7 @@ ExprResult Sema::BuildObjCNumericLiteral
ParamDecl);
ExprResult ConvertedNumber = PerformCopyInitialization(Entity,
SourceLocation(),
- Owned(Number));
+ Number);
if (ConvertedNumber.isInvalid())
return ExprError();
Number = ConvertedNumber.get();
@@ -445,7 +445,7 @@ ExprResult Sema::BuildObjCBoxedExpr(Sour
if (ValueExpr->isTypeDependent()) {
ObjCBoxedExpr *BoxedExpr =
new (Context) ObjCBoxedExpr(ValueExpr, Context.DependentTy, nullptr, SR);
- return Owned(BoxedExpr);
+ return BoxedExpr;
}
ObjCMethodDecl *BoxingMethod = nullptr;
QualType BoxedType;
@@ -586,7 +586,7 @@ ExprResult Sema::BuildObjCBoxedExpr(Sour
ParamDecl);
ExprResult ConvertedValueExpr = PerformCopyInitialization(Entity,
SourceLocation(),
- Owned(ValueExpr));
+ ValueExpr);
if (ConvertedValueExpr.isInvalid())
return ExprError();
ValueExpr = ConvertedValueExpr.get();
@@ -624,13 +624,9 @@ ExprResult Sema::BuildObjCSubscriptExpre
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) {
@@ -1398,7 +1394,7 @@ bool Sema::CheckMessageArgumentTypes(Qua
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
@@ -1583,14 +1579,13 @@ HandleExprPropertyRefExpr(const ObjCObje
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())
@@ -1600,19 +1595,13 @@ HandleExprPropertyRefExpr(const ObjCObje
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.
@@ -1658,16 +1647,13 @@ HandleExprPropertyRefExpr(const ObjCObje
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);
}
@@ -1798,18 +1784,14 @@ ActOnClassPropertyRefExpr(IdentifierInfo
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));
@@ -2103,11 +2085,10 @@ ExprResult Sema::BuildClassMessage(TypeS
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.
@@ -2297,11 +2278,10 @@ ExprResult Sema::BuildInstanceMessage(Ex
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.
@@ -2674,7 +2654,7 @@ ExprResult Sema::BuildInstanceMessage(Ex
// The implicit assignment to self means we also don't want to
// consume the result.
Result->setDelegateInitCall(true);
- return Owned(Result);
+ return Result;
}
}
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu May 29 09:05:12 2014
@@ -894,7 +894,7 @@ void InitListChecker::CheckSubElementTyp
// 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)
@@ -930,8 +930,7 @@ void InitListChecker::CheckSubElementTyp
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;
@@ -1019,15 +1018,14 @@ void InitListChecker::CheckScalarType(co
}
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;
@@ -1082,16 +1080,15 @@ void InitListChecker::CheckReferenceType
}
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;
@@ -1130,16 +1127,15 @@ void InitListChecker::CheckVectorType(co
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())
@@ -2446,7 +2442,7 @@ ExprResult Sema::ActOnDesignatedInitiali
Diag(DIE->getLocStart(), diag::ext_designated_init)
<< DIE->getSourceRange();
- return Owned(DIE);
+ return DIE;
}
//===----------------------------------------------------------------------===//
@@ -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
@@ -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
@@ -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;
@@ -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]) &&
@@ -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"
@@ -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;
}
@@ -5803,7 +5794,7 @@ InitializationSequence::Perform(Sema &S,
MTE->getType().isDestructedType()))
S.ExprNeedsCleanups = true;
- CurInit = S.Owned(MTE);
+ CurInit = MTE;
break;
}
@@ -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)
@@ -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;
}
@@ -5993,7 +5980,7 @@ InitializationSequence::Perform(Sema &S,
CurInit.get();
CurInit = shouldBindAsTemporary(InitEntity)
? S.MaybeBindToTemporary(StructuredInitList)
- : S.Owned(StructuredInitList);
+ : StructuredInitList;
break;
}
@@ -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: {
@@ -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;
}
@@ -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;
}
@@ -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: {
@@ -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.
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Thu May 29 09:05:12 2014
@@ -1156,7 +1156,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
InitializedEntity::InitializeResult(PropertyDiagLoc,
getterMethod->getReturnType(),
/*NRVO=*/false),
- PropertyDiagLoc, Owned(IvarRefExpr));
+ PropertyDiagLoc, IvarRefExpr);
if (!Res.isInvalid()) {
Expr *ResExpr = Res.getAs<Expr>();
if (ResExpr)
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu May 29 09:05:12 2014
@@ -806,8 +806,8 @@ StmtResult Sema::ActOnOpenMPParallelDire
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,
@@ -828,8 +828,7 @@ StmtResult Sema::ActOnOpenMPSimdDirectiv
// 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,
@@ -963,7 +962,7 @@ ExprResult Sema::VerifyPositiveIntegerCo
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())
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu May 29 09:05:12 2014
@@ -61,7 +61,7 @@ CreateFunctionRefExpr(Sema &S, FunctionD
S.MarkDeclRefReferenced(DRE);
- ExprResult E = S.Owned(DRE);
+ ExprResult E = DRE;
E = S.DefaultFunctionArrayConversion(E.get());
if (E.isInvalid())
return ExprError();
@@ -4557,7 +4557,7 @@ TryListConversion(Sema &S, InitListExpr
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.
@@ -4884,7 +4884,7 @@ Sema::PerformObjectArgumentInitializatio
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
@@ -5166,7 +5166,7 @@ diagnoseAmbiguousConversion(Sema &SemaRe
QualType ConvTy = Conv->getConversionType().getNonReferenceType();
Converter.noteAmbiguous(SemaRef, Conv, ConvTy);
}
- return SemaRef.Owned(From);
+ return From;
}
static bool
@@ -5299,7 +5299,7 @@ ExprResult Sema::PerformContextualImplic
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()) {
@@ -5322,7 +5322,7 @@ ExprResult Sema::PerformContextualImplic
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.
@@ -5339,7 +5339,7 @@ ExprResult Sema::PerformContextualImplic
} 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>
@@ -10153,7 +10153,7 @@ bool Sema::ResolveAndFixSingleFunctionTe
// 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) {
@@ -10546,7 +10546,7 @@ bool Sema::buildOverloadedCallSet(Scope
Context.DependentTy, VK_RValue,
RParenLoc);
CE->setTypeDependent(true);
- *Result = Owned(CE);
+ *Result = CE;
return true;
}
return false;
@@ -10713,11 +10713,8 @@ Sema::CreateOverloadedUnaryOp(SourceLoca
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
@@ -10725,10 +10722,9 @@ Sema::CreateOverloadedUnaryOp(SourceLoca
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.
@@ -10892,20 +10888,14 @@ Sema::CreateOverloadedBinOp(SourceLocati
// 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?
@@ -10917,9 +10907,9 @@ Sema::CreateOverloadedBinOp(SourceLocati
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.
@@ -10985,7 +10975,7 @@ Sema::CreateOverloadedBinOp(SourceLocati
PerformCopyInitialization(
InitializedEntity::InitializeParameter(Context,
FnDecl->getParamDecl(0)),
- SourceLocation(), Owned(Args[1]));
+ SourceLocation(), Args[1]);
if (Arg1.isInvalid())
return ExprError();
@@ -11001,7 +10991,7 @@ Sema::CreateOverloadedBinOp(SourceLocati
ExprResult Arg0 = PerformCopyInitialization(
InitializedEntity::InitializeParameter(Context,
FnDecl->getParamDecl(0)),
- SourceLocation(), Owned(Args[0]));
+ SourceLocation(), Args[0]);
if (Arg0.isInvalid())
return ExprError();
@@ -11009,7 +10999,7 @@ Sema::CreateOverloadedBinOp(SourceLocati
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>();
@@ -11168,11 +11158,9 @@ Sema::CreateOverloadedArraySubscriptExpr
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.
@@ -11222,7 +11210,7 @@ Sema::CreateOverloadedArraySubscriptExpr
Context,
FnDecl->getParamDecl(0)),
SourceLocation(),
- Owned(Args[1]));
+ Args[1]);
if (InputInit.isInvalid())
return ExprError();
@@ -11574,7 +11562,7 @@ Sema::BuildCallToObjectOfClassType(Scope
SourceLocation RParenLoc) {
if (checkPlaceholderForOverload(*this, Obj))
return ExprError();
- ExprResult Object = Owned(Obj);
+ ExprResult Object = Obj;
UnbridgedCastsSet UnbridgedCasts;
if (checkArgPlaceholdersForOverload(*this, Args, UnbridgedCasts))
@@ -11728,9 +11716,9 @@ Sema::BuildCallToObjectOfClassType(Scope
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);
}
@@ -12282,7 +12270,7 @@ Expr *Sema::FixOverloadedFunctionReferen
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
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Thu May 29 09:05:12 2014
@@ -49,7 +49,7 @@ StmtResult Sema::ActOnExprStmt(ExprResul
// 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>());
}
@@ -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,
@@ -70,7 +70,7 @@ StmtResult Sema::ActOnDeclStmt(DeclGroup
// 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) {
@@ -344,7 +344,7 @@ StmtResult Sema::ActOnCompoundStmt(Sourc
DiagnoseEmptyLoopBody(Elts[i], Elts[i + 1]);
}
- return Owned(new (Context) CompoundStmt(Context, Elts, L, R));
+ return new (Context) CompoundStmt(Context, Elts, L, R);
}
StmtResult
@@ -384,7 +384,7 @@ Sema::ActOnCaseStmt(SourceLocation CaseL
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.
@@ -402,12 +402,12 @@ Sema::ActOnDefaultStmt(SourceLocation De
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
@@ -417,7 +417,7 @@ Sema::ActOnLabelStmt(SourceLocation Iden
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.
@@ -427,7 +427,7 @@ Sema::ActOnLabelStmt(SourceLocation Iden
TheDecl->setLocStart(IdentLoc);
TheDecl->setLocation(IdentLoc);
}
- return Owned(LS);
+ return LS;
}
StmtResult Sema::ActOnAttributedStmt(SourceLocation AttrLoc,
@@ -435,7 +435,7 @@ StmtResult Sema::ActOnAttributedStmt(Sou
Stmt *SubStmt) {
// Fill in the declaration and return it.
AttributedStmt *LS = AttributedStmt::Create(Context, AttrLoc, Attrs, SubStmt);
- return Owned(LS);
+ return LS;
}
StmtResult
@@ -471,8 +471,8 @@ Sema::ActOnIfStmt(SourceLocation IfLoc,
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
@@ -661,7 +661,7 @@ Sema::ActOnStartOfSwitchStmt(SourceLocat
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) {
@@ -1151,7 +1151,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocati
if (CaseListIsErroneous)
return StmtError();
- return Owned(SS);
+ return SS;
}
void
@@ -1225,8 +1225,8 @@ Sema::ActOnWhileStmt(SourceLocation Whil
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
@@ -1248,7 +1248,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc,
DiagnoseUnusedExprResult(Body);
- return Owned(new (Context) DoStmt(Body, Cond, DoLoc, WhileLoc, CondRParen));
+ return new (Context) DoStmt(Body, Cond, DoLoc, WhileLoc, CondRParen);
}
namespace {
@@ -1632,10 +1632,8 @@ Sema::ActOnForStmt(SourceLocation ForLoc
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:
@@ -1661,7 +1659,7 @@ Sema::CheckObjCForCollectionOperand(Sour
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);
@@ -1723,7 +1721,7 @@ Sema::CheckObjCForCollectionOperand(Sour
}
// Wrap up any cleanups in the expression.
- return Owned(collection);
+ return collection;
}
StmtResult
@@ -1802,9 +1800,8 @@ Sema::ActOnObjCForCollectionStmt(SourceL
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.
@@ -2173,9 +2170,8 @@ Sema::BuildCXXForRangeStmt(SourceLocatio
// 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();
@@ -2332,11 +2328,9 @@ Sema::BuildCXXForRangeStmt(SourceLocatio
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
@@ -2375,7 +2369,7 @@ StmtResult Sema::ActOnGotoStmt(SourceLoc
LabelDecl *TheDecl) {
getCurFunction()->setHasBranchIntoScope();
TheDecl->markUsed(Context);
- return Owned(new (Context) GotoStmt(TheDecl, GotoLoc, LabelLoc));
+ return new (Context) GotoStmt(TheDecl, GotoLoc, LabelLoc);
}
StmtResult
@@ -2385,7 +2379,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocati
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())
@@ -2402,7 +2396,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocati
getCurFunction()->setHasIndirectGoto();
- return Owned(new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E));
+ return new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E);
}
StmtResult
@@ -2413,7 +2407,7 @@ Sema::ActOnContinueStmt(SourceLocation C
return StmtError(Diag(ContinueLoc, diag::err_continue_not_in_loop));
}
- return Owned(new (Context) ContinueStmt(ContinueLoc));
+ return new (Context) ContinueStmt(ContinueLoc);
}
StmtResult
@@ -2424,7 +2418,7 @@ Sema::ActOnBreakStmt(SourceLocation Brea
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
@@ -2725,7 +2719,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLoca
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
@@ -2921,7 +2915,7 @@ StmtResult Sema::BuildReturnStmt(SourceL
D = diag::ext_return_has_void_expr;
}
else {
- ExprResult Result = Owned(RetValExp);
+ ExprResult Result = RetValExp;
Result = IgnoredValueConversions(Result.get());
if (Result.isInvalid())
return StmtError();
@@ -3034,7 +3028,7 @@ StmtResult Sema::BuildReturnStmt(SourceL
if (Result->getNRVOCandidate())
FunctionScopes.back()->Returns.push_back(Result);
- return Owned(Result);
+ return Result;
}
StmtResult
@@ -3045,12 +3039,12 @@ Sema::ActOnObjCAtCatchStmt(SourceLocatio
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
@@ -3061,10 +3055,8 @@ Sema::ActOnObjCAtTryStmt(SourceLocation
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) {
@@ -3089,7 +3081,7 @@ StmtResult Sema::BuildObjCAtThrowStmt(So
}
}
- return Owned(new (Context) ObjCAtThrowStmt(AtLoc, Throw));
+ return new (Context) ObjCAtThrowStmt(AtLoc, Throw);
}
StmtResult
@@ -3136,7 +3128,7 @@ Sema::ActOnObjCAtSynchronizedStmt(Source
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
@@ -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 {
@@ -3247,7 +3238,7 @@ StmtResult Sema::ActOnCXXTryBlock(Source
// 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
@@ -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
@@ -3274,14 +3265,14 @@ Sema::ActOnSEHExceptBlock(SourceLocation
<< 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,
@@ -3474,5 +3465,5 @@ StmtResult Sema::ActOnCapturedRegionEnd(
PopDeclContext();
PopFunctionScopeInfo();
- return Owned(Res);
+ return Res;
}
Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Thu May 29 09:05:12 2014
@@ -364,7 +364,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL
return StmtError();
}
- return Owned(NS);
+ return NS;
}
ExprResult Sema::LookupInlineAsmIdentifier(CXXScopeSpec &SS,
@@ -484,5 +484,5 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLo
/*IsVolatile*/ true, AsmToks, NumOutputs, NumInputs,
Constraints, Exprs, AsmString,
Clobbers, EndLoc);
- return Owned(NS);
+ return NS;
}
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu May 29 09:05:12 2014
@@ -421,15 +421,10 @@ Sema::ActOnDependentIdExpression(const C
// 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);
@@ -440,11 +435,9 @@ Sema::BuildDependentDeclRefExpr(const CX
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
@@ -2869,7 +2862,7 @@ ExprResult Sema::BuildTemplateIdExpr(con
RequiresADL, TemplateArgs,
R.begin(), R.end());
- return Owned(ULE);
+ return ULE;
}
// We actually only call this from template instantiation.
@@ -3452,11 +3445,9 @@ bool Sema::CheckTemplateArgument(NamedDe
// 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.
@@ -4732,7 +4723,7 @@ ExprResult Sema::CheckTemplateArgument(N
if (InstantiatedParamType->isDependentType() || Arg->isTypeDependent()) {
// FIXME: Produce a cloned, canonical expression?
Converted = TemplateArgument(Arg);
- return Owned(Arg);
+ return Arg;
}
// C++ [temp.arg.nontype]p5:
@@ -4776,7 +4767,7 @@ ExprResult Sema::CheckTemplateArgument(N
// 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:
@@ -4878,7 +4869,7 @@ ExprResult Sema::CheckTemplateArgument(N
// 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);
@@ -4932,7 +4923,7 @@ ExprResult Sema::CheckTemplateArgument(N
ParamType->isEnumeralType()
? Context.getCanonicalType(ParamType)
: IntegerType);
- return Owned(Arg);
+ return Arg;
}
QualType ArgType = Arg->getType();
@@ -4980,13 +4971,13 @@ ExprResult Sema::CheckTemplateArgument(N
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()) {
@@ -5001,7 +4992,7 @@ ExprResult Sema::CheckTemplateArgument(N
ParamType,
Arg, Converted))
return ExprError();
- return Owned(Arg);
+ return Arg;
}
if (const ReferenceType *ParamRefType = ParamType->getAs<ReferenceType>()) {
@@ -5032,14 +5023,14 @@ ExprResult Sema::CheckTemplateArgument(N
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)) {
@@ -5055,7 +5046,7 @@ ExprResult Sema::CheckTemplateArgument(N
case NPV_NullPointer:
Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
Converted = TemplateArgument(ParamType, /*isNullPtr*/true);
- return Owned(Arg);
+ return Arg;
}
}
@@ -5066,7 +5057,7 @@ ExprResult Sema::CheckTemplateArgument(N
if (CheckTemplateArgumentPointerToMember(*this, Param, ParamType, Arg,
Converted))
return ExprError();
- return Owned(Arg);
+ return Arg;
}
/// \brief Check a template argument against its corresponding
@@ -5295,7 +5286,7 @@ Sema::BuildExpressionFromIntegralTemplat
Loc, Loc);
}
- return Owned(E);
+ return E;
}
/// \brief Match two template parameters within template parameter lists.
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu May 29 09:05:12 2014
@@ -1084,7 +1084,7 @@ TemplateName TemplateInstantiator::Trans
ExprResult
TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) {
if (!E->isTypeDependent())
- return SemaRef.Owned(E);
+ return E;
return getSema().BuildPredefinedExpr(E->getLocation(), E->getIdentType());
}
@@ -1098,7 +1098,7 @@ TemplateInstantiator::TransformTemplateP
// 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()) {
@@ -1138,7 +1138,7 @@ ExprResult TemplateInstantiator::transfo
// 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 ||
@@ -1186,10 +1186,8 @@ ExprResult TemplateInstantiator::transfo
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
@@ -1197,7 +1195,7 @@ TemplateInstantiator::TransformSubstNonT
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();
@@ -2571,7 +2569,7 @@ Sema::InstantiateClassTemplateSpecializa
StmtResult
Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!S)
- return Owned(S);
+ return S;
TemplateInstantiator Instantiator(*this, TemplateArgs,
SourceLocation(),
@@ -2582,7 +2580,7 @@ Sema::SubstStmt(Stmt *S, const MultiLeve
ExprResult
Sema::SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!E)
- return Owned(E);
+ return E;
TemplateInstantiator Instantiator(*this, TemplateArgs,
SourceLocation(),
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu May 29 09:05:12 2014
@@ -741,7 +741,7 @@ void TemplateDeclInstantiator::Instantia
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,
@@ -753,7 +753,7 @@ void TemplateDeclInstantiator::Instantia
// Drop the initial value and continue.
bool isInvalid = false;
if (Value.isInvalid()) {
- Value = SemaRef.Owned((Expr *)nullptr);
+ Value = nullptr;
isInvalid = true;
}
Modified: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp Thu May 29 09:05:12 2014
@@ -509,8 +509,8 @@ ExprResult Sema::CheckPackExpansion(Expr
}
// 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.
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=209812&r1=209811&r2=209812&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu May 29 09:05:12 2014
@@ -1741,7 +1741,7 @@ public:
Member, MemberNameInfo,
cast<FieldDecl>(Member)->getType(),
VK, OK_Ordinary);
- return getSema().Owned(ME);
+ return ME;
}
CXXScopeSpec SS;
@@ -1872,7 +1872,7 @@ public:
/// any semantic analysis. Subclasses may override this routine to provide
/// different behavior.
ExprResult RebuildImplicitValueInitExpr(QualType T) {
- return SemaRef.Owned(new (SemaRef.Context) ImplicitValueInitExpr(T));
+ return new (SemaRef.Context) ImplicitValueInitExpr(T);
}
/// \brief Build a new \c va_arg expression.
@@ -2137,9 +2137,7 @@ public:
QualType ThisType,
bool isImplicit) {
getSema().CheckCXXThisCapture(ThisLoc);
- return getSema().Owned(
- new (getSema().Context) CXXThisExpr(ThisLoc, ThisType,
- isImplicit));
+ return new (getSema().Context) CXXThisExpr(ThisLoc, ThisType, isImplicit);
}
/// \brief Build a new C++ throw expression.
@@ -2158,8 +2156,7 @@ public:
/// provide different behavior.
ExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc,
ParmVarDecl *Param) {
- return getSema().Owned(CXXDefaultArgExpr::Create(getSema().Context, Loc,
- Param));
+ return CXXDefaultArgExpr::Create(getSema().Context, Loc, Param);
}
/// \brief Build a new C++11 default-initialization expression.
@@ -2169,8 +2166,7 @@ public:
/// routine to provide different behavior.
ExprResult RebuildCXXDefaultInitExpr(SourceLocation Loc,
FieldDecl *Field) {
- return getSema().Owned(CXXDefaultInitExpr::Create(getSema().Context, Loc,
- Field));
+ return CXXDefaultInitExpr::Create(getSema().Context, Loc, Field);
}
/// \brief Build a new C++ zero-initialization expression.
@@ -2459,8 +2455,7 @@ public:
ExprResult RebuildObjCEncodeExpr(SourceLocation AtLoc,
TypeSourceInfo *EncodeTypeInfo,
SourceLocation RParenLoc) {
- return SemaRef.Owned(SemaRef.BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
- RParenLoc));
+ return SemaRef.BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo, RParenLoc);
}
/// \brief Build a new Objective-C class message.
@@ -2502,7 +2497,7 @@ public:
bool IsArrow, bool IsFreeIvar) {
// FIXME: We lose track of the IsFreeIvar bit.
CXXScopeSpec SS;
- ExprResult Base = getSema().Owned(BaseArg);
+ ExprResult Base = BaseArg;
LookupResult R(getSema(), Ivar->getDeclName(), IvarLoc,
Sema::LookupMemberName);
ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
@@ -2531,7 +2526,7 @@ public:
ObjCPropertyDecl *Property,
SourceLocation PropertyLoc) {
CXXScopeSpec SS;
- ExprResult Base = getSema().Owned(BaseArg);
+ ExprResult Base = BaseArg;
LookupResult R(getSema(), Property->getDeclName(), PropertyLoc,
Sema::LookupMemberName);
bool IsArrow = false;
@@ -2575,7 +2570,7 @@ public:
SourceLocation OpLoc,
bool IsArrow) {
CXXScopeSpec SS;
- ExprResult Base = getSema().Owned(BaseArg);
+ ExprResult Base = BaseArg;
LookupResult R(getSema(), &getSema().Context.Idents.get("isa"), IsaLoc,
Sema::LookupMemberName);
ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
@@ -2619,9 +2614,9 @@ public:
CK_BuiltinFnToFnPtr).get();
// Build the CallExpr
- ExprResult TheCall = SemaRef.Owned(new (SemaRef.Context) CallExpr(
+ ExprResult TheCall = new (SemaRef.Context) CallExpr(
SemaRef.Context, Callee, SubExprs, Builtin->getCallResultType(),
- Expr::getValueKindForType(Builtin->getReturnType()), RParenLoc));
+ Expr::getValueKindForType(Builtin->getReturnType()), RParenLoc);
// Type-check the __builtin_shufflevector expression.
return SemaRef.SemaBuiltinShuffleVector(cast<CallExpr>(TheCall.get()));
@@ -2728,7 +2723,7 @@ private:
template<typename Derived>
StmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) {
if (!S)
- return SemaRef.Owned(S);
+ return S;
switch (S->getStmtClass()) {
case Stmt::NoStmtClass: break;
@@ -2754,7 +2749,7 @@ StmtResult TreeTransform<Derived>::Trans
}
}
- return SemaRef.Owned(S);
+ return S;
}
template<typename Derived>
@@ -2778,7 +2773,7 @@ OMPClause *TreeTransform<Derived>::Trans
template<typename Derived>
ExprResult TreeTransform<Derived>::TransformExpr(Expr *E) {
if (!E)
- return SemaRef.Owned(E);
+ return E;
switch (E->getStmtClass()) {
case Stmt::NoStmtClass: break;
@@ -2789,7 +2784,7 @@ ExprResult TreeTransform<Derived>::Trans
#include "clang/AST/StmtNodes.inc"
}
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -2798,7 +2793,7 @@ ExprResult TreeTransform<Derived>::Trans
// Initializers are instantiated like expressions, except that various outer
// layers are stripped.
if (!Init)
- return SemaRef.Owned(Init);
+ return Init;
if (ExprWithCleanups *ExprTemp = dyn_cast<ExprWithCleanups>(Init))
Init = ExprTemp->getSubExpr();
@@ -5313,7 +5308,7 @@ TreeTransform<Derived>::TransformObjCObj
template<typename Derived>
StmtResult
TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
- return SemaRef.Owned(S);
+ return S;
}
template<typename Derived>
@@ -5353,7 +5348,7 @@ TreeTransform<Derived>::TransformCompoun
if (!getDerived().AlwaysRebuild() &&
!SubStmtChanged)
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildCompoundStmt(S->getLBracLoc(),
Statements,
@@ -5500,7 +5495,7 @@ TreeTransform<Derived>::TransformIfStmt(
ConditionVar == S->getConditionVariable() &&
Then.get() == S->getThen() &&
Else.get() == S->getElse())
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildIfStmt(S->getIfLoc(), FullCond, ConditionVar,
Then.get(),
@@ -5611,7 +5606,7 @@ TreeTransform<Derived>::TransformDoStmt(
if (!getDerived().AlwaysRebuild() &&
Cond.get() == S->getCond() &&
Body.get() == S->getBody())
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(),
/*FIXME:*/S->getWhileLoc(), Cond.get(),
@@ -5678,7 +5673,7 @@ TreeTransform<Derived>::TransformForStmt
FullCond.get() == S->getCond() &&
Inc.get() == S->getInc() &&
Body.get() == S->getBody())
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(),
Init.get(), FullCond, ConditionVar,
@@ -5708,7 +5703,7 @@ TreeTransform<Derived>::TransformIndirec
if (!getDerived().AlwaysRebuild() &&
Target.get() == S->getTarget())
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(),
Target.get());
@@ -5717,13 +5712,13 @@ TreeTransform<Derived>::TransformIndirec
template<typename Derived>
StmtResult
TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
- return SemaRef.Owned(S);
+ return S;
}
template<typename Derived>
StmtResult
TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
- return SemaRef.Owned(S);
+ return S;
}
template<typename Derived>
@@ -5755,7 +5750,7 @@ TreeTransform<Derived>::TransformDeclStm
}
if (!getDerived().AlwaysRebuild() && !DeclChanged)
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildDeclStmt(Decls, S->getStartLoc(), S->getEndLoc());
}
@@ -5810,14 +5805,14 @@ TreeTransform<Derived>::TransformGCCAsmS
}
if (!getDerived().AlwaysRebuild() && !ExprsChanged)
- return SemaRef.Owned(S);
+ return S;
// Go through the clobbers.
for (unsigned I = 0, E = S->getNumClobbers(); I != E; ++I)
Clobbers.push_back(S->getClobberStringLiteral(I));
// No need to transform the asm string literal.
- AsmString = SemaRef.Owned(S->getAsmString());
+ AsmString = S->getAsmString();
return getDerived().RebuildGCCAsmStmt(S->getAsmLoc(), S->isSimple(),
S->isVolatile(), S->getNumOutputs(),
S->getNumInputs(), Names.data(),
@@ -5890,7 +5885,7 @@ TreeTransform<Derived>::TransformObjCAtT
TryBody.get() == S->getTryBody() &&
!AnyCatchChanged &&
Finally.get() == S->getFinallyStmt())
- return SemaRef.Owned(S);
+ return S;
// Build a new statement.
return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(),
@@ -5944,7 +5939,7 @@ TreeTransform<Derived>::TransformObjCAtF
// If nothing changed, just retain this statement.
if (!getDerived().AlwaysRebuild() &&
Body.get() == S->getFinallyBody())
- return SemaRef.Owned(S);
+ return S;
// Build a new statement.
return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(),
@@ -5963,7 +5958,7 @@ TreeTransform<Derived>::TransformObjCAtT
if (!getDerived().AlwaysRebuild() &&
Operand.get() == S->getThrowExpr())
- return getSema().Owned(S);
+ return S;
return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(), Operand.get());
}
@@ -5991,7 +5986,7 @@ TreeTransform<Derived>::TransformObjCAtS
if (!getDerived().AlwaysRebuild() &&
Object.get() == S->getSynchExpr() &&
Body.get() == S->getSynchBody())
- return SemaRef.Owned(S);
+ return S;
// Build a new statement.
return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(),
@@ -6010,7 +6005,7 @@ TreeTransform<Derived>::TransformObjCAut
// If nothing changed, just retain this statement.
if (!getDerived().AlwaysRebuild() &&
Body.get() == S->getSubStmt())
- return SemaRef.Owned(S);
+ return S;
// Build a new statement.
return getDerived().RebuildObjCAutoreleasePoolStmt(
@@ -6041,7 +6036,7 @@ TreeTransform<Derived>::TransformObjCFor
Element.get() == S->getElement() &&
Collection.get() == S->getCollection() &&
Body.get() == S->getBody())
- return SemaRef.Owned(S);
+ return S;
// Build a new statement.
return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(),
@@ -6075,7 +6070,7 @@ StmtResult TreeTransform<Derived>::Trans
if (!getDerived().AlwaysRebuild() && !Var &&
Handler.get() == S->getHandlerBlock())
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, Handler.get());
}
@@ -6101,7 +6096,7 @@ StmtResult TreeTransform<Derived>::Trans
if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
!HandlerChanged)
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(),
Handlers);
@@ -6171,7 +6166,7 @@ TreeTransform<Derived>::TransformCXXForR
}
if (NewStmt.get() == S)
- return SemaRef.Owned(S);
+ return S;
return FinishCXXForRangeStmt(NewStmt.get(), Body.get());
}
@@ -6283,7 +6278,7 @@ StmtResult TreeTransform<Derived>::Trans
if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() &&
Handler.get() == S->getHandler())
- return SemaRef.Owned(S);
+ return S;
return getDerived().RebuildSEHTryStmt(S->getIsCXXTry(), S->getTryLoc(),
TryBlock.get(), Handler.get());
@@ -6534,7 +6529,7 @@ TreeTransform<Derived>::TransformOMPCopy
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -6571,7 +6566,7 @@ TreeTransform<Derived>::TransformDeclRef
// FIXME: this is a bit instantiation-specific.
SemaRef.MarkDeclRefReferenced(E);
- return SemaRef.Owned(E);
+ return E;
}
TemplateArgumentListInfo TransArgs, *TemplateArgs = nullptr;
@@ -6592,31 +6587,31 @@ TreeTransform<Derived>::TransformDeclRef
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformStringLiteral(StringLiteral *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -6670,7 +6665,7 @@ TreeTransform<Derived>::TransformParenEx
return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(),
E->getRParen());
@@ -6700,7 +6695,7 @@ TreeTransform<Derived>::TransformUnaryOp
return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildUnaryOperator(E->getOperatorLoc(),
E->getOpcode(),
@@ -6765,7 +6760,7 @@ TreeTransform<Derived>::TransformOffsetO
if (!getDerived().AlwaysRebuild() &&
Type == E->getTypeSourceInfo() &&
!ExprChanged)
- return SemaRef.Owned(E);
+ return E;
// Build a new offsetof expression.
return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(), Type,
@@ -6778,7 +6773,7 @@ ExprResult
TreeTransform<Derived>::TransformOpaqueValueExpr(OpaqueValueExpr *E) {
assert(getDerived().AlreadyTransformed(E->getType()) &&
"opaque value expression requires transformation");
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -6815,7 +6810,7 @@ TreeTransform<Derived>::TransformUnaryEx
return ExprError();
if (!getDerived().AlwaysRebuild() && OldT == NewT)
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildUnaryExprOrTypeTrait(NewT, E->getOperatorLoc(),
E->getKind(),
@@ -6833,7 +6828,7 @@ TreeTransform<Derived>::TransformUnaryEx
return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildUnaryExprOrTypeTrait(SubExpr.get(),
E->getOperatorLoc(),
@@ -6856,7 +6851,7 @@ TreeTransform<Derived>::TransformArraySu
if (!getDerived().AlwaysRebuild() &&
LHS.get() == E->getLHS() &&
RHS.get() == E->getRHS())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildArraySubscriptExpr(LHS.get(),
/*FIXME:*/E->getLHS()->getLocStart(),
@@ -6936,7 +6931,7 @@ TreeTransform<Derived>::TransformMemberE
// FIXME: this is a bit instantiation-specific.
SemaRef.MarkMemberReferenced(E);
- return SemaRef.Owned(E);
+ return E;
}
TemplateArgumentListInfo TransArgs;
@@ -6985,7 +6980,7 @@ TreeTransform<Derived>::TransformBinaryO
if (!getDerived().AlwaysRebuild() &&
LHS.get() == E->getLHS() &&
RHS.get() == E->getRHS())
- return SemaRef.Owned(E);
+ return E;
Sema::FPContractStateRAII FPContractState(getSema());
getSema().FPFeatures.fp_contract = E->isFPContractable();
@@ -7018,7 +7013,7 @@ TransformBinaryConditionalOperator(Binar
if (!getDerived().AlwaysRebuild() &&
commonExpr.get() == e->getCommon() &&
rhs.get() == e->getFalseExpr())
- return SemaRef.Owned(e);
+ return e;
return getDerived().RebuildConditionalOperator(commonExpr.get(),
e->getQuestionLoc(),
@@ -7046,7 +7041,7 @@ TreeTransform<Derived>::TransformConditi
Cond.get() == E->getCond() &&
LHS.get() == E->getLHS() &&
RHS.get() == E->getRHS())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildConditionalOperator(Cond.get(),
E->getQuestionLoc(),
@@ -7078,7 +7073,7 @@ TreeTransform<Derived>::TransformCStyleC
if (!getDerived().AlwaysRebuild() &&
Type == E->getTypeInfoAsWritten() &&
SubExpr.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(),
Type,
@@ -7121,7 +7116,7 @@ TreeTransform<Derived>::TransformExtVect
if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
- return SemaRef.Owned(E);
+ return E;
// FIXME: Bad source location
SourceLocation FakeOperatorLoc =
@@ -7142,7 +7137,7 @@ TreeTransform<Derived>::TransformInitLis
return ExprError();
if (!getDerived().AlwaysRebuild() && !InitChanged)
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildInitList(E->getLBraceLoc(), Inits,
E->getRBraceLoc(), E->getType());
@@ -7209,7 +7204,7 @@ TreeTransform<Derived>::TransformDesigna
if (!getDerived().AlwaysRebuild() &&
Init.get() == E->getInit() &&
!ExprChanged)
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs,
E->getEqualOrColonLoc(),
@@ -7230,7 +7225,7 @@ TreeTransform<Derived>::TransformImplici
if (!getDerived().AlwaysRebuild() &&
T == E->getType())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildImplicitValueInitExpr(T);
}
@@ -7249,7 +7244,7 @@ TreeTransform<Derived>::TransformVAArgEx
if (!getDerived().AlwaysRebuild() &&
TInfo == E->getWrittenTypeInfo() &&
SubExpr.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(),
TInfo, E->getRParenLoc());
@@ -7328,7 +7323,7 @@ TreeTransform<Derived>::TransformChooseE
Cond.get() == E->getCond() &&
LHS.get() == E->getLHS() &&
RHS.get() == E->getRHS())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildChooseExpr(E->getBuiltinLoc(),
Cond.get(), LHS.get(), RHS.get(),
@@ -7338,7 +7333,7 @@ TreeTransform<Derived>::TransformChooseE
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -7480,7 +7475,7 @@ TreeTransform<Derived>::TransformCXXName
if (!getDerived().AlwaysRebuild() &&
Type == E->getTypeInfoAsWritten() &&
SubExpr.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXNamedCastExpr(E->getOperatorLoc(),
E->getStmtClass(),
E->getAngleBrackets().getBegin(),
@@ -7533,7 +7528,7 @@ TreeTransform<Derived>::TransformCXXFunc
if (!getDerived().AlwaysRebuild() &&
Type == E->getTypeInfoAsWritten() &&
SubExpr.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXFunctionalCastExpr(Type,
E->getLParenLoc(),
@@ -7552,7 +7547,7 @@ TreeTransform<Derived>::TransformCXXType
if (!getDerived().AlwaysRebuild() &&
TInfo == E->getTypeOperandSourceInfo())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXTypeidExpr(E->getType(),
E->getLocStart(),
@@ -7573,7 +7568,7 @@ TreeTransform<Derived>::TransformCXXType
if (!getDerived().AlwaysRebuild() &&
SubExpr.get() == E->getExprOperand())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXTypeidExpr(E->getType(),
E->getLocStart(),
@@ -7592,7 +7587,7 @@ TreeTransform<Derived>::TransformCXXUuid
if (!getDerived().AlwaysRebuild() &&
TInfo == E->getTypeOperandSourceInfo())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXUuidofExpr(E->getType(),
E->getLocStart(),
@@ -7608,7 +7603,7 @@ TreeTransform<Derived>::TransformCXXUuid
if (!getDerived().AlwaysRebuild() &&
SubExpr.get() == E->getExprOperand())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXUuidofExpr(E->getType(),
E->getLocStart(),
@@ -7619,14 +7614,14 @@ TreeTransform<Derived>::TransformCXXUuid
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
CXXNullPtrLiteralExpr *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -7637,7 +7632,7 @@ TreeTransform<Derived>::TransformCXXThis
if (!getDerived().AlwaysRebuild() && T == E->getType()) {
// Make sure that we capture 'this'.
getSema().CheckCXXThisCapture(E->getLocStart());
- return SemaRef.Owned(E);
+ return E;
}
return getDerived().RebuildCXXThisExpr(E->getLocStart(), T, E->isImplicit());
@@ -7652,7 +7647,7 @@ TreeTransform<Derived>::TransformCXXThro
if (!getDerived().AlwaysRebuild() &&
SubExpr.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(),
E->isThrownVariableInScope());
@@ -7669,7 +7664,7 @@ TreeTransform<Derived>::TransformCXXDefa
if (!getDerived().AlwaysRebuild() &&
Param == E->getParam())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param);
}
@@ -7684,7 +7679,7 @@ TreeTransform<Derived>::TransformCXXDefa
return ExprError();
if (!getDerived().AlwaysRebuild() && Field == E->getField())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXDefaultInitExpr(E->getExprLoc(), Field);
}
@@ -7699,7 +7694,7 @@ TreeTransform<Derived>::TransformCXXScal
if (!getDerived().AlwaysRebuild() &&
T == E->getTypeSourceInfo())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXScalarValueInitExpr(T,
/*FIXME:*/T->getTypeLoc().getEndLoc(),
@@ -7780,7 +7775,7 @@ TreeTransform<Derived>::TransformCXXNewE
}
}
- return SemaRef.Owned(E);
+ return E;
}
QualType AllocType = AllocTypeInfo->getType();
@@ -7795,16 +7790,14 @@ TreeTransform<Derived>::TransformCXXNewE
// Do nothing
} else if (const ConstantArrayType *ConsArrayT
= dyn_cast<ConstantArrayType>(ArrayT)) {
- ArraySize
- = SemaRef.Owned(IntegerLiteral::Create(SemaRef.Context,
- ConsArrayT->getSize(),
- SemaRef.Context.getSizeType(),
- /*FIXME:*/E->getLocStart()));
+ ArraySize = IntegerLiteral::Create(SemaRef.Context, ConsArrayT->getSize(),
+ SemaRef.Context.getSizeType(),
+ /*FIXME:*/ E->getLocStart());
AllocType = ConsArrayT->getElementType();
} else if (const DependentSizedArrayType *DepArrayT
= dyn_cast<DependentSizedArrayType>(ArrayT)) {
if (DepArrayT->getSizeExpr()) {
- ArraySize = SemaRef.Owned(DepArrayT->getSizeExpr());
+ ArraySize = DepArrayT->getSizeExpr();
AllocType = DepArrayT->getElementType();
}
}
@@ -7858,7 +7851,7 @@ TreeTransform<Derived>::TransformCXXDele
}
}
- return SemaRef.Owned(E);
+ return E;
}
return getDerived().RebuildCXXDeleteExpr(E->getLocStart(),
@@ -8156,7 +8149,7 @@ TreeTransform<Derived>::TransformTypeTra
}
if (!getDerived().AlwaysRebuild() && !ArgChanged)
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildTypeTrait(E->getTrait(),
E->getLocStart(),
@@ -8173,7 +8166,7 @@ TreeTransform<Derived>::TransformArrayTy
if (!getDerived().AlwaysRebuild() &&
T == E->getQueriedTypeSourceInfo())
- return SemaRef.Owned(E);
+ return E;
ExprResult SubExpr;
{
@@ -8183,7 +8176,7 @@ TreeTransform<Derived>::TransformArrayTy
return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getDimensionExpression())
- return SemaRef.Owned(E);
+ return E;
}
return getDerived().RebuildArrayTypeTrait(E->getTrait(),
@@ -8204,7 +8197,7 @@ TreeTransform<Derived>::TransformExpress
return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getQueriedExpression())
- return SemaRef.Owned(E);
+ return E;
}
return getDerived().RebuildExpressionTrait(
@@ -8245,7 +8238,7 @@ TreeTransform<Derived>::TransformDepende
// Note: it is sufficient to compare the Name component of NameInfo:
// if name has not changed, DNLoc has not changed either.
NameInfo.getName() == E->getDeclName())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildDependentScopeDeclRefExpr(QualifierLoc,
TemplateKWLoc,
@@ -8305,7 +8298,7 @@ TreeTransform<Derived>::TransformCXXCons
// Mark the constructor as referenced.
// FIXME: Instantiation-specific
SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor);
- return SemaRef.Owned(E);
+ return E;
}
return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getLocStart(),
@@ -8677,7 +8670,7 @@ TreeTransform<Derived>::TransformCXXUnre
if (!getDerived().AlwaysRebuild() &&
T == E->getTypeSourceInfo() &&
!ArgumentChanged)
- return SemaRef.Owned(E);
+ return E;
// FIXME: we're faking the locations of the commas
return getDerived().RebuildCXXUnresolvedConstructExpr(T,
@@ -8757,7 +8750,7 @@ TreeTransform<Derived>::TransformCXXDepe
QualifierLoc == E->getQualifierLoc() &&
NameInfo.getName() == E->getMember() &&
FirstQualifierInScope == E->getFirstQualifierFoundInScope())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXDependentScopeMemberExpr(Base.get(),
BaseType,
@@ -8898,7 +8891,7 @@ TreeTransform<Derived>::TransformCXXNoex
return ExprError();
if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get());
}
@@ -8911,7 +8904,7 @@ TreeTransform<Derived>::TransformPackExp
return ExprError();
if (!getDerived().AlwaysRebuild() && Pattern.get() == E->getPattern())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildPackExpansion(Pattern.get(), E->getEllipsisLoc(),
E->getNumExpansions());
@@ -8923,7 +8916,7 @@ TreeTransform<Derived>::TransformSizeOfP
// If E is not value-dependent, then nothing will change when we transform it.
// Note: This is an instantiation-centric view.
if (!E->isValueDependent())
- return SemaRef.Owned(E);
+ return E;
// Note: None of the implementations of TryExpandParameterPacks can ever
// produce a diagnostic when given only a single unexpanded parameter pack,
@@ -8939,7 +8932,7 @@ TreeTransform<Derived>::TransformSizeOfP
return ExprError();
if (RetainExpansion)
- return SemaRef.Owned(E);
+ return E;
NamedDecl *Pack = E->getPack();
if (!ShouldExpand) {
@@ -8962,7 +8955,7 @@ ExprResult
TreeTransform<Derived>::TransformSubstNonTypeTemplateParmPackExpr(
SubstNonTypeTemplateParmPackExpr *E) {
// Default behavior is to do nothing with this transformation.
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -8970,14 +8963,14 @@ ExprResult
TreeTransform<Derived>::TransformSubstNonTypeTemplateParmExpr(
SubstNonTypeTemplateParmExpr *E) {
// Default behavior is to do nothing with this transformation.
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformFunctionParmPackExpr(FunctionParmPackExpr *E) {
// Default behavior is to do nothing with this transformation.
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -9003,7 +8996,7 @@ TreeTransform<Derived>::TransformObjCStr
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformObjCBoolLiteralExpr(ObjCBoolLiteralExpr *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -9015,7 +9008,7 @@ TreeTransform<Derived>::TransformObjCBox
if (!getDerived().AlwaysRebuild() &&
SubExpr.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildObjCBoxedExpr(E->getSourceRange(), SubExpr.get());
}
@@ -9170,7 +9163,7 @@ TreeTransform<Derived>::TransformObjCEnc
if (!getDerived().AlwaysRebuild() &&
EncodedTypeInfo == E->getEncodedTypeSourceInfo())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(),
EncodedTypeInfo,
@@ -9202,7 +9195,7 @@ TransformObjCBridgedCastExpr(ObjCBridged
if (!getDerived().AlwaysRebuild() &&
TSInfo == E->getTypeInfoAsWritten() &&
Result.get() == E->getSubExpr())
- return SemaRef.Owned(E);
+ return E;
return SemaRef.BuildObjCBridgedCast(E->getLParenLoc(), E->getBridgeKind(),
E->getBridgeKeywordLoc(), TSInfo,
@@ -9272,13 +9265,13 @@ TreeTransform<Derived>::TransformObjCMes
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *E) {
- return SemaRef.Owned(E);
+ return E;
}
template<typename Derived>
@@ -9294,7 +9287,7 @@ TreeTransform<Derived>::TransformObjCIva
// If nothing changed, just retain the existing expression.
if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildObjCIvarRefExpr(Base.get(), E->getDecl(),
E->getLocation(),
@@ -9307,7 +9300,7 @@ TreeTransform<Derived>::TransformObjCPro
// 'super' and types never change. Property never changes. Just
// retain the existing expression.
if (!E->isObjectReceiver())
- return SemaRef.Owned(E);
+ return E;
// Transform the base expression.
ExprResult Base = getDerived().TransformExpr(E->getBase());
@@ -9319,7 +9312,7 @@ TreeTransform<Derived>::TransformObjCPro
// If nothing changed, just retain the existing expression.
if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
- return SemaRef.Owned(E);
+ return E;
if (E->isExplicitProperty())
return getDerived().RebuildObjCPropertyRefExpr(Base.get(),
@@ -9349,7 +9342,7 @@ TreeTransform<Derived>::TransformObjCSub
// If nothing changed, just retain the existing expression.
if (!getDerived().AlwaysRebuild() &&
Key.get() == E->getKeyExpr() && Base.get() == E->getBaseExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildObjCSubscriptRefExpr(E->getRBracket(),
Base.get(), Key.get(),
@@ -9368,7 +9361,7 @@ TreeTransform<Derived>::TransformObjCIsa
// If nothing changed, just retain the existing expression.
if (!getDerived().AlwaysRebuild() &&
Base.get() == E->getBase())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildObjCIsaExpr(Base.get(), E->getIsaMemberLoc(),
E->getOpLoc(),
@@ -9387,7 +9380,7 @@ TreeTransform<Derived>::TransformShuffle
if (!getDerived().AlwaysRebuild() &&
!ArgumentChanged)
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(),
SubExprs,
@@ -9408,7 +9401,7 @@ TreeTransform<Derived>::TransformConvert
if (!getDerived().AlwaysRebuild() &&
Type == E->getTypeSourceInfo() &&
SrcExpr.get() == E->getSrcExpr())
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildConvertVectorExpr(E->getBuiltinLoc(),
SrcExpr.get(), Type,
@@ -9508,7 +9501,7 @@ TreeTransform<Derived>::TransformAtomicE
if (!getDerived().AlwaysRebuild() &&
!ArgumentChanged)
- return SemaRef.Owned(E);
+ return E;
return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs,
RetTy, E->getOp(), E->getRParenLoc());
More information about the cfe-commits
mailing list