diff options
author | Nikola Smiljanic <popizdeh@gmail.com> | 2014-05-29 10:55:11 +0000 |
---|---|---|
committer | Nikola Smiljanic <popizdeh@gmail.com> | 2014-05-29 10:55:11 +0000 |
commit | 01a7598561561c6d34ba0683a550ed6326fa8f98 (patch) | |
tree | b3aff167bfd4e464e3fe245f683f1fca8820a9a8 /clang/lib/Sema/SemaInit.cpp | |
parent | d670c7eee0ae157410e04b48319b804290e779ff (diff) | |
download | bcm5719-llvm-01a7598561561c6d34ba0683a550ed6326fa8f98.tar.gz bcm5719-llvm-01a7598561561c6d34ba0683a550ed6326fa8f98.zip |
Refactoring. Remove release and take methods from ActionResult. Rename takeAs to getAs.
llvm-svn: 209800
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 847d7ae9199..51f14e233ba 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -405,13 +405,13 @@ void InitListChecker::FillInValueInitForField(unsigned Init, FieldDecl *Field, if (hadError) { // Do nothing } else if (Init < NumInits) { - ILE->setInit(Init, MemberInit.takeAs<Expr>()); + ILE->setInit(Init, MemberInit.getAs<Expr>()); } else if (InitSeq.isConstructorInitialization()) { // Value-initialization requires a constructor call, so // extend the initializer list to include the constructor // call and make a note that we'll need to take another pass // through the initializer list. - ILE->updateInit(SemaRef.Context, Init, MemberInit.takeAs<Expr>()); + ILE->updateInit(SemaRef.Context, Init, MemberInit.getAs<Expr>()); RequiresSecondPass = true; } } else if (InitListExpr *InnerILE @@ -522,14 +522,14 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity, // For arrays, just set the expression used for value-initialization // of the "holes" in the array. if (ElementEntity.getKind() == InitializedEntity::EK_ArrayElement) - ILE->setArrayFiller(ElementInit.takeAs<Expr>()); + ILE->setArrayFiller(ElementInit.getAs<Expr>()); else - ILE->setInit(Init, ElementInit.takeAs<Expr>()); + ILE->setInit(Init, ElementInit.getAs<Expr>()); } else { // For arrays, just set the expression used for value-initialization // of the rest of elements and exit. if (ElementEntity.getKind() == InitializedEntity::EK_ArrayElement) { - ILE->setArrayFiller(ElementInit.takeAs<Expr>()); + ILE->setArrayFiller(ElementInit.getAs<Expr>()); return; } @@ -538,7 +538,7 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity, // extend the initializer list to include the constructor // call and make a note that we'll need to take another pass // through the initializer list. - ILE->updateInit(SemaRef.Context, Init, ElementInit.takeAs<Expr>()); + ILE->updateInit(SemaRef.Context, Init, ElementInit.getAs<Expr>()); RequiresSecondPass = true; } } @@ -878,7 +878,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, hadError = true; UpdateStructuredListElement(StructuredList, StructuredIndex, - Result.takeAs<Expr>()); + Result.getAs<Expr>()); } ++Index; return; @@ -902,16 +902,16 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, if (ExprRes.isInvalid()) hadError = true; else { - ExprRes = SemaRef.DefaultFunctionArrayLvalueConversion(ExprRes.take()); + ExprRes = SemaRef.DefaultFunctionArrayLvalueConversion(ExprRes.get()); if (ExprRes.isInvalid()) hadError = true; } UpdateStructuredListElement(StructuredList, StructuredIndex, - ExprRes.takeAs<Expr>()); + ExprRes.getAs<Expr>()); ++Index; return; } - ExprRes.release(); + ExprRes.get(); // Fall through for subaggregate initialization } @@ -1035,7 +1035,7 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity, if (Result.isInvalid()) hadError = true; // types weren't compatible. else { - ResultExpr = Result.takeAs<Expr>(); + ResultExpr = Result.getAs<Expr>(); if (ResultExpr != expr) { // The type was promoted, update initializer list. @@ -1096,7 +1096,7 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity, if (Result.isInvalid()) hadError = true; - expr = Result.takeAs<Expr>(); + expr = Result.getAs<Expr>(); IList->setInit(Index, expr); if (hadError) @@ -1145,7 +1145,7 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity, if (Result.isInvalid()) hadError = true; // types weren't compatible. else { - ResultExpr = Result.takeAs<Expr>(); + ResultExpr = Result.getAs<Expr>(); if (ResultExpr != Init) { // The type was promoted, update initializer list. @@ -2373,7 +2373,7 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, Expr *Index = static_cast<Expr *>(D.getArrayIndex()); llvm::APSInt IndexValue; if (!Index->isTypeDependent() && !Index->isValueDependent()) - Index = CheckArrayDesignatorExpr(*this, Index, IndexValue).take(); + Index = CheckArrayDesignatorExpr(*this, Index, IndexValue).get(); if (!Index) Invalid = true; else { @@ -2396,9 +2396,9 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, EndIndex->isValueDependent(); if (!StartDependent) StartIndex = - CheckArrayDesignatorExpr(*this, StartIndex, StartValue).take(); + CheckArrayDesignatorExpr(*this, StartIndex, StartValue).get(); if (!EndDependent) - EndIndex = CheckArrayDesignatorExpr(*this, EndIndex, EndValue).take(); + EndIndex = CheckArrayDesignatorExpr(*this, EndIndex, EndValue).get(); if (!StartIndex || !EndIndex) Invalid = true; @@ -2440,7 +2440,7 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, = DesignatedInitExpr::Create(Context, Designators.data(), Designators.size(), InitExpressions, Loc, GNUSyntax, - Init.takeAs<Expr>()); + Init.getAs<Expr>()); if (!getLangOpts().C99) Diag(DIE->getLocStart(), diag::ext_designated_init) @@ -4433,7 +4433,7 @@ void InitializationSequence::InitializeFrom(Sema &S, SetFailed(FK_PlaceholderType); return; } - Args[I] = result.take(); + Args[I] = result.get(); } // C++0x [dcl.init]p16: @@ -4982,7 +4982,7 @@ static ExprResult CopyObject(Sema &S, CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(Best->Function); SmallVector<Expr*, 8> ConstructorArgs; - CurInit.release(); // Ownership transferred into MultiExprArg, below. + CurInit.get(); // Ownership transferred into MultiExprArg, below. S.CheckConstructorAccess(Loc, Constructor, Entity, Best->FoundDecl.getAccess(), IsExtraneousCopy); @@ -5030,7 +5030,7 @@ static ExprResult CopyObject(Sema &S, // If we're supposed to bind temporaries, do so. if (!CurInit.isInvalid() && shouldBindAsTemporary(Entity)) - CurInit = S.MaybeBindToTemporary(CurInit.takeAs<Expr>()); + CurInit = S.MaybeBindToTemporary(CurInit.getAs<Expr>()); return CurInit; } @@ -5262,7 +5262,7 @@ PerformConstructorInitialization(Sema &S, return ExprError(); if (shouldBindAsTemporary(Entity)) - CurInit = S.MaybeBindToTemporary(CurInit.take()); + CurInit = S.MaybeBindToTemporary(CurInit.get()); return CurInit; } @@ -5825,7 +5825,7 @@ InitializationSequence::Perform(Sema &S, // Build a call to the selected constructor. SmallVector<Expr*, 8> ConstructorArgs; SourceLocation Loc = CurInit.get()->getLocStart(); - CurInit.release(); // Ownership transferred into MultiExprArg, below. + CurInit.get(); // Ownership transferred into MultiExprArg, below. // Determine the arguments required to actually perform the constructor // call. @@ -5870,7 +5870,7 @@ InitializationSequence::Perform(Sema &S, // derived-to-base conversion? I believe the answer is "no", because // we don't want to turn off access control here for c-style casts. ExprResult CurInitExprRes = - S.PerformObjectArgumentInitialization(CurInit.take(), + S.PerformObjectArgumentInitialization(CurInit.get(), /*Qualifier=*/nullptr, FoundFn, Conversion); if(CurInitExprRes.isInvalid()) @@ -5910,7 +5910,7 @@ InitializationSequence::Perform(Sema &S, nullptr, CurInit.get()->getValueKind())); if (MaybeBindToTemp) - CurInit = S.MaybeBindToTemporary(CurInit.takeAs<Expr>()); + CurInit = S.MaybeBindToTemporary(CurInit.getAs<Expr>()); if (RequiresCopy) CurInit = CopyObject(S, Entity.getType().getNonReferenceType(), Entity, CurInit, /*IsExtraneousCopy=*/false); @@ -5927,7 +5927,7 @@ InitializationSequence::Perform(Sema &S, (Step->Kind == SK_QualificationConversionXValue ? VK_XValue : VK_RValue); - CurInit = S.ImpCastExprToType(CurInit.take(), Step->Type, CK_NoOp, VK); + CurInit = S.ImpCastExprToType(CurInit.get(), Step->Type, CK_NoOp, VK); break; } @@ -5935,7 +5935,7 @@ InitializationSequence::Perform(Sema &S, assert(CurInit.get()->isGLValue() && "cannot load from a prvalue"); CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, Step->Type, CK_LValueToRValue, - CurInit.take(), + CurInit.get(), /*BasePath=*/nullptr, VK_RValue)); break; @@ -5990,7 +5990,7 @@ InitializationSequence::Perform(Sema &S, InitListExpr *StructuredInitList = PerformInitList.getFullyStructuredList(); - CurInit.release(); + CurInit.get(); CurInit = shouldBindAsTemporary(InitEntity) ? S.MaybeBindToTemporary(StructuredInitList) : S.Owned(StructuredInitList); @@ -6023,11 +6023,11 @@ InitializationSequence::Perform(Sema &S, } case SK_UnwrapInitList: - CurInit = S.Owned(cast<InitListExpr>(CurInit.take())->getInit(0)); + CurInit = S.Owned(cast<InitListExpr>(CurInit.get())->getInit(0)); break; case SK_RewrapInitList: { - Expr *E = CurInit.take(); + Expr *E = CurInit.get(); InitListExpr *Syntactic = Step->WrappingSyntacticList; InitListExpr *ILE = new (S.Context) InitListExpr(S.Context, Syntactic->getLBraceLoc(), E, Syntactic->getRBraceLoc()); @@ -6127,7 +6127,7 @@ InitializationSequence::Perform(Sema &S, } case SK_ObjCObjectConversion: - CurInit = S.ImpCastExprToType(CurInit.take(), Step->Type, + CurInit = S.ImpCastExprToType(CurInit.get(), Step->Type, CK_ObjCObjectLValueCast, CurInit.get()->getValueKind()); break; @@ -6166,14 +6166,14 @@ InitializationSequence::Perform(Sema &S, case SK_PassByIndirectRestore: checkIndirectCopyRestoreSource(S, CurInit.get()); CurInit = S.Owned(new (S.Context) - ObjCIndirectCopyRestoreExpr(CurInit.take(), Step->Type, + 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.take(), nullptr, + CurInit.get(), nullptr, VK_RValue)); break; @@ -6203,7 +6203,7 @@ InitializationSequence::Perform(Sema &S, // Bind the result, in case the library has given initializer_list a // non-trivial destructor. if (shouldBindAsTemporary(Entity)) - CurInit = S.MaybeBindToTemporary(CurInit.take()); + CurInit = S.MaybeBindToTemporary(CurInit.get()); break; } @@ -6227,7 +6227,7 @@ InitializationSequence::Perform(Sema &S, assert(Step->Type->isEventT() && "Event initialization on non-event type."); - CurInit = S.ImpCastExprToType(CurInit.take(), Step->Type, + CurInit = S.ImpCastExprToType(CurInit.get(), Step->Type, CK_ZeroToOCLEvent, CurInit.get()->getValueKind()); break; @@ -7102,7 +7102,7 @@ Sema::PerformCopyInitialization(const InitializedEntity &Entity, EqualLoc, AllowExplicit); InitializationSequence Seq(*this, Entity, Kind, InitE, TopLevelOfInitList); - Init.release(); + Init.get(); ExprResult Result = Seq.Perform(*this, Entity, Kind, InitE); |