From 3fa5cae9b3812cab9fab6c042c3329bb70a3d046 Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 26 Oct 2010 07:05:15 +0000 Subject: [PATCH] No really, we don't have a retain/release system for statements/expressions anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117357 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Expr.h | 9 -- include/clang/AST/Stmt.h | 27 +--- lib/AST/ASTContext.cpp | 19 +-- lib/Sema/SemaDeclCXX.cpp | 14 +- lib/Sema/SemaExprCXX.cpp | 4 +- lib/Sema/SemaExprObjC.cpp | 4 +- lib/Sema/SemaInit.cpp | 2 +- lib/Sema/SemaOverload.cpp | 14 +- lib/Sema/SemaTemplate.cpp | 6 +- lib/Sema/SemaTemplateDeduction.cpp | 2 +- lib/Sema/SemaTemplateInstantiate.cpp | 6 +- lib/Sema/SemaTemplateInstantiateDecl.cpp | 2 +- lib/Sema/TreeTransform.h | 178 +++++++++++------------ lib/Serialization/ASTReaderStmt.cpp | 3 - 14 files changed, 119 insertions(+), 171 deletions(-) diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 8e552bd9e2..ecfa1307dd 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -77,15 +77,6 @@ protected: explicit Expr(StmtClass SC, EmptyShell) : Stmt(SC) { } public: - /// \brief Increases the reference count for this expression. - /// - /// Invoke the Retain() operation when this expression - /// is being shared by another owner. - Expr *Retain() { - Stmt::Retain(); - return this; - } - QualType getType() const { return TR; } void setType(QualType t) { // In C++, the type of an expression is always adjusted so that it diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index d665d47133..3ea0e9c5be 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -109,9 +109,6 @@ private: /// \brief The statement class. const unsigned sClass : 8; - /// \brief The reference count for this statement. - unsigned RefCount : 24; - // Make vanilla 'new' and 'delete' illegal for Stmts. protected: void* operator new(size_t bytes) throw() { @@ -152,36 +149,17 @@ public: protected: /// \brief Construct an empty statement. - explicit Stmt(StmtClass SC, EmptyShell) : sClass(SC), RefCount(1) { + explicit Stmt(StmtClass SC, EmptyShell) : sClass(SC) { if (Stmt::CollectingStats()) Stmt::addStmtClass(SC); } public: - Stmt(StmtClass SC) : sClass(SC), RefCount(1) { + Stmt(StmtClass SC) : sClass(SC) { if (Stmt::CollectingStats()) Stmt::addStmtClass(SC); } virtual ~Stmt() {} -#ifndef NDEBUG - /// \brief True if this statement's refcount is in a valid state. - /// Should be used only in assertions. - bool isRetained() const { - return (RefCount >= 1); - } -#endif - - /// \brief Increases the reference count for this statement. - /// - /// Invoke the Retain() operation when this statement or expression - /// is being shared by another owner. - Stmt *Retain() { - assert(RefCount >= 1); - ++RefCount; - return this; - } - StmtClass getStmtClass() const { - assert(RefCount >= 1 && "Referencing already-destroyed statement!"); return (StmtClass)sClass; } const char *getStmtClassName() const; @@ -726,7 +704,6 @@ public: } void addSwitchCase(SwitchCase *SC) { assert(!SC->getNextSwitchCase() && "case/default already added to a switch"); - SC->Retain(); SC->setNextSwitchCase(FirstCase); FirstCase = SC; } diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index d7ebedf72a..23e07afcce 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1492,8 +1492,6 @@ QualType ASTContext::getVariableArrayType(QualType EltTy, QualType CanonType; if (!EltTy.isCanonical()) { - if (NumElts) - NumElts->Retain(); CanonType = getVariableArrayType(getCanonicalType(EltTy), NumElts, ASM, EltTypeQuals, Brackets); } @@ -2522,16 +2520,14 @@ CanQualType ASTContext::getCanonicalType(QualType T) { if (DependentSizedArrayType *DSAT = dyn_cast(AT)) return CanQualType::CreateUnsafe( getDependentSizedArrayType(NewEltTy, - DSAT->getSizeExpr() ? - DSAT->getSizeExpr()->Retain() : 0, + DSAT->getSizeExpr(), DSAT->getSizeModifier(), DSAT->getIndexTypeCVRQualifiers(), DSAT->getBracketsRange())->getCanonicalTypeInternal()); VariableArrayType *VAT = cast(AT); return CanQualType::CreateUnsafe(getVariableArrayType(NewEltTy, - VAT->getSizeExpr() ? - VAT->getSizeExpr()->Retain() : 0, + VAT->getSizeExpr(), VAT->getSizeModifier(), VAT->getIndexTypeCVRQualifiers(), VAT->getBracketsRange())); @@ -2561,15 +2557,14 @@ QualType ASTContext::getUnqualifiedArrayType(QualType T, if (const VariableArrayType *VAT = dyn_cast(AT)) { return getVariableArrayType(UnqualElt, - VAT->getSizeExpr() ? - VAT->getSizeExpr()->Retain() : 0, + VAT->getSizeExpr(), VAT->getSizeModifier(), VAT->getIndexTypeCVRQualifiers(), VAT->getBracketsRange()); } const DependentSizedArrayType *DSAT = cast(AT); - return getDependentSizedArrayType(UnqualElt, DSAT->getSizeExpr()->Retain(), + return getDependentSizedArrayType(UnqualElt, DSAT->getSizeExpr(), DSAT->getSizeModifier(), 0, SourceRange()); } @@ -2791,16 +2786,14 @@ const ArrayType *ASTContext::getAsArrayType(QualType T) { = dyn_cast(ATy)) return cast( getDependentSizedArrayType(NewEltTy, - DSAT->getSizeExpr() ? - DSAT->getSizeExpr()->Retain() : 0, + DSAT->getSizeExpr(), DSAT->getSizeModifier(), DSAT->getIndexTypeCVRQualifiers(), DSAT->getBracketsRange())); const VariableArrayType *VAT = cast(ATy); return cast(getVariableArrayType(NewEltTy, - VAT->getSizeExpr() ? - VAT->getSizeExpr()->Retain() : 0, + VAT->getSizeExpr(), VAT->getSizeModifier(), VAT->getIndexTypeCVRQualifiers(), VAT->getBracketsRange())); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index fcd0dcdfea..f1daef0ee7 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1328,10 +1328,6 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args, // 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()) { - // Bump the reference count of all of the arguments. - for (unsigned I = 0; I != NumArgs; ++I) - Args[I]->Retain(); - Expr *Init = new (Context) ParenListExpr(Context, LParenLoc, Args, NumArgs, RParenLoc); return new (Context) CXXBaseOrMemberInitializer(Context, Member, IdLoc, @@ -1461,10 +1457,6 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, // 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()) { - // Bump the reference count of all of the arguments. - for (unsigned I = 0; I != NumArgs; ++I) - Args[I]->Retain(); - ExprResult Init = Owned(new (Context) ParenListExpr(Context, LParenLoc, Args, NumArgs, RParenLoc)); @@ -4646,14 +4638,14 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, llvm::APInt Upper = ArrayTy->getSize(); Upper.zextOrTrunc(S.Context.getTypeSize(SizeType)); Expr *Comparison - = new (S.Context) BinaryOperator(IterationVarRef->Retain(), + = new (S.Context) BinaryOperator(IterationVarRef, IntegerLiteral::Create(S.Context, Upper, SizeType, Loc), BO_NE, S.Context.BoolTy, Loc); // Create the pre-increment of the iteration variable. Expr *Increment - = new (S.Context) UnaryOperator(IterationVarRef->Retain(), + = new (S.Context) UnaryOperator(IterationVarRef, UO_PreInc, SizeType, Loc); @@ -4936,7 +4928,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, // Construct the "from" expression, which is an implicit cast to the // appropriately-qualified base type. - Expr *From = OtherRef->Retain(); + Expr *From = OtherRef; ImpCastExprToType(From, Context.getQualifiedType(BaseType, OtherQuals), CK_UncheckedDerivedToBase, VK_LValue, &BasePath); diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 66470904ca..2e5293d84f 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -879,7 +879,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, for (CXXConstructExpr::arg_iterator A = Construct->arg_begin(), AEnd = Construct->arg_end(); A != AEnd; ++A) - ConvertedConstructorArgs.push_back(A->Retain()); + ConvertedConstructorArgs.push_back(*A); } else { // Take the converted initializer. ConvertedConstructorArgs.push_back(FullInit.release()); @@ -1206,7 +1206,7 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, Context, FnDecl->getParamDecl(i)), SourceLocation(), - Owned(Args[i]->Retain())); + Owned(Args[i])); if (Result.isInvalid()) return true; diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index cd4c364898..5ddf94597b 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -250,9 +250,7 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, InitializedEntity Entity = InitializedEntity::InitializeParameter(Context, Param); - ExprResult ArgE = PerformCopyInitialization(Entity, - SourceLocation(), - Owned(argExpr->Retain())); + ExprResult ArgE = PerformCopyInitialization(Entity, lbrac, Owned(argExpr)); if (ArgE.isInvalid()) IsError = true; else diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index fb482bf56a..3818349901 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -3569,7 +3569,7 @@ InitializationSequence::Perform(Sema &S, case SK_StringInit: case SK_ObjCObjectConversion: assert(Args.size() == 1); - CurInit = ExprResult(((Expr **)(Args.get()))[0]->Retain()); + CurInit = ExprResult(Args.get()[0]); if (CurInit.isInvalid()) return ExprError(); break; diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 8f653d1df0..a0251899a5 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -7839,7 +7839,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, Expr *SubExpr = FixOverloadedFunctionReference(PE->getSubExpr(), Found, Fn); if (SubExpr == PE->getSubExpr()) - return PE->Retain(); + return PE; return new (Context) ParenExpr(PE->getLParen(), PE->getRParen(), SubExpr); } @@ -7852,7 +7852,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, "Implicit cast type cannot be determined from overload"); assert(ICE->path_empty() && "fixing up hierarchy conversion?"); if (SubExpr == ICE->getSubExpr()) - return ICE->Retain(); + return ICE; return ImplicitCastExpr::Create(Context, ICE->getType(), ICE->getCastKind(), @@ -7874,7 +7874,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, Expr *SubExpr = FixOverloadedFunctionReference(UnOp->getSubExpr(), Found, Fn); if (SubExpr == UnOp->getSubExpr()) - return UnOp->Retain(); + return UnOp; assert(isa(SubExpr) && "fixed to something other than a decl ref"); @@ -7896,7 +7896,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, Expr *SubExpr = FixOverloadedFunctionReference(UnOp->getSubExpr(), Found, Fn); if (SubExpr == UnOp->getSubExpr()) - return UnOp->Retain(); + return UnOp; return new (Context) UnaryOperator(SubExpr, UO_AddrOf, Context.getPointerType(SubExpr->getType()), @@ -7949,7 +7949,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, /*isImplicit=*/true); } } else - Base = MemExpr->getBase()->Retain(); + Base = MemExpr->getBase(); return MemberExpr::Create(Context, Base, MemExpr->isArrow(), @@ -7962,8 +7962,8 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, Fn->getType()); } - assert(false && "Invalid reference to overloaded function"); - return E->Retain(); + llvm_unreachable("Invalid reference to overloaded function"); + return E; } ExprResult Sema::FixOverloadedFunctionReference(ExprResult E, diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 95b2223658..49ae0d202a 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -2729,7 +2729,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S, // Stop checking the precise nature of the argument if it is value dependent, // it should be checked when instantiated. if (Arg->isValueDependent()) { - Converted = TemplateArgument(ArgIn->Retain()); + Converted = TemplateArgument(ArgIn); return false; } @@ -2974,7 +2974,7 @@ bool Sema::CheckTemplateArgumentPointerToMember(Expr *Arg, (isa(VD) && Context.getCanonicalType(VD->getType()).isConstQualified())) { if (Arg->isTypeDependent() || Arg->isValueDependent()) - Converted = TemplateArgument(Arg->Retain()); + Converted = TemplateArgument(Arg); else Converted = TemplateArgument(VD->getCanonicalDecl()); return Invalid; @@ -2998,7 +2998,7 @@ bool Sema::CheckTemplateArgumentPointerToMember(Expr *Arg, // Okay: this is the address of a non-static member, and therefore // a member pointer constant. if (Arg->isTypeDependent() || Arg->isValueDependent()) - Converted = TemplateArgument(Arg->Retain()); + Converted = TemplateArgument(Arg); else Converted = TemplateArgument(DRE->getDecl()->getCanonicalDecl()); return Invalid; diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index ae9052b704..855516cf10 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -151,7 +151,7 @@ DeduceNonTypeTemplateArgument(Sema &S, "Expression template argument must be type- or value-dependent."); if (Deduced[NTTP->getIndex()].isNull()) { - Deduced[NTTP->getIndex()] = TemplateArgument(Value->Retain()); + Deduced[NTTP->getIndex()] = TemplateArgument(Value); return Sema::TDK_Success; } diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 3230e02e54..71235d9285 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -776,7 +776,7 @@ TemplateInstantiator::RebuildElaboratedType(ElaboratedTypeKeyword Keyword, ExprResult TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) { if (!E->isTypeDependent()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); FunctionDecl *currentDecl = getSema().getCurFunctionDecl(); assert(currentDecl && "Must have current function declaration when " @@ -804,7 +804,7 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E, // arguments left unspecified. if (!TemplateArgs.hasTemplateArgument(NTTP->getDepth(), NTTP->getPosition())) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); const TemplateArgument &Arg = TemplateArgs(NTTP->getDepth(), NTTP->getPosition()); @@ -812,7 +812,7 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E, // The template argument itself might be an expression, in which // case we just return that expression. if (Arg.getKind() == TemplateArgument::Expression) - return SemaRef.Owned(Arg.getAsExpr()->Retain()); + return SemaRef.Owned(Arg.getAsExpr()); if (Arg.getKind() == TemplateArgument::Declaration) { ValueDecl *VD = cast(Arg.getAsDecl()); diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 6a713d7926..1dbdefca9f 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -586,7 +586,7 @@ Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) { return 0; ExprResult Message(D->getMessage()); - D->getMessage()->Retain(); + D->getMessage(); return SemaRef.ActOnStaticAssertDeclaration(D->getLocation(), InstantiatedAssertExpr.get(), Message.get()); diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 9dd6bd3456..d318bc6e5c 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -2007,7 +2007,7 @@ StmtResult TreeTransform::TransformStmt(Stmt *S) { } } - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); } @@ -2025,7 +2025,7 @@ ExprResult TreeTransform::TransformExpr(Expr *E) { #include "clang/AST/StmtNodes.inc" } - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template @@ -3483,7 +3483,7 @@ TreeTransform::TransformObjCObjectPointerType(TypeLocBuilder &TLB, template StmtResult TreeTransform::TransformNullStmt(NullStmt *S) { - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); } template @@ -3522,7 +3522,7 @@ TreeTransform::TransformCompoundStmt(CompoundStmt *S, if (!getDerived().AlwaysRebuild() && !SubStmtChanged) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); return getDerived().RebuildCompoundStmt(S->getLBracLoc(), move_arg(Statements), @@ -3646,7 +3646,7 @@ TreeTransform::TransformIfStmt(IfStmt *S) { ConditionVar == S->getConditionVariable() && Then.get() == S->getThen() && Else.get() == S->getElse()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); return getDerived().RebuildIfStmt(S->getIfLoc(), FullCond, ConditionVar, Then.get(), @@ -3757,7 +3757,7 @@ TreeTransform::TransformDoStmt(DoStmt *S) { if (!getDerived().AlwaysRebuild() && Cond.get() == S->getCond() && Body.get() == S->getBody()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); return getDerived().RebuildDoStmt(S->getDoLoc(), Body.get(), S->getWhileLoc(), /*FIXME:*/S->getWhileLoc(), Cond.get(), @@ -3824,7 +3824,7 @@ TreeTransform::TransformForStmt(ForStmt *S) { FullCond.get() == S->getCond() && Inc.get() == S->getInc() && Body.get() == S->getBody()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); return getDerived().RebuildForStmt(S->getForLoc(), S->getLParenLoc(), Init.get(), FullCond, ConditionVar, @@ -3848,7 +3848,7 @@ TreeTransform::TransformIndirectGotoStmt(IndirectGotoStmt *S) { if (!getDerived().AlwaysRebuild() && Target.get() == S->getTarget()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); return getDerived().RebuildIndirectGotoStmt(S->getGotoLoc(), S->getStarLoc(), Target.get()); @@ -3857,13 +3857,13 @@ TreeTransform::TransformIndirectGotoStmt(IndirectGotoStmt *S) { template StmtResult TreeTransform::TransformContinueStmt(ContinueStmt *S) { - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); } template StmtResult TreeTransform::TransformBreakStmt(BreakStmt *S) { - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); } template @@ -3897,7 +3897,7 @@ TreeTransform::TransformDeclStmt(DeclStmt *S) { } if (!getDerived().AlwaysRebuild() && !DeclChanged) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); return getDerived().RebuildDeclStmt(Decls.data(), Decls.size(), S->getStartLoc(), S->getEndLoc()); @@ -3907,7 +3907,7 @@ template StmtResult TreeTransform::TransformSwitchCase(SwitchCase *S) { assert(false && "SwitchCase is abstract and cannot be transformed"); - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); } template @@ -3928,7 +3928,7 @@ TreeTransform::TransformAsmStmt(AsmStmt *S) { Names.push_back(S->getOutputIdentifier(I)); // No need to transform the constraint literal. - Constraints.push_back(S->getOutputConstraintLiteral(I)->Retain()); + Constraints.push_back(S->getOutputConstraintLiteral(I)); // Transform the output expr. Expr *OutputExpr = S->getOutputExpr(I); @@ -3946,7 +3946,7 @@ TreeTransform::TransformAsmStmt(AsmStmt *S) { Names.push_back(S->getInputIdentifier(I)); // No need to transform the constraint literal. - Constraints.push_back(S->getInputConstraintLiteral(I)->Retain()); + Constraints.push_back(S->getInputConstraintLiteral(I)); // Transform the input expr. Expr *InputExpr = S->getInputExpr(I); @@ -3960,11 +3960,11 @@ TreeTransform::TransformAsmStmt(AsmStmt *S) { } if (!getDerived().AlwaysRebuild() && !ExprsChanged) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); // Go through the clobbers. for (unsigned I = 0, E = S->getNumClobbers(); I != E; ++I) - Clobbers.push_back(S->getClobber(I)->Retain()); + Clobbers.push_back(S->getClobber(I)); // No need to transform the asm string literal. AsmString = SemaRef.Owned(S->getAsmString()); @@ -4017,7 +4017,7 @@ TreeTransform::TransformObjCAtTryStmt(ObjCAtTryStmt *S) { TryBody.get() == S->getTryBody() && !AnyCatchChanged && Finally.get() == S->getFinallyStmt()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); // Build a new statement. return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(), @@ -4071,7 +4071,7 @@ TreeTransform::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { // If nothing changed, just retain this statement. if (!getDerived().AlwaysRebuild() && Body.get() == S->getFinallyBody()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); // Build a new statement. return getDerived().RebuildObjCAtFinallyStmt(S->getAtFinallyLoc(), @@ -4090,7 +4090,7 @@ TreeTransform::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) { if (!getDerived().AlwaysRebuild() && Operand.get() == S->getThrowExpr()) - return getSema().Owned(S->Retain()); + return getSema().Owned(S); return getDerived().RebuildObjCAtThrowStmt(S->getThrowLoc(), Operand.get()); } @@ -4113,7 +4113,7 @@ TreeTransform::TransformObjCAtSynchronizedStmt( if (!getDerived().AlwaysRebuild() && Object.get() == S->getSynchExpr() && Body.get() == S->getSynchBody()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); // Build a new statement. return getDerived().RebuildObjCAtSynchronizedStmt(S->getAtSynchronizedLoc(), @@ -4144,7 +4144,7 @@ TreeTransform::TransformObjCForCollectionStmt( Element.get() == S->getElement() && Collection.get() == S->getCollection() && Body.get() == S->getBody()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); // Build a new statement. return getDerived().RebuildObjCForCollectionStmt(S->getForLoc(), @@ -4183,7 +4183,7 @@ TreeTransform::TransformCXXCatchStmt(CXXCatchStmt *S) { if (!getDerived().AlwaysRebuild() && !Var && Handler.get() == S->getHandlerBlock()) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); return getDerived().RebuildCXXCatchStmt(S->getCatchLoc(), Var, @@ -4215,7 +4215,7 @@ TreeTransform::TransformCXXTryStmt(CXXTryStmt *S) { if (!getDerived().AlwaysRebuild() && TryBlock.get() == S->getTryBlock() && !HandlerChanged) - return SemaRef.Owned(S->Retain()); + return SemaRef.Owned(S); return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(), move_arg(Handlers)); @@ -4227,7 +4227,7 @@ TreeTransform::TransformCXXTryStmt(CXXTryStmt *S) { template ExprResult TreeTransform::TransformPredefinedExpr(PredefinedExpr *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template @@ -4264,7 +4264,7 @@ TreeTransform::TransformDeclRefExpr(DeclRefExpr *E) { // FIXME: this is a bit instantiation-specific. SemaRef.MarkDeclarationReferenced(E->getLocation(), ND); - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } TemplateArgumentListInfo TransArgs, *TemplateArgs = 0; @@ -4287,31 +4287,31 @@ TreeTransform::TransformDeclRefExpr(DeclRefExpr *E) { template ExprResult TreeTransform::TransformIntegerLiteral(IntegerLiteral *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template ExprResult TreeTransform::TransformFloatingLiteral(FloatingLiteral *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template ExprResult TreeTransform::TransformImaginaryLiteral(ImaginaryLiteral *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template ExprResult TreeTransform::TransformStringLiteral(StringLiteral *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template ExprResult TreeTransform::TransformCharacterLiteral(CharacterLiteral *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template @@ -4322,7 +4322,7 @@ TreeTransform::TransformParenExpr(ParenExpr *E) { return ExprError(); if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildParenExpr(SubExpr.get(), E->getLParen(), E->getRParen()); @@ -4336,7 +4336,7 @@ TreeTransform::TransformUnaryOperator(UnaryOperator *E) { return ExprError(); if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildUnaryOperator(E->getOperatorLoc(), E->getOpcode(), @@ -4401,7 +4401,7 @@ TreeTransform::TransformOffsetOfExpr(OffsetOfExpr *E) { if (!getDerived().AlwaysRebuild() && Type == E->getTypeSourceInfo() && !ExprChanged) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // Build a new offsetof expression. return getDerived().RebuildOffsetOfExpr(E->getOperatorLoc(), Type, @@ -4420,7 +4420,7 @@ TreeTransform::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { return ExprError(); if (!getDerived().AlwaysRebuild() && OldT == NewT) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildSizeOfAlignOf(NewT, E->getOperatorLoc(), E->isSizeOf(), @@ -4439,7 +4439,7 @@ TreeTransform::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { return ExprError(); if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getArgumentExpr()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } return getDerived().RebuildSizeOfAlignOf(SubExpr.get(), E->getOperatorLoc(), @@ -4462,7 +4462,7 @@ TreeTransform::TransformArraySubscriptExpr(ArraySubscriptExpr *E) { if (!getDerived().AlwaysRebuild() && LHS.get() == E->getLHS() && RHS.get() == E->getRHS()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildArraySubscriptExpr(LHS.get(), /*FIXME:*/E->getLHS()->getLocStart(), @@ -4493,7 +4493,7 @@ TreeTransform::TransformCallExpr(CallExpr *E) { if (!getDerived().AlwaysRebuild() && Callee.get() == E->getCallee() && !ArgChanged) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // FIXME: Wrong source location information for the '('. SourceLocation FakeLParenLoc @@ -4545,7 +4545,7 @@ TreeTransform::TransformMemberExpr(MemberExpr *E) { // Mark it referenced in the new context regardless. // FIXME: this is a bit instantiation-specific. SemaRef.MarkDeclarationReferenced(E->getMemberLoc(), Member); - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } TemplateArgumentListInfo TransArgs; @@ -4596,7 +4596,7 @@ TreeTransform::TransformBinaryOperator(BinaryOperator *E) { if (!getDerived().AlwaysRebuild() && LHS.get() == E->getLHS() && RHS.get() == E->getRHS()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildBinaryOperator(E->getOperatorLoc(), E->getOpcode(), LHS.get(), RHS.get()); @@ -4628,7 +4628,7 @@ TreeTransform::TransformConditionalOperator(ConditionalOperator *E) { Cond.get() == E->getCond() && LHS.get() == E->getLHS() && RHS.get() == E->getRHS()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildConditionalOperator(Cond.get(), E->getQuestionLoc(), @@ -4660,7 +4660,7 @@ TreeTransform::TransformCStyleCastExpr(CStyleCastExpr *E) { if (!getDerived().AlwaysRebuild() && Type == E->getTypeInfoAsWritten() && SubExpr.get() == E->getSubExpr()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCStyleCastExpr(E->getLParenLoc(), Type, @@ -4683,7 +4683,7 @@ TreeTransform::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) { if (!getDerived().AlwaysRebuild() && OldT == NewT && Init.get() == E->getInitializer()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // Note: the expression type doesn't necessarily match the // type-as-written, but that's okay, because it should always be @@ -4703,7 +4703,7 @@ TreeTransform::TransformExtVectorElementExpr(ExtVectorElementExpr *E) { if (!getDerived().AlwaysRebuild() && Base.get() == E->getBase()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // FIXME: Bad source location SourceLocation FakeOperatorLoc @@ -4729,7 +4729,7 @@ TreeTransform::TransformInitListExpr(InitListExpr *E) { } if (!getDerived().AlwaysRebuild() && !InitChanged) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildInitList(E->getLBraceLoc(), move_arg(Inits), E->getRBraceLoc(), E->getType()); @@ -4796,7 +4796,7 @@ TreeTransform::TransformDesignatedInitExpr(DesignatedInitExpr *E) { if (!getDerived().AlwaysRebuild() && Init.get() == E->getInit() && !ExprChanged) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildDesignatedInitExpr(Desig, move_arg(ArrayExprs), E->getEqualOrColonLoc(), @@ -4817,7 +4817,7 @@ TreeTransform::TransformImplicitValueInitExpr( if (!getDerived().AlwaysRebuild() && T == E->getType()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildImplicitValueInitExpr(T); } @@ -4836,7 +4836,7 @@ TreeTransform::TransformVAArgExpr(VAArgExpr *E) { if (!getDerived().AlwaysRebuild() && TInfo == E->getWrittenTypeInfo() && SubExpr.get() == E->getSubExpr()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildVAArgExpr(E->getBuiltinLoc(), SubExpr.get(), TInfo, E->getRParenLoc()); @@ -4883,7 +4883,7 @@ TreeTransform::TransformStmtExpr(StmtExpr *E) { if (!getDerived().AlwaysRebuild() && SubStmt.get() == E->getSubStmt()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildStmtExpr(E->getLParenLoc(), SubStmt.get(), @@ -4907,7 +4907,7 @@ TreeTransform::TransformTypesCompatibleExpr(TypesCompatibleExpr *E) { if (!getDerived().AlwaysRebuild() && TInfo1 == E->getArgTInfo1() && TInfo2 == E->getArgTInfo2()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildTypesCompatibleExpr(E->getBuiltinLoc(), TInfo1, TInfo2, @@ -4933,7 +4933,7 @@ TreeTransform::TransformChooseExpr(ChooseExpr *E) { Cond.get() == E->getCond() && LHS.get() == E->getLHS() && RHS.get() == E->getRHS()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildChooseExpr(E->getBuiltinLoc(), Cond.get(), LHS.get(), RHS.get(), @@ -4943,7 +4943,7 @@ TreeTransform::TransformChooseExpr(ChooseExpr *E) { template ExprResult TreeTransform::TransformGNUNullExpr(GNUNullExpr *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template @@ -5026,7 +5026,7 @@ TreeTransform::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) { Callee.get() == E->getCallee() && First.get() == E->getArg(0) && (E->getNumArgs() != 2 || Second.get() == E->getArg(1))) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXOperatorCallExpr(E->getOperator(), E->getOperatorLoc(), @@ -5056,7 +5056,7 @@ TreeTransform::TransformCXXNamedCastExpr(CXXNamedCastExpr *E) { if (!getDerived().AlwaysRebuild() && Type == E->getTypeInfoAsWritten() && SubExpr.get() == E->getSubExpr()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // FIXME: Poor source location information here. SourceLocation FakeLAngleLoc @@ -5116,7 +5116,7 @@ TreeTransform::TransformCXXFunctionalCastExpr( if (!getDerived().AlwaysRebuild() && Type == E->getTypeInfoAsWritten() && SubExpr.get() == E->getSubExpr()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXFunctionalCastExpr(Type, /*FIXME:*/E->getSubExpr()->getLocStart(), @@ -5135,7 +5135,7 @@ TreeTransform::TransformCXXTypeidExpr(CXXTypeidExpr *E) { if (!getDerived().AlwaysRebuild() && TInfo == E->getTypeOperandSourceInfo()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getLocStart(), @@ -5155,7 +5155,7 @@ TreeTransform::TransformCXXTypeidExpr(CXXTypeidExpr *E) { if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getExprOperand()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getLocStart(), @@ -5174,7 +5174,7 @@ TreeTransform::TransformCXXUuidofExpr(CXXUuidofExpr *E) { if (!getDerived().AlwaysRebuild() && TInfo == E->getTypeOperandSourceInfo()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getLocStart(), @@ -5193,7 +5193,7 @@ TreeTransform::TransformCXXUuidofExpr(CXXUuidofExpr *E) { if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getExprOperand()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getLocStart(), @@ -5204,14 +5204,14 @@ TreeTransform::TransformCXXUuidofExpr(CXXUuidofExpr *E) { template ExprResult TreeTransform::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template ExprResult TreeTransform::TransformCXXNullPtrLiteralExpr( CXXNullPtrLiteralExpr *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template @@ -5222,7 +5222,7 @@ TreeTransform::TransformCXXThisExpr(CXXThisExpr *E) { QualType T = MD->getThisType(getSema().Context); if (!getDerived().AlwaysRebuild() && T == E->getType()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXThisExpr(E->getLocStart(), T, E->isImplicit()); } @@ -5236,7 +5236,7 @@ TreeTransform::TransformCXXThrowExpr(CXXThrowExpr *E) { if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getSubExpr()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get()); } @@ -5252,7 +5252,7 @@ TreeTransform::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) { if (!getDerived().AlwaysRebuild() && Param == E->getParam()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXDefaultArgExpr(E->getUsedLocation(), Param); } @@ -5267,7 +5267,7 @@ TreeTransform::TransformCXXScalarValueInitExpr( if (!getDerived().AlwaysRebuild() && T == E->getTypeSourceInfo()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXScalarValueInitExpr(T, /*FIXME:*/T->getTypeLoc().getEndLoc(), @@ -5364,7 +5364,7 @@ TreeTransform::TransformCXXNewExpr(CXXNewExpr *E) { SemaRef.MarkDeclarationReferenced(E->getLocStart(), OperatorNew); if (OperatorDelete) SemaRef.MarkDeclarationReferenced(E->getLocStart(), OperatorDelete); - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } QualType AllocType = AllocTypeInfo->getType(); @@ -5388,7 +5388,7 @@ TreeTransform::TransformCXXNewExpr(CXXNewExpr *E) { } else if (const DependentSizedArrayType *DepArrayT = dyn_cast(ArrayT)) { if (DepArrayT->getSizeExpr()) { - ArraySize = SemaRef.Owned(DepArrayT->getSizeExpr()->Retain()); + ArraySize = SemaRef.Owned(DepArrayT->getSizeExpr()); AllocType = DepArrayT->getElementType(); } } @@ -5443,7 +5443,7 @@ TreeTransform::TransformCXXDeleteExpr(CXXDeleteExpr *E) { } } - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } return getDerived().RebuildCXXDeleteExpr(E->getLocStart(), @@ -5622,7 +5622,7 @@ TreeTransform::TransformUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) { if (!getDerived().AlwaysRebuild() && T == E->getQueriedTypeSourceInfo()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildUnaryTypeTrait(E->getTrait(), E->getLocStart(), @@ -5651,7 +5651,7 @@ TreeTransform::TransformDependentScopeDeclRefExpr( // 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->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildDependentScopeDeclRefExpr(NNS, E->getQualifierRange(), @@ -5720,7 +5720,7 @@ TreeTransform::TransformCXXConstructExpr(CXXConstructExpr *E) { // Mark the constructor as referenced. // FIXME: Instantiation-specific SemaRef.MarkDeclarationReferenced(E->getLocStart(), Constructor); - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getLocStart(), @@ -5793,7 +5793,7 @@ TreeTransform::TransformCXXTemporaryObjectExpr( !ArgumentChanged) { // FIXME: Instantiation-specific SemaRef.MarkDeclarationReferenced(E->getLocStart(), Constructor); - return SemaRef.MaybeBindToTemporary(E->Retain()); + return SemaRef.MaybeBindToTemporary(E); } return getDerived().RebuildCXXTemporaryObjectExpr(T, @@ -5826,7 +5826,7 @@ TreeTransform::TransformCXXUnresolvedConstructExpr( if (!getDerived().AlwaysRebuild() && T == E->getTypeSourceInfo() && !ArgumentChanged) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // FIXME: we're faking the locations of the commas return getDerived().RebuildCXXUnresolvedConstructExpr(T, @@ -5901,7 +5901,7 @@ TreeTransform::TransformCXXDependentScopeMemberExpr( Qualifier == E->getQualifier() && NameInfo.getName() == E->getMember() && FirstQualifierInScope == E->getFirstQualifierFoundInScope()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXDependentScopeMemberExpr(Base.get(), BaseType, @@ -6040,7 +6040,7 @@ TreeTransform::TransformCXXNoexceptExpr(CXXNoexceptExpr *E) { return ExprError(); if (!getDerived().AlwaysRebuild() && SubExpr.get() == E->getOperand()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildCXXNoexceptExpr(E->getSourceRange(),SubExpr.get()); } @@ -6048,7 +6048,7 @@ TreeTransform::TransformCXXNoexceptExpr(CXXNoexceptExpr *E) { template ExprResult TreeTransform::TransformObjCStringLiteral(ObjCStringLiteral *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template @@ -6061,7 +6061,7 @@ TreeTransform::TransformObjCEncodeExpr(ObjCEncodeExpr *E) { if (!getDerived().AlwaysRebuild() && EncodedTypeInfo == E->getEncodedTypeSourceInfo()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildObjCEncodeExpr(E->getAtLoc(), EncodedTypeInfo, @@ -6093,7 +6093,7 @@ TreeTransform::TransformObjCMessageExpr(ObjCMessageExpr *E) { // If nothing changed, just retain the existing message send. if (!getDerived().AlwaysRebuild() && ReceiverTypeInfo == E->getClassReceiverTypeInfo() && !ArgChanged) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // Build a new class message send. return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo, @@ -6115,7 +6115,7 @@ TreeTransform::TransformObjCMessageExpr(ObjCMessageExpr *E) { // If nothing changed, just retain the existing message send. if (!getDerived().AlwaysRebuild() && Receiver.get() == E->getInstanceReceiver() && !ArgChanged) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // Build a new instance message send. return getDerived().RebuildObjCMessageExpr(Receiver.get(), @@ -6129,13 +6129,13 @@ TreeTransform::TransformObjCMessageExpr(ObjCMessageExpr *E) { template ExprResult TreeTransform::TransformObjCSelectorExpr(ObjCSelectorExpr *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template ExprResult TreeTransform::TransformObjCProtocolExpr(ObjCProtocolExpr *E) { - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } template @@ -6151,7 +6151,7 @@ TreeTransform::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) { // If nothing changed, just retain the existing expression. if (!getDerived().AlwaysRebuild() && Base.get() == E->getBase()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildObjCIvarRefExpr(Base.get(), E->getDecl(), E->getLocation(), @@ -6164,7 +6164,7 @@ TreeTransform::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { // 'super' never changes. Property never changes. Just retain the existing // expression. if (E->isSuperReceiver()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // Transform the base expression. ExprResult Base = getDerived().TransformExpr(E->getBase()); @@ -6176,7 +6176,7 @@ TreeTransform::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { // If nothing changed, just retain the existing expression. if (!getDerived().AlwaysRebuild() && Base.get() == E->getBase()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildObjCPropertyRefExpr(Base.get(), E->getProperty(), E->getLocation()); @@ -6189,12 +6189,12 @@ TreeTransform::TransformObjCImplicitSetterGetterRefExpr( // If this implicit setter/getter refers to super, it cannot have any // dependent parts. Just retain the existing declaration. if (E->isSuperReceiver()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // If this implicit setter/getter refers to class methods, it cannot have any // dependent parts. Just retain the existing declaration. if (E->getInterfaceDecl()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); // Transform the base expression. ExprResult Base = getDerived().TransformExpr(E->getBase()); @@ -6206,7 +6206,7 @@ TreeTransform::TransformObjCImplicitSetterGetterRefExpr( // If nothing changed, just retain the existing expression. if (!getDerived().AlwaysRebuild() && Base.get() == E->getBase()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildObjCImplicitSetterGetterRefExpr( E->getGetterMethod(), @@ -6231,7 +6231,7 @@ TreeTransform::TransformObjCIsaExpr(ObjCIsaExpr *E) { // If nothing changed, just retain the existing expression. if (!getDerived().AlwaysRebuild() && Base.get() == E->getBase()) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildObjCIsaExpr(Base.get(), E->getIsaMemberLoc(), E->isArrow()); @@ -6253,7 +6253,7 @@ TreeTransform::TransformShuffleVectorExpr(ShuffleVectorExpr *E) { if (!getDerived().AlwaysRebuild() && !ArgumentChanged) - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(), move_arg(SubExprs), @@ -6328,7 +6328,7 @@ TreeTransform::TransformBlockDeclRefExpr(BlockDeclRefExpr *E) { // FIXME: this is a bit instantiation-specific. SemaRef.MarkDeclarationReferenced(E->getLocation(), ND); - return SemaRef.Owned(E->Retain()); + return SemaRef.Owned(E); } DeclarationNameInfo NameInfo(E->getDecl()->getDeclName(), E->getLocation()); diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp index 4011fa8c1c..41386dcafa 100644 --- a/lib/Serialization/ASTReaderStmt.cpp +++ b/lib/Serialization/ASTReaderStmt.cpp @@ -274,9 +274,6 @@ void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) { else S->setSwitchCaseList(SC); - // Retain this SwitchCase, since SwitchStmt::addSwitchCase() would - // normally retain it (but we aren't calling addSwitchCase). - SC->Retain(); PrevSC = SC; } } -- 2.40.0