60 changes: 30 additions & 30 deletions clang/lib/Parse/ParseExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {

if (!LHS.isInvalid())
LHS = Actions.ActOnUnaryOp(getCurScope(), ExtLoc, tok::kw___extension__,
LHS.take());
LHS.get());

return ParseRHSOfBinaryExpression(LHS, prec::Comma);
}
Expand Down Expand Up @@ -392,11 +392,11 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
Actions.getExprRange(RHS.get()).getEnd()));

LHS = Actions.ActOnBinOp(getCurScope(), OpToken.getLocation(),
OpToken.getKind(), LHS.take(), RHS.take());
OpToken.getKind(), LHS.get(), RHS.get());
} else
LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc,
LHS.take(), TernaryMiddle.take(),
RHS.take());
LHS.get(), TernaryMiddle.get(),
RHS.get());
}
}
}
Expand Down Expand Up @@ -1114,7 +1114,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,

if (!Result.isInvalid())
Result = Actions.ActOnNoexceptExpr(KeyLoc, T.getOpenLocation(),
Result.take(), T.getCloseLocation());
Result.get(), T.getCloseLocation());
return Result;
}

Expand Down Expand Up @@ -1252,8 +1252,8 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
SourceLocation RLoc = Tok.getLocation();

if (!LHS.isInvalid() && !Idx.isInvalid() && Tok.is(tok::r_square)) {
LHS = Actions.ActOnArraySubscriptExpr(getCurScope(), LHS.take(), Loc,
Idx.take(), RLoc);
LHS = Actions.ActOnArraySubscriptExpr(getCurScope(), LHS.get(), Loc,
Idx.get(), RLoc);
} else
LHS = ExprError();

Expand Down Expand Up @@ -1343,7 +1343,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
assert((ArgExprs.size() == 0 ||
ArgExprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
LHS = Actions.ActOnCallExpr(getCurScope(), LHS.take(), Loc,
LHS = Actions.ActOnCallExpr(getCurScope(), LHS.get(), Loc,
ArgExprs, Tok.getLocation(),
ExecConfig);
PT.consumeClose();
Expand All @@ -1362,7 +1362,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
ParsedType ObjectType;
bool MayBePseudoDestructor = false;
if (getLangOpts().CPlusPlus && !LHS.isInvalid()) {
Expr *Base = LHS.take();
Expr *Base = LHS.get();
const Type* BaseType = Base->getType().getTypePtrOrNull();
if (BaseType && Tok.is(tok::l_paren) &&
(BaseType->isFunctionType() ||
Expand Down Expand Up @@ -1396,7 +1396,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
}

if (MayBePseudoDestructor && !LHS.isInvalid()) {
LHS = ParseCXXPseudoDestructor(LHS.take(), OpLoc, OpKind, SS,
LHS = ParseCXXPseudoDestructor(LHS.get(), OpLoc, OpKind, SS,
ObjectType);
break;
}
Expand Down Expand Up @@ -1430,7 +1430,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
LHS = ExprError();

if (!LHS.isInvalid())
LHS = Actions.ActOnMemberAccessExpr(getCurScope(), LHS.take(), OpLoc,
LHS = Actions.ActOnMemberAccessExpr(getCurScope(), LHS.get(), OpLoc,
OpKind, SS, TemplateKWLoc, Name,
CurParsedObjCImpl ? CurParsedObjCImpl->Dcl
: nullptr,
Expand All @@ -1441,7 +1441,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
case tok::minusminus: // postfix-expression: postfix-expression '--'
if (!LHS.isInvalid()) {
LHS = Actions.ActOnPostfixUnaryOp(getCurScope(), Tok.getLocation(),
Tok.getKind(), LHS.take());
Tok.getKind(), LHS.get());
}
ConsumeToken();
break;
Expand Down Expand Up @@ -1653,7 +1653,7 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
Operand = Actions.ActOnUnaryExprOrTypeTraitExpr(OpTok.getLocation(),
ExprKind,
/*isType=*/false,
Operand.release(),
Operand.get(),
CastRange);
return Operand;
}
Expand Down Expand Up @@ -1711,7 +1711,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
if (Expr.isInvalid() || Ty.isInvalid())
Res = ExprError();
else
Res = Actions.ActOnVAArg(StartLoc, Expr.take(), Ty.get(), ConsumeParen());
Res = Actions.ActOnVAArg(StartLoc, Expr.get(), Ty.get(), ConsumeParen());
break;
}
case tok::kw___builtin_offsetof: {
Expand Down Expand Up @@ -1773,7 +1773,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
SkipUntil(tok::r_paren, StopAtSemi);
return Res;
}
Comps.back().U.E = Res.release();
Comps.back().U.E = Res.get();

ST.consumeClose();
Comps.back().LocEnd = ST.getCloseLocation();
Expand Down Expand Up @@ -1824,8 +1824,8 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
Diag(Tok, diag::err_expected) << tok::r_paren;
return ExprError();
}
Res = Actions.ActOnChooseExpr(StartLoc, Cond.take(), Expr1.take(),
Expr2.take(), ConsumeParen());
Res = Actions.ActOnChooseExpr(StartLoc, Cond.get(), Expr1.get(),
Expr2.get(), ConsumeParen());
break;
}
case tok::kw___builtin_astype: {
Expand Down Expand Up @@ -1853,7 +1853,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
return ExprError();
}

Res = Actions.ActOnAsTypeExpr(Expr.take(), DestTy.get(), StartLoc,
Res = Actions.ActOnAsTypeExpr(Expr.get(), DestTy.get(), StartLoc,
ConsumeParen());
break;
}
Expand Down Expand Up @@ -1882,7 +1882,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
return ExprError();
}

Res = Actions.ActOnConvertVectorExpr(Expr.take(), DestTy.get(), StartLoc,
Res = Actions.ActOnConvertVectorExpr(Expr.get(), DestTy.get(), StartLoc,
ConsumeParen());
break;
}
Expand All @@ -1893,7 +1893,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {

// These can be followed by postfix-expr pieces because they are
// primary-expressions.
return ParsePostfixExpressionSuffix(Res.take());
return ParsePostfixExpressionSuffix(Res.get());
}

/// ParseParenExpression - This parses the unit that starts with a '(' token,
Expand Down Expand Up @@ -1969,7 +1969,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,

// If the substmt parsed correctly, build the AST node.
if (!Stmt.isInvalid()) {
Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.take(), Tok.getLocation());
Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.get(), Tok.getLocation());
} else {
Actions.ActOnStmtExprError();
}
Expand Down Expand Up @@ -2096,7 +2096,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
if (!Result.isInvalid()) {
Result = Actions.ActOnCastExpr(getCurScope(), OpenLoc,
DeclaratorInfo, CastTy,
RParenLoc, Result.take());
RParenLoc, Result.get());
}
return Result;
}
Expand Down Expand Up @@ -2125,7 +2125,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
// Don't build a paren expression unless we actually match a ')'.
if (!Result.isInvalid() && Tok.is(tok::r_paren))
Result =
Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), Result.take());
Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), Result.get());
}

// Match the ')'.
Expand Down Expand Up @@ -2156,7 +2156,7 @@ Parser::ParseCompoundLiteralExpression(ParsedType Ty,
Diag(LParenLoc, diag::ext_c99_compound_literal);
ExprResult Result = ParseInitializer();
if (!Result.isInvalid() && Ty)
return Actions.ActOnCompoundLiteral(LParenLoc, Ty, RParenLoc, Result.take());
return Actions.ActOnCompoundLiteral(LParenLoc, Ty, RParenLoc, Result.get());
return Result;
}

Expand Down Expand Up @@ -2250,7 +2250,7 @@ ExprResult Parser::ParseGenericSelectionExpression() {
SkipUntil(tok::r_paren, StopAtSemi);
return ExprError();
}
Ty = TR.release();
Ty = TR.get();
}
Types.push_back(Ty);

Expand All @@ -2266,7 +2266,7 @@ ExprResult Parser::ParseGenericSelectionExpression() {
SkipUntil(tok::r_paren, StopAtSemi);
return ExprError();
}
Exprs.push_back(ER.release());
Exprs.push_back(ER.get());
} while (TryConsumeToken(tok::comma));

T.consumeClose();
Expand All @@ -2275,7 +2275,7 @@ ExprResult Parser::ParseGenericSelectionExpression() {

return Actions.ActOnGenericSelectionExpr(KeyLoc, DefaultLoc,
T.getCloseLocation(),
ControllingExpr.release(),
ControllingExpr.get(),
Types, Exprs);
}

Expand Down Expand Up @@ -2329,7 +2329,7 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr*> &Exprs,
if (Expr.isInvalid())
return true;

Exprs.push_back(Expr.release());
Exprs.push_back(Expr.get());

if (Tok.isNot(tok::comma))
return false;
Expand All @@ -2354,7 +2354,7 @@ Parser::ParseSimpleExpressionList(SmallVectorImpl<Expr*> &Exprs,
if (Expr.isInvalid())
return true;

Exprs.push_back(Expr.release());
Exprs.push_back(Expr.get());

if (Tok.isNot(tok::comma))
return false;
Expand Down Expand Up @@ -2496,7 +2496,7 @@ ExprResult Parser::ParseBlockLiteralExpression() {
StmtResult Stmt(ParseCompoundStatementBody());
BlockScope.Exit();
if (!Stmt.isInvalid())
Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.take(), getCurScope());
Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.get(), getCurScope());
else
Actions.ActOnBlockError(CaretLoc, getCurScope());
return Result;
Expand Down
26 changes: 13 additions & 13 deletions clang/lib/Parse/ParseExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
BodyScope.Exit();

if (!Stmt.isInvalid())
return Actions.ActOnLambdaExpr(LambdaBeginLoc, Stmt.take(), getCurScope());
return Actions.ActOnLambdaExpr(LambdaBeginLoc, Stmt.get(), getCurScope());

Actions.ActOnLambdaError(LambdaBeginLoc, getCurScope());
return ExprError();
Expand Down Expand Up @@ -1253,7 +1253,7 @@ ExprResult Parser::ParseCXXCasts() {
Result = Actions.ActOnCXXNamedCast(OpLoc, Kind,
LAngleBracketLoc, DeclaratorInfo,
RAngleBracketLoc,
T.getOpenLocation(), Result.take(),
T.getOpenLocation(), Result.get(),
T.getCloseLocation());

return Result;
Expand Down Expand Up @@ -1319,7 +1319,7 @@ ExprResult Parser::ParseCXXTypeid() {
return ExprError();

Result = Actions.ActOnCXXTypeid(OpLoc, LParenLoc, /*isType=*/false,
Result.release(), RParenLoc);
Result.get(), RParenLoc);
}
}

Expand Down Expand Up @@ -1367,7 +1367,7 @@ ExprResult Parser::ParseCXXUuidof() {

Result = Actions.ActOnCXXUuidof(OpLoc, T.getOpenLocation(),
/*isType=*/false,
Result.release(), T.getCloseLocation());
Result.get(), T.getCloseLocation());
}
}

Expand Down Expand Up @@ -1494,7 +1494,7 @@ ExprResult Parser::ParseThrowExpression() {
default:
ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid()) return Expr;
return Actions.ActOnCXXThrow(getCurScope(), ThrowLoc, Expr.take());
return Actions.ActOnCXXThrow(getCurScope(), ThrowLoc, Expr.get());
}
}

Expand Down Expand Up @@ -1534,7 +1534,7 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
ExprResult Init = ParseBraceInitializer();
if (Init.isInvalid())
return Init;
Expr *InitList = Init.take();
Expr *InitList = Init.get();
return Actions.ActOnCXXTypeConstructExpr(TypeRep, SourceLocation(),
MultiExprArg(&InitList, 1),
SourceLocation());
Expand Down Expand Up @@ -1636,7 +1636,7 @@ bool Parser::ParseCXXCondition(ExprResult &ExprOut,
SkipUntil(tok::semi, StopAtSemi);
return true;
}
DeclaratorInfo.setAsmLabel(AsmLabel.release());
DeclaratorInfo.setAsmLabel(AsmLabel.get());
DeclaratorInfo.SetRangeEnd(Loc);
}

Expand Down Expand Up @@ -1676,7 +1676,7 @@ bool Parser::ParseCXXCondition(ExprResult &ExprOut,
}

if (!InitExpr.isInvalid())
Actions.AddInitializerToDecl(DeclOut, InitExpr.take(), !CopyInitialization,
Actions.AddInitializerToDecl(DeclOut, InitExpr.get(), !CopyInitialization,
DS.containsPlaceholderType());
else
Actions.ActOnInitializerError(DeclOut);
Expand Down Expand Up @@ -2617,7 +2617,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {

return Actions.ActOnCXXNew(Start, UseGlobal, PlacementLParen,
PlacementArgs, PlacementRParen,
TypeIdParens, DeclaratorInfo, Initializer.take());
TypeIdParens, DeclaratorInfo, Initializer.get());
}

/// ParseDirectNewDeclarator - Parses a direct-new-declarator. Intended to be
Expand Down Expand Up @@ -2655,7 +2655,7 @@ void Parser::ParseDirectNewDeclarator(Declarator &D) {

D.AddTypeInfo(DeclaratorChunk::getArray(0,
/*static=*/false, /*star=*/false,
Size.release(),
Size.get(),
T.getOpenLocation(),
T.getCloseLocation()),
Attrs, T.getCloseLocation());
Expand Down Expand Up @@ -2732,7 +2732,7 @@ Parser::ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start) {
if (Operand.isInvalid())
return Operand;

return Actions.ActOnCXXDelete(Start, UseGlobal, ArrayDelete, Operand.take());
return Actions.ActOnCXXDelete(Start, UseGlobal, ArrayDelete, Operand.get());
}

static TypeTrait TypeTraitFromTokKind(tok::TokenKind kind) {
Expand Down Expand Up @@ -3017,7 +3017,7 @@ Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
if (!Result.isInvalid())
Result = Actions.ActOnCastExpr(getCurScope(), Tracker.getOpenLocation(),
DeclaratorInfo, CastTy,
Tracker.getCloseLocation(), Result.take());
Tracker.getCloseLocation(), Result.get());
return Result;
}

Expand All @@ -3028,7 +3028,7 @@ Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
Result = ParseExpression();
if (!Result.isInvalid() && Tok.is(tok::r_paren))
Result = Actions.ActOnParenExpr(Tracker.getOpenLocation(),
Tok.getLocation(), Result.take());
Tok.getLocation(), Result.get());

// Match the ')'.
if (Result.isInvalid()) {
Expand Down
12 changes: 6 additions & 6 deletions clang/lib/Parse/ParseInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() {
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
ParsedType(),
Idx.take());
Idx.get());
}

// If this is a normal array designator, remember it.
if (Tok.isNot(tok::ellipsis)) {
Desig.AddDesignator(Designator::getArray(Idx.release(), StartLoc));
Desig.AddDesignator(Designator::getArray(Idx.get(), StartLoc));
} else {
// Handle the gnu array range extension.
Diag(Tok, diag::ext_gnu_array_range);
Expand All @@ -325,8 +325,8 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() {
SkipUntil(tok::r_square, StopAtSemi);
return RHS;
}
Desig.AddDesignator(Designator::getArrayRange(Idx.release(),
RHS.release(),
Desig.AddDesignator(Designator::getArrayRange(Idx.get(),
RHS.get(),
StartLoc, EllipsisLoc));
}

Expand Down Expand Up @@ -426,7 +426,7 @@ ExprResult Parser::ParseBraceInitializer() {

// If we couldn't parse the subelement, bail out.
if (!SubElt.isInvalid()) {
InitExprs.push_back(SubElt.release());
InitExprs.push_back(SubElt.get());
} else {
InitExprsOk = false;

Expand Down Expand Up @@ -509,7 +509,7 @@ bool Parser::ParseMicrosoftIfExistsBraceInitializer(ExprVector &InitExprs,

// If we couldn't parse the subelement, bail out.
if (!SubElt.isInvalid())
InitExprs.push_back(SubElt.release());
InitExprs.push_back(SubElt.get());
else
InitExprsOk = false;

Expand Down
48 changes: 24 additions & 24 deletions clang/lib/Parse/ParseObjc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@ StmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
}
// consume ';'
ExpectAndConsume(tok::semi, diag::err_expected_after, "@throw");
return Actions.ActOnObjCAtThrowStmt(atLoc, Res.take(), getCurScope());
return Actions.ActOnObjCAtThrowStmt(atLoc, Res.get(), getCurScope());
}

/// objc-synchronized-statement:
Expand Down Expand Up @@ -1820,7 +1820,7 @@ Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {

// Check the @synchronized operand now.
if (!operand.isInvalid())
operand = Actions.ActOnObjCAtSynchronizedOperand(atLoc, operand.take());
operand = Actions.ActOnObjCAtSynchronizedOperand(atLoc, operand.get());

// Parse the compound statement within a new scope.
ParseScope bodyScope(this, Scope::DeclScope);
Expand Down Expand Up @@ -1911,9 +1911,9 @@ StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
StmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
RParenLoc,
FirstPart,
CatchBody.take());
CatchBody.get());
if (!Catch.isInvalid())
CatchStmts.push_back(Catch.release());
CatchStmts.push_back(Catch.get());

} else {
Diag(AtCatchFinallyLoc, diag::err_expected_lparen_after)
Expand All @@ -1934,7 +1934,7 @@ StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
if (FinallyBody.isInvalid())
FinallyBody = Actions.ActOnNullStmt(Tok.getLocation());
FinallyStmt = Actions.ActOnObjCAtFinallyStmt(AtCatchFinallyLoc,
FinallyBody.take());
FinallyBody.get());
catch_or_finally_seen = true;
break;
}
Expand All @@ -1944,9 +1944,9 @@ StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
return StmtError();
}

return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.take(),
return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.get(),
CatchStmts,
FinallyStmt.take());
FinallyStmt.get());
}

/// objc-autoreleasepool-statement:
Expand All @@ -1969,7 +1969,7 @@ Parser::ParseObjCAutoreleasePoolStmt(SourceLocation atLoc) {
if (AutoreleasePoolBody.isInvalid())
AutoreleasePoolBody = Actions.ActOnNullStmt(Tok.getLocation());
return Actions.ActOnObjCAutoreleasePoolStmt(atLoc,
AutoreleasePoolBody.take());
AutoreleasePoolBody.get());
}

/// StashAwayMethodOrFunctionBodyTokens - Consume the tokens and store them
Expand Down Expand Up @@ -2116,12 +2116,12 @@ ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
}
ConsumeToken(); // Consume the literal token.

Lit = Actions.ActOnUnaryOp(getCurScope(), OpLoc, Kind, Lit.take());
Lit = Actions.ActOnUnaryOp(getCurScope(), OpLoc, Kind, Lit.get());
if (Lit.isInvalid())
return Lit;

return ParsePostfixExpressionSuffix(
Actions.BuildObjCNumericLiteral(AtLoc, Lit.take()));
Actions.BuildObjCNumericLiteral(AtLoc, Lit.get()));
}

case tok::string_literal: // primary-expression: string-literal
Expand Down Expand Up @@ -2222,7 +2222,7 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) {
return true;

IsExpr = true;
TypeOrExpr = Receiver.take();
TypeOrExpr = Receiver.get();
return false;
}

Expand All @@ -2248,14 +2248,14 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) {
// instance method.
ExprResult Receiver = ParseCXXTypeConstructExpression(DS);
if (!Receiver.isInvalid())
Receiver = ParsePostfixExpressionSuffix(Receiver.take());
Receiver = ParsePostfixExpressionSuffix(Receiver.get());
if (!Receiver.isInvalid())
Receiver = ParseRHSOfBinaryExpression(Receiver.take(), prec::Comma);
Receiver = ParseRHSOfBinaryExpression(Receiver.get(), prec::Comma);
if (Receiver.isInvalid())
return true;

IsExpr = true;
TypeOrExpr = Receiver.take();
TypeOrExpr = Receiver.get();
return false;
}

Expand Down Expand Up @@ -2401,7 +2401,7 @@ ExprResult Parser::ParseObjCMessageExpression() {
}

return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
ParsedType(), Res.take());
ParsedType(), Res.get());
}

/// \brief Parse the remainder of an Objective-C message following the
Expand Down Expand Up @@ -2522,7 +2522,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
}

// We have a valid expression.
KeyExprs.push_back(Res.release());
KeyExprs.push_back(Res.get());

// Code completion after each argument.
if (Tok.is(tok::code_completion)) {
Expand Down Expand Up @@ -2566,7 +2566,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
}

// We have a valid expression.
KeyExprs.push_back(Res.release());
KeyExprs.push_back(Res.get());
}
} else if (!selIdent) {
Diag(Tok, diag::err_expected) << tok::identifier; // missing selector name.
Expand Down Expand Up @@ -2617,7 +2617,7 @@ ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
SmallVector<SourceLocation, 4> AtLocs;
ExprVector AtStrings;
AtLocs.push_back(AtLoc);
AtStrings.push_back(Res.release());
AtStrings.push_back(Res.get());

while (Tok.is(tok::at)) {
AtLocs.push_back(ConsumeToken()); // eat the @.
Expand All @@ -2630,7 +2630,7 @@ ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
if (Lit.isInvalid())
return Lit;

AtStrings.push_back(Lit.release());
AtStrings.push_back(Lit.get());
}

return Actions.ParseObjCStringLiteral(&AtLocs[0], AtStrings.data(),
Expand All @@ -2657,7 +2657,7 @@ ExprResult Parser::ParseObjCCharacterLiteral(SourceLocation AtLoc) {
return Lit;
}
ConsumeToken(); // Consume the literal token.
return Actions.BuildObjCNumericLiteral(AtLoc, Lit.take());
return Actions.BuildObjCNumericLiteral(AtLoc, Lit.get());
}

/// ParseObjCNumericLiteral -
Expand All @@ -2671,7 +2671,7 @@ ExprResult Parser::ParseObjCNumericLiteral(SourceLocation AtLoc) {
return Lit;
}
ConsumeToken(); // Consume the literal token.
return Actions.BuildObjCNumericLiteral(AtLoc, Lit.take());
return Actions.BuildObjCNumericLiteral(AtLoc, Lit.get());
}

/// ParseObjCBoxedExpr -
Expand All @@ -2694,9 +2694,9 @@ Parser::ParseObjCBoxedExpr(SourceLocation AtLoc) {
// Wrap the sub-expression in a parenthesized expression, to distinguish
// a boxed expression from a literal.
SourceLocation LPLoc = T.getOpenLocation(), RPLoc = T.getCloseLocation();
ValueExpr = Actions.ActOnParenExpr(LPLoc, RPLoc, ValueExpr.take());
ValueExpr = Actions.ActOnParenExpr(LPLoc, RPLoc, ValueExpr.get());
return Actions.BuildObjCBoxedExpr(SourceRange(AtLoc, RPLoc),
ValueExpr.take());
ValueExpr.get());
}

ExprResult Parser::ParseObjCArrayLiteral(SourceLocation AtLoc) {
Expand All @@ -2720,7 +2720,7 @@ ExprResult Parser::ParseObjCArrayLiteral(SourceLocation AtLoc) {
if (Res.isInvalid())
return true;

ElementExprs.push_back(Res.release());
ElementExprs.push_back(Res.get());

if (Tok.is(tok::comma))
ConsumeToken(); // Eat the ','.
Expand Down
12 changes: 6 additions & 6 deletions clang/lib/Parse/ParseOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
Actions.ActOnCapturedRegionError();
CreateDirective = false;
} else {
AssociatedStmt = Actions.ActOnCapturedRegionEnd(AssociatedStmt.take());
AssociatedStmt = Actions.ActOnCapturedRegionEnd(AssociatedStmt.get());
CreateDirective = AssociatedStmt.isUsable();
}
}
if (CreateDirective)
Directive = Actions.ActOnOpenMPExecutableDirective(
DKind, Clauses, AssociatedStmt.take(), Loc, EndLoc);
DKind, Clauses, AssociatedStmt.get(), Loc, EndLoc);

// Exit scope.
Actions.EndOpenMPDSABlock(Directive.get());
Expand Down Expand Up @@ -231,7 +231,7 @@ bool Parser::ParseOpenMPSimpleVarList(OpenMPDirectiveKind Kind,
ExprResult Res =
Actions.ActOnOpenMPIdExpression(getCurScope(), SS, NameInfo);
if (Res.isUsable())
VarList.push_back(Res.take());
VarList.push_back(Res.get());
}
// Consume ','.
if (Tok.is(tok::comma)) {
Expand Down Expand Up @@ -355,7 +355,7 @@ OMPClause *Parser::ParseOpenMPSingleExprClause(OpenMPClauseKind Kind) {
return nullptr;

return Actions.ActOnOpenMPSingleExprClause(
Kind, Val.take(), Loc, T.getOpenLocation(), T.getCloseLocation());
Kind, Val.get(), Loc, T.getOpenLocation(), T.getCloseLocation());
}

/// \brief Parsing of simple OpenMP clauses like 'default' or 'proc_bind'.
Expand Down Expand Up @@ -420,7 +420,7 @@ OMPClause *Parser::ParseOpenMPVarListClause(OpenMPClauseKind Kind) {
// Parse variable
ExprResult VarExpr = ParseAssignmentExpression();
if (VarExpr.isUsable()) {
Vars.push_back(VarExpr.take());
Vars.push_back(VarExpr.get());
} else {
SkipUntil(tok::comma, tok::r_paren, tok::annot_pragma_openmp_end,
StopBeforeMatch);
Expand All @@ -443,7 +443,7 @@ OMPClause *Parser::ParseOpenMPVarListClause(OpenMPClauseKind Kind) {
ConsumeToken();
ExprResult Tail = ParseAssignmentExpression();
if (Tail.isUsable())
TailExpr = Tail.take();
TailExpr = Tail.get();
else
SkipUntil(tok::comma, tok::r_paren, tok::annot_pragma_openmp_end,
StopBeforeMatch);
Expand Down
64 changes: 32 additions & 32 deletions clang/lib/Parse/ParseStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ StmtResult Parser::ParseSEHTryBlockCommon(SourceLocation TryLoc) {

return Actions.ActOnSEHTryBlock(false /* IsCXXTry */,
TryLoc,
TryBlock.take(),
Handler.take());
TryBlock.get(),
Handler.get());
}

/// ParseSEHExceptBlock - Handle __except
Expand Down Expand Up @@ -488,7 +488,7 @@ StmtResult Parser::ParseSEHExceptBlock(SourceLocation ExceptLoc) {
if(Block.isInvalid())
return Block;

return Actions.ActOnSEHExceptBlock(ExceptLoc, FilterExpr.take(), Block.take());
return Actions.ActOnSEHExceptBlock(ExceptLoc, FilterExpr.get(), Block.get());
}

/// ParseSEHFinallyBlock - Handle __finally
Expand All @@ -505,7 +505,7 @@ StmtResult Parser::ParseSEHFinallyBlock(SourceLocation FinallyBlock) {
if(Block.isInvalid())
return Block;

return Actions.ActOnSEHFinallyBlock(FinallyBlock,Block.take());
return Actions.ActOnSEHFinallyBlock(FinallyBlock,Block.get());
}

/// ParseLabeledStatement - We have an identifier and a ':' after it.
Expand Down Expand Up @@ -915,7 +915,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {

ExpectAndConsumeSemi(diag::err_expected_semi_declaration);
if (R.isUsable())
Stmts.push_back(R.release());
Stmts.push_back(R.get());
}

while (Tok.isNot(tok::r_brace) && !isEofOrEom()) {
Expand Down Expand Up @@ -975,7 +975,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
}

if (R.isUsable())
Stmts.push_back(R.release());
Stmts.push_back(R.get());
}

SourceLocation CloseLoc = Tok.getLocation();
Expand Down Expand Up @@ -1596,7 +1596,7 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) {
ExprResult Third = ParseExpression();
// FIXME: The C++11 standard doesn't actually say that this is a
// discarded-value expression, but it clearly should be.
ThirdPart = Actions.MakeFullDiscardedValueExpr(Third.take());
ThirdPart = Actions.MakeFullDiscardedValueExpr(Third.get());
}
}
// Match the ')'.
Expand All @@ -1609,7 +1609,7 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) {
StmtResult ForEachStmt;

if (ForRange) {
ForRangeStmt = Actions.ActOnCXXForRangeStmt(ForLoc, FirstPart.take(),
ForRangeStmt = Actions.ActOnCXXForRangeStmt(ForLoc, FirstPart.get(),
ForRangeInit.ColonLoc,
ForRangeInit.RangeExpr.get(),
T.getCloseLocation(),
Expand All @@ -1620,8 +1620,8 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) {
// statement immediately in order to close over temporaries correctly.
} else if (ForEach) {
ForEachStmt = Actions.ActOnObjCForCollectionStmt(ForLoc,
FirstPart.take(),
Collection.take(),
FirstPart.get(),
Collection.get(),
T.getCloseLocation());
}

Expand Down Expand Up @@ -1659,15 +1659,15 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) {
return StmtError();

if (ForEach)
return Actions.FinishObjCForCollectionStmt(ForEachStmt.take(),
Body.take());
return Actions.FinishObjCForCollectionStmt(ForEachStmt.get(),
Body.get());

if (ForRange)
return Actions.FinishCXXForRangeStmt(ForRangeStmt.take(), Body.take());
return Actions.FinishCXXForRangeStmt(ForRangeStmt.get(), Body.get());

return Actions.ActOnForStmt(ForLoc, T.getOpenLocation(), FirstPart.take(),
return Actions.ActOnForStmt(ForLoc, T.getOpenLocation(), FirstPart.get(),
SecondPart, SecondVar, ThirdPart,
T.getCloseLocation(), Body.take());
T.getCloseLocation(), Body.get());
}

/// ParseGotoStatement
Expand Down Expand Up @@ -1696,7 +1696,7 @@ StmtResult Parser::ParseGotoStatement() {
SkipUntil(tok::semi, StopBeforeMatch);
return StmtError();
}
Res = Actions.ActOnIndirectGotoStmt(GotoLoc, StarLoc, R.take());
Res = Actions.ActOnIndirectGotoStmt(GotoLoc, StarLoc, R.get());
} else {
Diag(Tok, diag::err_expected) << tok::identifier;
return StmtError();
Expand Down Expand Up @@ -1756,7 +1756,7 @@ StmtResult Parser::ParseReturnStatement() {
return StmtError();
}
}
return Actions.ActOnReturnStmt(ReturnLoc, R.take(), getCurScope());
return Actions.ActOnReturnStmt(ReturnLoc, R.get(), getCurScope());
}

namespace {
Expand Down Expand Up @@ -1818,7 +1818,7 @@ namespace {
}

// Initialize the "decl" with the lookup result.
Info.OpDecl = static_cast<void*>(Result.take());
Info.OpDecl = static_cast<void*>(Result.get());
return Info.OpDecl;
}

Expand Down Expand Up @@ -2254,7 +2254,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
// Need address of variable.
if (OpExprs[i].second)
OpExpr = Actions.BuildUnaryOp(getCurScope(), AsmLoc, UO_AddrOf, OpExpr)
.take();
.get();

ConstraintRefs[i] = StringRef(Constraints[i]);
Exprs[i] = OpExpr;
Expand Down Expand Up @@ -2334,7 +2334,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
T.consumeClose();
return Actions.ActOnGCCAsmStmt(AsmLoc, /*isSimple*/ true, isVolatile,
/*NumOutputs*/ 0, /*NumInputs*/ 0, nullptr,
Constraints, Exprs, AsmString.take(),
Constraints, Exprs, AsmString.get(),
Clobbers, T.getCloseLocation());
}

Expand Down Expand Up @@ -2387,7 +2387,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
if (Clobber.isInvalid())
break;

Clobbers.push_back(Clobber.release());
Clobbers.push_back(Clobber.get());

if (!TryConsumeToken(tok::comma))
break;
Expand All @@ -2398,7 +2398,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
T.consumeClose();
return Actions.ActOnGCCAsmStmt(AsmLoc, false, isVolatile, NumOutputs,
NumInputs, Names.data(), Constraints, Exprs,
AsmString.take(), Clobbers,
AsmString.get(), Clobbers,
T.getCloseLocation());
}

Expand Down Expand Up @@ -2447,7 +2447,7 @@ bool Parser::ParseAsmOperandsOpt(SmallVectorImpl<IdentifierInfo *> &Names,
SkipUntil(tok::r_paren, StopAtSemi);
return true;
}
Constraints.push_back(Constraint.release());
Constraints.push_back(Constraint.get());

if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::err_expected_lparen_after) << "asm operand";
Expand All @@ -2464,7 +2464,7 @@ bool Parser::ParseAsmOperandsOpt(SmallVectorImpl<IdentifierInfo *> &Names,
SkipUntil(tok::r_paren, StopAtSemi);
return true;
}
Exprs.push_back(Res.release());
Exprs.push_back(Res.get());
// Eat the comma and continue parsing if it exists.
if (!TryConsumeToken(tok::comma))
return false;
Expand Down Expand Up @@ -2496,7 +2496,7 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) {
}

BodyScope.Exit();
return Actions.ActOnFinishFunctionBody(Decl, FnBody.take());
return Actions.ActOnFinishFunctionBody(Decl, FnBody.get());
}

/// ParseFunctionTryBlock - Parse a C++ function-try-block.
Expand Down Expand Up @@ -2533,7 +2533,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) {
}

BodyScope.Exit();
return Actions.ActOnFinishFunctionBody(Decl, FnBody.take());
return Actions.ActOnFinishFunctionBody(Decl, FnBody.get());
}

bool Parser::trySkippingFunctionBody() {
Expand Down Expand Up @@ -2619,8 +2619,8 @@ StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc, bool FnTry) {

return Actions.ActOnSEHTryBlock(true /* IsCXXTry */,
TryLoc,
TryBlock.take(),
Handler.take());
TryBlock.get(),
Handler.get());
}
else {
StmtVector Handlers;
Expand All @@ -2634,14 +2634,14 @@ StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc, bool FnTry) {
while (Tok.is(tok::kw_catch)) {
StmtResult Handler(ParseCXXCatchBlock(FnTry));
if (!Handler.isInvalid())
Handlers.push_back(Handler.release());
Handlers.push_back(Handler.get());
}
// Don't bother creating the full statement if we don't have any usable
// handlers.
if (Handlers.empty())
return StmtError();

return Actions.ActOnCXXTryBlock(TryLoc, TryBlock.take(), Handlers);
return Actions.ActOnCXXTryBlock(TryLoc, TryBlock.get(), Handlers);
}
}

Expand Down Expand Up @@ -2701,7 +2701,7 @@ StmtResult Parser::ParseCXXCatchBlock(bool FnCatch) {
if (Block.isInvalid())
return Block;

return Actions.ActOnCXXCatchBlock(CatchLoc, ExceptionDecl, Block.take());
return Actions.ActOnCXXCatchBlock(CatchLoc, ExceptionDecl, Block.get());
}

void Parser::ParseMicrosoftIfExistsStatement(StmtVector &Stmts) {
Expand Down Expand Up @@ -2756,7 +2756,7 @@ void Parser::ParseMicrosoftIfExistsStatement(StmtVector &Stmts) {
while (Tok.isNot(tok::r_brace)) {
StmtResult R = ParseStatementOrDeclaration(Stmts, false);
if (R.isUsable())
Stmts.push_back(R.release());
Stmts.push_back(R.get());
}
Braces.consumeClose();
}
4 changes: 2 additions & 2 deletions clang/lib/Parse/ParseTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
// Create the parameter.
return Actions.ActOnNonTypeTemplateParameter(getCurScope(), ParamDecl,
Depth, Position, EqualLoc,
DefaultArg.take());
DefaultArg.get());
}

/// \brief Parses a '>' at the end of a template list.
Expand Down Expand Up @@ -1118,7 +1118,7 @@ ParsedTemplateArgument Parser::ParseTemplateArgument() {
return ParsedTemplateArgument();

return ParsedTemplateArgument(ParsedTemplateArgument::NonType,
ExprArg.release(), Loc);
ExprArg.get(), Loc);
}

/// \brief Determine whether the current tokens can only be parsed as a
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/Sema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ bool Sema::tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD,

// FIXME: Try this before emitting the fixit, and suppress diagnostics
// while doing so.
E = ActOnCallExpr(nullptr, E.take(), Range.getEnd(), None,
E = ActOnCallExpr(nullptr, E.get(), Range.getEnd(), None,
Range.getEnd().getLocWithOffset(1));
return true;
}
Expand Down
40 changes: 20 additions & 20 deletions clang/lib/Sema/SemaCast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace {
if (!isPlaceholder() || isPlaceholder(BuiltinType::Overload))
return;

SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take());
SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get());
if (SrcExpr.isInvalid())
return;
PlaceholderKind = (BuiltinType::Kind) 0;
Expand Down Expand Up @@ -262,7 +262,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
return ExprError();
}
return Op.complete(CXXConstCastExpr::Create(Context, Op.ResultType,
Op.ValueKind, Op.SrcExpr.take(), DestTInfo,
Op.ValueKind, Op.SrcExpr.get(), DestTInfo,
OpLoc, Parens.getEnd(),
AngleBrackets));

Expand All @@ -273,7 +273,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
return ExprError();
}
return Op.complete(CXXDynamicCastExpr::Create(Context, Op.ResultType,
Op.ValueKind, Op.Kind, Op.SrcExpr.take(),
Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
&Op.BasePath, DestTInfo,
OpLoc, Parens.getEnd(),
AngleBrackets));
Expand All @@ -285,7 +285,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
return ExprError();
}
return Op.complete(CXXReinterpretCastExpr::Create(Context, Op.ResultType,
Op.ValueKind, Op.Kind, Op.SrcExpr.take(),
Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
nullptr, DestTInfo, OpLoc,
Parens.getEnd(),
AngleBrackets));
Expand All @@ -298,7 +298,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
}

return Op.complete(CXXStaticCastExpr::Create(Context, Op.ResultType,
Op.ValueKind, Op.Kind, Op.SrcExpr.take(),
Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
&Op.BasePath, DestTInfo,
OpLoc, Parens.getEnd(),
AngleBrackets));
Expand Down Expand Up @@ -535,9 +535,9 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
/// checked downcasts in class hierarchies.
void CastOperation::CheckDynamicCast() {
if (ValueKind == VK_RValue)
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
else if (isPlaceholder())
SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take());
SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get());
if (SrcExpr.isInvalid()) // if conversion failed, don't report another error
return;

Expand Down Expand Up @@ -690,9 +690,9 @@ void CastOperation::CheckDynamicCast() {
/// legacy_function(const_cast\<char*\>(str));
void CastOperation::CheckConstCast() {
if (ValueKind == VK_RValue)
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
else if (isPlaceholder())
SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.take());
SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.get());
if (SrcExpr.isInvalid()) // if conversion failed, don't report another error
return;

Expand Down Expand Up @@ -805,7 +805,7 @@ static void DiagnoseReinterpretUpDownCast(Sema &Self, const Expr *SrcExpr,
/// char *bytes = reinterpret_cast\<char*\>(int_ptr);
void CastOperation::CheckReinterpretCast() {
if (ValueKind == VK_RValue && !isPlaceholder(BuiltinType::Overload))
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
else
checkNonOverloadPlaceholders();
if (SrcExpr.isInvalid()) // if conversion failed, don't report another error
Expand Down Expand Up @@ -864,13 +864,13 @@ void CastOperation::CheckStaticCast() {
return;
}

SrcExpr = Self.IgnoredValueConversions(SrcExpr.take());
SrcExpr = Self.IgnoredValueConversions(SrcExpr.get());
return;
}

if (ValueKind == VK_RValue && !DestType->isRecordType() &&
!isPlaceholder(BuiltinType::Overload)) {
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
if (SrcExpr.isInvalid()) // if conversion failed, don't report another error
return;
}
Expand Down Expand Up @@ -1589,7 +1589,7 @@ static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr,
// This is a const_cast from a class prvalue to an rvalue reference type.
// Materialize a temporary to store the result of the conversion.
SrcExpr = new (Self.Context) MaterializeTemporaryExpr(
SrcType, SrcExpr.take(), /*IsLValueReference*/ false);
SrcType, SrcExpr.get(), /*IsLValueReference*/ false);

return TC_Success;
}
Expand Down Expand Up @@ -2024,7 +2024,7 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle,
return;
}

SrcExpr = Self.IgnoredValueConversions(SrcExpr.take());
SrcExpr = Self.IgnoredValueConversions(SrcExpr.get());
return;
}

Expand All @@ -2037,7 +2037,7 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle,

if (ValueKind == VK_RValue && !DestType->isRecordType() &&
!isPlaceholder(BuiltinType::Overload)) {
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
if (SrcExpr.isInvalid())
return;
}
Expand Down Expand Up @@ -2175,7 +2175,7 @@ void CastOperation::CheckCStyleCast() {
// type needs to be scalar.
if (DestType->isVoidType()) {
// We don't necessarily do lvalue-to-rvalue conversions on this.
SrcExpr = Self.IgnoredValueConversions(SrcExpr.take());
SrcExpr = Self.IgnoredValueConversions(SrcExpr.get());
if (SrcExpr.isInvalid())
return;

Expand All @@ -2184,7 +2184,7 @@ void CastOperation::CheckCStyleCast() {
return;
}

SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.take());
SrcExpr = Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
if (SrcExpr.isInvalid())
return;
QualType SrcType = SrcExpr.get()->getType();
Expand Down Expand Up @@ -2265,7 +2265,7 @@ void CastOperation::CheckCStyleCast() {
}

if (DestType->isExtVectorType()) {
SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.take(), Kind);
SrcExpr = Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.get(), Kind);
return;
}

Expand Down Expand Up @@ -2387,7 +2387,7 @@ ExprResult Sema::BuildCStyleCastExpr(SourceLocation LPLoc,
return ExprError();

return Op.complete(CStyleCastExpr::Create(Context, Op.ResultType,
Op.ValueKind, Op.Kind, Op.SrcExpr.take(),
Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
&Op.BasePath, CastTypeInfo, LPLoc, RPLoc));
}

Expand All @@ -2409,5 +2409,5 @@ ExprResult Sema::BuildCXXFunctionalCastExpr(TypeSourceInfo *CastTypeInfo,

return Op.complete(CXXFunctionalCastExpr::Create(Context, Op.ResultType,
Op.ValueKind, CastTypeInfo, Op.Kind,
Op.SrcExpr.take(), &Op.BasePath, LPLoc, RPLoc));
Op.SrcExpr.get(), &Op.BasePath, LPLoc, RPLoc));
}
14 changes: 7 additions & 7 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static bool SemaBuiltinAddressof(Sema &S, CallExpr *TheCall) {
if (ResultType.isNull())
return true;

TheCall->setArg(0, Arg.take());
TheCall->setArg(0, Arg.get());
TheCall->setType(ResultType);
return false;
}
Expand Down Expand Up @@ -493,7 +493,7 @@ bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
ExprResult PointerArgRes = DefaultFunctionArrayLvalueConversion(PointerArg);
if (PointerArgRes.isInvalid())
return true;
PointerArg = PointerArgRes.take();
PointerArg = PointerArgRes.get();

const PointerType *pointerType = PointerArg->getType()->getAs<PointerType>();
if (!pointerType) {
Expand Down Expand Up @@ -525,7 +525,7 @@ bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
PointerArgRes = ImpCastExprToType(PointerArg, AddrType, CastNeeded);
if (PointerArgRes.isInvalid())
return true;
PointerArg = PointerArgRes.take();
PointerArg = PointerArgRes.get();

TheCall->setArg(IsLdrex ? 0 : 1, PointerArg);

Expand Down Expand Up @@ -1243,7 +1243,7 @@ static bool checkBuiltinArgument(Sema &S, CallExpr *E, unsigned ArgIndex) {
if (Arg.isInvalid())
return true;

E->setArg(ArgIndex, Arg.take());
E->setArg(ArgIndex, Arg.get());
return false;
}

Expand Down Expand Up @@ -1278,7 +1278,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
ExprResult FirstArgResult = DefaultFunctionArrayLvalueConversion(FirstArg);
if (FirstArgResult.isInvalid())
return ExprError();
FirstArg = FirstArgResult.take();
FirstArg = FirstArgResult.get();
TheCall->setArg(0, FirstArg);

const PointerType *pointerType = FirstArg->getType()->getAs<PointerType>();
Expand Down Expand Up @@ -1556,7 +1556,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
// pass in 42. The 42 gets converted to char. This is even more strange
// for things like 45.123 -> char, etc.
// FIXME: Do this check.
TheCall->setArg(i+1, Arg.take());
TheCall->setArg(i+1, Arg.get());
}

ASTContext& Context = this->getASTContext();
Expand All @@ -1577,7 +1577,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
QualType CalleePtrTy = Context.getPointerType(NewBuiltinDecl->getType());
ExprResult PromotedCall = ImpCastExprToType(NewDRE, CalleePtrTy,
CK_BuiltinFnToFnPtr);
TheCall->setCallee(PromotedCall.take());
TheCall->setCallee(PromotedCall.get());

// Change the result type of the call to match the original value type. This
// is arbitrary, but the codegen for these builtins ins design to handle it
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Sema/SemaCodeComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3428,7 +3428,7 @@ void Sema::CodeCompletePostfixExpression(Scope *S, ExprResult E) {
if (E.isInvalid())
CodeCompleteOrdinaryName(S, PCC_RecoveryInFunction);
else if (getLangOpts().ObjC1)
CodeCompleteObjCInstanceMessage(S, E.take(), None, false);
CodeCompleteObjCInstanceMessage(S, E.get(), None, false);
}

/// \brief The set of properties that have already been added, referenced by
Expand Down Expand Up @@ -5466,7 +5466,7 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
ExprResult Conv = DefaultFunctionArrayLvalueConversion(RecExpr);
if (Conv.isInvalid()) // conversion failed. bail.
return;
RecExpr = Conv.take();
RecExpr = Conv.get();
}
QualType ReceiverType = RecExpr? RecExpr->getType()
: Super? Context.getObjCObjectPointerType(
Expand All @@ -5490,7 +5490,7 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
} else if (RecExpr && getLangOpts().CPlusPlus) {
ExprResult Conv = PerformContextuallyConvertToObjCPointer(RecExpr);
if (Conv.isUsable()) {
RecExpr = Conv.take();
RecExpr = Conv.get();
ReceiverType = RecExpr->getType();
}
}
Expand Down
28 changes: 14 additions & 14 deletions clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8197,7 +8197,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
VDecl->setInvalidDecl();
return;
}
Init = Result.take();
Init = Result.get();
DefaultedToAuto = true;
}

Expand Down Expand Up @@ -8336,7 +8336,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
VDecl->setInvalidDecl();
return;
}
Init = Result.take();
Init = Result.get();
}

// Perform the initialization.
Expand Down Expand Up @@ -8364,7 +8364,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
return;
}

Init = Result.takeAs<Expr>();
Init = Result.getAs<Expr>();
}

// Check for self-references within variable initializers.
Expand Down Expand Up @@ -8422,7 +8422,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
VDecl->setInvalidDecl();
return;
}
Init = Result.take();
Init = Result.get();

// Attach the initializer to the decl.
VDecl->setInit(Init);
Expand Down Expand Up @@ -8984,7 +8984,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
var, var->getType(), varRef, /*AllowNRVO=*/true);
if (!result.isInvalid()) {
result = MaybeCreateExprWithCleanups(result);
Expr *init = result.takeAs<Expr>();
Expr *init = result.getAs<Expr>();
Context.setBlockVarCopyInits(var, init);
}
}
Expand Down Expand Up @@ -11459,7 +11459,7 @@ ExprResult Sema::VerifyBitField(SourceLocation FieldLoc,
ExprResult ICE = VerifyIntegerConstantExpression(BitWidth, &Value);
if (ICE.isInvalid())
return ICE;
BitWidth = ICE.take();
BitWidth = ICE.get();

if (Value != 0 && ZeroWidth)
*ZeroWidth = false;
Expand Down Expand Up @@ -11699,7 +11699,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
// If this is declared as a bit-field, check the bit-field.
if (!InvalidDecl && BitWidth) {
BitWidth = VerifyBitField(Loc, II, T, Record->isMsStruct(Context), BitWidth,
&ZeroWidth).take();
&ZeroWidth).get();
if (!BitWidth) {
InvalidDecl = true;
BitWidth = nullptr;
Expand Down Expand Up @@ -11887,7 +11887,7 @@ Decl *Sema::ActOnIvar(Scope *S,

if (BitWidth) {
// 6.7.2.1p3, 6.7.2.1p4
BitWidth = VerifyBitField(Loc, II, T, /*IsMsStruct*/false, BitWidth).take();
BitWidth = VerifyBitField(Loc, II, T, /*IsMsStruct*/false, BitWidth).get();
if (!BitWidth)
D.setInvalidType();
} else {
Expand Down Expand Up @@ -12488,7 +12488,7 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
Val = nullptr;

if (Val)
Val = DefaultLvalueConversion(Val).take();
Val = DefaultLvalueConversion(Val).get();

if (Val) {
if (Enum->isDependentType() || Val->isTypeDependent())
Expand All @@ -12507,10 +12507,10 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
if (Converted.isInvalid())
Val = nullptr;
else
Val = Converted.take();
Val = Converted.get();
} else if (!Val->isValueDependent() &&
!(Val = VerifyIntegerConstantExpression(Val,
&EnumVal).take())) {
&EnumVal).get())) {
// C99 6.7.2.2p2: Make sure we have an integer constant expression.
} else {
if (Enum->isFixed()) {
Expand All @@ -12523,11 +12523,11 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
if (!isRepresentableIntegerValue(Context, EnumVal, EltTy)) {
if (getLangOpts().MSVCCompat) {
Diag(IdLoc, diag::ext_enumerator_too_large) << EltTy;
Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).take();
Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).get();
} else
Diag(IdLoc, diag::err_enumerator_too_large) << EltTy;
} else
Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).take();
Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).get();
} else if (getLangOpts().CPlusPlus) {
// C++11 [dcl.enum]p5:
// If the underlying type is not fixed, the type of each enumerator
Expand All @@ -12548,7 +12548,7 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
<< (EnumVal.isUnsigned() || EnumVal.isNonNegative());
else if (!Context.hasSameType(Val->getType(), Context.IntTy)) {
// Force the type of the expression to 'int'.
Val = ImpCastExprToType(Val, Context.IntTy, CK_IntegralCast).take();
Val = ImpCastExprToType(Val, Context.IntTy, CK_IntegralCast).get();
}
EltTy = Val->getType();
}
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ static void handleEnableIfAttr(Sema &S, Decl *D, const AttributeList &Attr) {
ExprResult Converted = S.PerformContextuallyConvertToBool(Cond);
if (Converted.isInvalid())
return;
Cond = Converted.take();
Cond = Converted.get();
}

StringRef Msg;
Expand Down Expand Up @@ -2787,7 +2787,7 @@ void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E,
}

AlignedAttr *AA = ::new (Context) AlignedAttr(AttrRange, Context, true,
ICE.take(), SpellingListIndex);
ICE.get(), SpellingListIndex);
AA->setPackExpansion(IsPackExpansion);
D->addAttr(AA);
}
Expand Down
94 changes: 47 additions & 47 deletions clang/lib/Sema/SemaDeclCXX.cpp

Large diffs are not rendered by default.

440 changes: 220 additions & 220 deletions clang/lib/Sema/SemaExpr.cpp

Large diffs are not rendered by default.

168 changes: 84 additions & 84 deletions clang/lib/Sema/SemaExprCXX.cpp

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions clang/lib/Sema/SemaExprMember.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,

if (BaseResult.isInvalid())
return ExprError();
Base = BaseResult.take();
Base = BaseResult.get();

if (Result.isInvalid()) {
Owned(Base);
Expand Down Expand Up @@ -746,7 +746,7 @@ Sema::BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS,
= BuildDeclarationNameExpr(EmptySS, baseNameInfo, baseVariable);
if (result.isInvalid()) return ExprError();

baseObjectExpr = result.take();
baseObjectExpr = result.get();
baseObjectIsPointer = false;
baseQuals = baseObjectExpr->getType().getQualifiers();

Expand Down Expand Up @@ -802,7 +802,7 @@ Sema::BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS,

result = BuildFieldReferenceExpr(*this, result, baseObjectIsPointer,
EmptySS, field, foundDecl,
memberNameInfo).take();
memberNameInfo).get();
if (!result)
return ExprError();

Expand All @@ -822,7 +822,7 @@ Sema::BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS,

result = BuildFieldReferenceExpr(*this, result, /*isarrow*/ false,
(FI == FEnd? SS : EmptySS), field,
fakeFoundDecl, memberNameInfo).take();
fakeFoundDecl, memberNameInfo).get();
}

return Owned(result);
Expand Down Expand Up @@ -1128,7 +1128,7 @@ static bool ShouldTryAgainWithRedefinitionType(Sema &S, ExprResult &base) {
if (opty && !opty->getObjectType()->getInterface())
return false;

base = S.ImpCastExprToType(base.take(), redef, CK_BitCast);
base = S.ImpCastExprToType(base.get(), redef, CK_BitCast);
return true;
}

Expand Down Expand Up @@ -1168,7 +1168,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
assert(BaseExpr.get() && "no base expression");

// Perform default conversions.
BaseExpr = PerformMemberExprBaseConversion(BaseExpr.take(), IsArrow);
BaseExpr = PerformMemberExprBaseConversion(BaseExpr.get(), IsArrow);
if (BaseExpr.isInvalid())
return ExprError();

Expand Down Expand Up @@ -1246,7 +1246,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
// But we only actually find it this way on objects of type 'id',
// apparently.
if (OTy->isObjCId() && Member->isStr("isa"))
return Owned(new (Context) ObjCIsaExpr(BaseExpr.take(), IsArrow, MemberLoc,
return Owned(new (Context) ObjCIsaExpr(BaseExpr.get(), IsArrow, MemberLoc,
OpLoc,
Context.getObjCClassType()));
if (ShouldTryAgainWithRedefinitionType(*this, BaseExpr))
Expand Down Expand Up @@ -1365,7 +1365,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,

ObjCIvarRefExpr *Result = new (Context) ObjCIvarRefExpr(IV, IV->getType(),
MemberLoc, OpLoc,
BaseExpr.take(),
BaseExpr.get(),
IsArrow);

if (getLangOpts().ObjCAutoRefCount) {
Expand All @@ -1392,7 +1392,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
}

// This actually uses the base as an r-value.
BaseExpr = DefaultLvalueConversion(BaseExpr.take());
BaseExpr = DefaultLvalueConversion(BaseExpr.get());
if (BaseExpr.isInvalid())
return ExprError();

Expand All @@ -1417,7 +1417,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
VK_LValue,
OK_ObjCProperty,
MemberLoc,
BaseExpr.take()));
BaseExpr.get()));
}

if (ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(PMDecl)) {
Expand All @@ -1437,7 +1437,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
return Owned(new (Context) ObjCPropertyRefExpr(OMD, SMD,
Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
MemberLoc, BaseExpr.take()));
MemberLoc, BaseExpr.get()));
}
}
// Use of id.member can only be for a property reference. Do not
Expand Down Expand Up @@ -1492,7 +1492,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
return Owned(new (Context) ObjCPropertyRefExpr(Getter, Setter,
Context.PseudoObjectTy,
VK_LValue, OK_ObjCProperty,
MemberLoc, BaseExpr.take()));
MemberLoc, BaseExpr.get()));
}

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

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

Expand All @@ -1528,7 +1528,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
if (IsArrow &&
BaseType->isSpecificBuiltinType(BuiltinType::ObjCSel) &&
!Context.getObjCSelRedefinitionType()->isObjCSelType()) {
BaseExpr = ImpCastExprToType(BaseExpr.take(),
BaseExpr = ImpCastExprToType(BaseExpr.get(),
Context.getObjCSelRedefinitionType(),
CK_BitCast);
return LookupMemberExpr(R, BaseExpr, IsArrow, OpLoc, SS,
Expand Down Expand Up @@ -1567,7 +1567,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
IsArrow ? &isPointerToRecordType : &isRecordType)) {
if (BaseExpr.isInvalid())
return ExprError();
BaseExpr = DefaultFunctionArrayConversion(BaseExpr.take());
BaseExpr = DefaultFunctionArrayConversion(BaseExpr.get());
return LookupMemberExpr(R, BaseExpr, IsArrow, OpLoc, SS,
ObjCImpDecl, HasTemplateArgs);
}
Expand Down Expand Up @@ -1625,7 +1625,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
// This is a postfix expression, so get rid of ParenListExprs.
ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
if (Result.isInvalid()) return ExprError();
Base = Result.take();
Base = Result.get();

if (Base->getType()->isDependentType() || Name.isDependentName() ||
isDependentScopeSpecifier(SS)) {
Expand All @@ -1640,7 +1640,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
SS, ObjCImpDecl, TemplateArgs != nullptr);
if (BaseResult.isInvalid())
return ExprError();
Base = BaseResult.take();
Base = BaseResult.get();

if (Result.isInvalid()) {
Owned(Base);
Expand Down Expand Up @@ -1725,7 +1725,7 @@ BuildFieldReferenceExpr(Sema &S, Expr *BaseExpr, bool IsArrow,
FoundDecl, Field);
if (Base.isInvalid())
return ExprError();
return S.Owned(BuildMemberExpr(S, S.Context, Base.take(), IsArrow, SS,
return S.Owned(BuildMemberExpr(S, S.Context, Base.get(), IsArrow, SS,
/*TemplateKWLoc=*/SourceLocation(),
Field, FoundDecl, MemberNameInfo,
MemberType, VK, OK));
Expand Down
26 changes: 13 additions & 13 deletions clang/lib/Sema/SemaExprObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
}
if (result.isInvalid())
return true;
Args[i] = result.take();
Args[i] = result.get();
}

unsigned DiagID;
Expand Down Expand Up @@ -1383,7 +1383,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
if (argE.isInvalid()) {
IsError = true;
} else {
Args[i] = argE.take();
Args[i] = argE.get();

// Update the parameter type in-place.
param->setType(paramType);
Expand All @@ -1402,7 +1402,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
if (ArgE.isInvalid())
IsError = true;
else
Args[i] = ArgE.takeAs<Expr>();
Args[i] = ArgE.getAs<Expr>();
}

// Promote additional arguments to variadic methods.
Expand All @@ -1414,7 +1414,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod,
nullptr);
IsError |= Arg.isInvalid();
Args[i] = Arg.take();
Args[i] = Arg.get();
}
} else {
// Check for extra arguments to non-variadic methods.
Expand Down Expand Up @@ -2288,7 +2288,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
else
Result = CheckPlaceholderExpr(Receiver);
if (Result.isInvalid()) return ExprError();
Receiver = Result.take();
Receiver = Result.get();
}

if (Receiver->isTypeDependent()) {
Expand All @@ -2309,7 +2309,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
ExprResult Result = DefaultFunctionArrayLvalueConversion(Receiver);
if (Result.isInvalid())
return ExprError();
Receiver = Result.take();
Receiver = Result.get();
ReceiverType = Receiver->getType();

// If the receiver is an ObjC pointer, a block pointer, or an
Expand All @@ -2328,14 +2328,14 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
<< Receiver->getSourceRange();
if (ReceiverType->isPointerType()) {
Receiver = ImpCastExprToType(Receiver, Context.getObjCIdType(),
CK_CPointerToObjCPointerCast).take();
CK_CPointerToObjCPointerCast).get();
} else {
// TODO: specialized warning on null receivers?
bool IsNull = Receiver->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull);
CastKind Kind = IsNull ? CK_NullToPointer : CK_IntegralToPointer;
Receiver = ImpCastExprToType(Receiver, Context.getObjCIdType(),
Kind).take();
Kind).get();
}
ReceiverType = Receiver->getType();
} else if (getLangOpts().CPlusPlus) {
Expand All @@ -2346,7 +2346,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,

ExprResult result = PerformContextuallyConvertToObjCPointer(Receiver);
if (result.isUsable()) {
Receiver = result.take();
Receiver = result.get();
ReceiverType = Receiver->getType();
}
}
Expand Down Expand Up @@ -2733,7 +2733,7 @@ ExprResult Sema::ActOnInstanceMessage(Scope *S,
if (isa<ParenListExpr>(Receiver)) {
ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Receiver);
if (Result.isInvalid()) return ExprError();
Receiver = Result.take();
Receiver = Result.get();
}

if (RespondsToSelectorSel.isNull()) {
Expand Down Expand Up @@ -3547,7 +3547,7 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
ClassMethod->getLocation(),
ClassMethod->getSelector(), ClassMethod,
MultiExprArg(args, 1));
SrcExpr = msg.take();
SrcExpr = msg.get();
return true;
}
}
Expand Down Expand Up @@ -3584,7 +3584,7 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
InstanceMethod->getLocation(),
InstanceMethod->getSelector(),
InstanceMethod, None);
SrcExpr = msg.take();
SrcExpr = msg.get();
return true;
}
}
Expand Down Expand Up @@ -3806,7 +3806,7 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
Expr *SubExpr) {
ExprResult SubResult = UsualUnaryConversions(SubExpr);
if (SubResult.isInvalid()) return ExprError();
SubExpr = SubResult.take();
SubExpr = SubResult.get();

QualType T = TSInfo->getType();
QualType FromType = SubExpr->getType();
Expand Down
70 changes: 35 additions & 35 deletions clang/lib/Sema/SemaInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
}
Expand Down Expand Up @@ -878,7 +878,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
hadError = true;

UpdateStructuredListElement(StructuredList, StructuredIndex,
Result.takeAs<Expr>());
Result.getAs<Expr>());
}
++Index;
return;
Expand All @@ -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
}

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -5262,7 +5262,7 @@ PerformConstructorInitialization(Sema &S,
return ExprError();

if (shouldBindAsTemporary(Entity))
CurInit = S.MaybeBindToTemporary(CurInit.take());
CurInit = S.MaybeBindToTemporary(CurInit.get());

return CurInit;
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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);
Expand All @@ -5927,15 +5927,15 @@ 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;
}

case SK_LValueToRValue: {
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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions clang/lib/Sema/SemaLambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ QualType Sema::performLambdaInitCaptureInitialization(SourceLocation Loc,

if (Result.isInvalid())
return QualType();
Init = Result.takeAs<Expr>();
Init = Result.getAs<Expr>();

// The init-capture initialization is a full-expression that must be
// processed as one before we enter the declcontext of the lambda's
Expand All @@ -793,7 +793,7 @@ QualType Sema::performLambdaInitCaptureInitialization(SourceLocation Loc,
if (Result.isInvalid())
return QualType();

Init = Result.takeAs<Expr>();
Init = Result.getAs<Expr>();
return DeducedType;
}

Expand Down Expand Up @@ -1013,7 +1013,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
if (C->InitCaptureType.get().isNull())
continue;
Var = createLambdaInitCaptureVarDecl(C->Loc, C->InitCaptureType.get(),
C->Id, C->Init.take());
C->Id, C->Init.get());
// C++1y [expr.prim.lambda]p11:
// An init-capture behaves as if it declares and explicitly
// captures a variable [...] whose declarative region is the
Expand Down Expand Up @@ -1572,7 +1572,7 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
/*NRVO=*/false),
CurrentLocation, Src);
if (!Init.isInvalid())
Init = ActOnFinishFullExpr(Init.take());
Init = ActOnFinishFullExpr(Init.get());

if (Init.isInvalid())
return ExprError();
Expand Down Expand Up @@ -1612,7 +1612,7 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
Src->getType(), CapVarTSI,
SC_None);
BlockDecl::Capture Capture(/*Variable=*/CapVar, /*ByRef=*/false,
/*Nested=*/false, /*Copy=*/Init.take());
/*Nested=*/false, /*Copy=*/Init.get());
Block->setCaptures(Context, &Capture, &Capture + 1,
/*CapturesCXXThis=*/false);

Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Sema/SemaObjCProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
/*NRVO=*/false),
PropertyDiagLoc, Owned(IvarRefExpr));
if (!Res.isInvalid()) {
Expr *ResExpr = Res.takeAs<Expr>();
Expr *ResExpr = Res.getAs<Expr>();
if (ResExpr)
ResExpr = MaybeCreateExprWithCleanups(ResExpr);
PIDecl->setGetterCXXConstructor(ResExpr);
Expand Down Expand Up @@ -1212,7 +1212,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
BO_Assign, lhs, rhs);
if (property->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_atomic) {
Expr *callExpr = Res.takeAs<Expr>();
Expr *callExpr = Res.getAs<Expr>();
if (const CXXOperatorCallExpr *CXXCE =
dyn_cast_or_null<CXXOperatorCallExpr>(callExpr))
if (const FunctionDecl *FuncDecl = CXXCE->getDirectCallee())
Expand All @@ -1225,7 +1225,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
diag::note_callee_decl) << FuncDecl;
}
}
PIDecl->setSetterCXXAssignment(Res.takeAs<Expr>());
PIDecl->setSetterCXXAssignment(Res.getAs<Expr>());
}
}

Expand Down
10 changes: 5 additions & 5 deletions clang/lib/Sema/SemaOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ OMPClause *Sema::ActOnOpenMPIfClause(Expr *Condition, SourceLocation StartLoc,
if (Val.isInvalid())
return nullptr;

ValExpr = Val.take();
ValExpr = Val.get();
}

return new (Context) OMPIfClause(ValExpr, StartLoc, LParenLoc, EndLoc);
Expand Down Expand Up @@ -940,7 +940,7 @@ OMPClause *Sema::ActOnOpenMPNumThreadsClause(Expr *NumThreads,
if (Val.isInvalid())
return nullptr;

ValExpr = Val.take();
ValExpr = Val.get();

// OpenMP [2.5, Restrictions]
// The num_threads expression must evaluate to a positive integer value.
Expand Down Expand Up @@ -986,7 +986,7 @@ OMPClause *Sema::ActOnOpenMPSafelenClause(Expr *Len, SourceLocation StartLoc,
if (Safelen.isInvalid())
return nullptr;
return new (Context)
OMPSafelenClause(Safelen.take(), StartLoc, LParenLoc, EndLoc);
OMPSafelenClause(Safelen.get(), StartLoc, LParenLoc, EndLoc);
}

OMPClause *Sema::ActOnOpenMPCollapseClause(Expr *Num, SourceLocation StartLoc,
Expand All @@ -1000,7 +1000,7 @@ OMPClause *Sema::ActOnOpenMPCollapseClause(Expr *Num, SourceLocation StartLoc,
if (NumForLoops.isInvalid())
return nullptr;
return new (Context)
OMPCollapseClause(NumForLoops.take(), StartLoc, LParenLoc, EndLoc);
OMPCollapseClause(NumForLoops.get(), StartLoc, LParenLoc, EndLoc);
}

OMPClause *Sema::ActOnOpenMPSimpleClause(
Expand Down Expand Up @@ -1627,7 +1627,7 @@ OMPClause *Sema::ActOnOpenMPLinearClause(ArrayRef<Expr *> VarList, Expr *Step,
ExprResult Val = PerformImplicitIntegerConversion(StepLoc, Step);
if (Val.isInvalid())
return nullptr;
StepExpr = Val.take();
StepExpr = Val.get();

// Warn about zero linear step (it would be probably better specified as
// making corresponding variables 'const').
Expand Down
72 changes: 36 additions & 36 deletions clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ CreateFunctionRefExpr(Sema &S, FunctionDecl *Fn, NamedDecl *FoundDecl,
S.MarkDeclRefReferenced(DRE);

ExprResult E = S.Owned(DRE);
E = S.DefaultFunctionArrayConversion(E.take());
E = S.DefaultFunctionArrayConversion(E.get());
if (E.isInvalid())
return ExprError();
return E;
Expand Down Expand Up @@ -851,7 +851,7 @@ checkPlaceholderForOverload(Sema &S, Expr *&E,
if (result.isInvalid())
return true;

E = result.take();
E = result.get();
return false;
}

Expand Down Expand Up @@ -4878,12 +4878,12 @@ Sema::PerformObjectArgumentInitialization(Expr *From,
PerformObjectMemberConversion(From, Qualifier, FoundDecl, Method);
if (FromRes.isInvalid())
return ExprError();
From = FromRes.take();
From = FromRes.get();
}

if (!Context.hasSameType(From->getType(), DestType))
From = ImpCastExprToType(From, DestType, CK_NoOp,
From->getValueKind()).take();
From->getValueKind()).get();
return Owned(From);
}

Expand Down Expand Up @@ -5306,7 +5306,7 @@ ExprResult Sema::PerformContextualImplicitConversion(
ExprResult result = CheckPlaceholderExpr(From);
if (result.isInvalid())
return result;
From = result.take();
From = result.get();
}

// If the expression already has a matching type, we're golden.
Expand Down Expand Up @@ -5708,7 +5708,7 @@ EnableIfAttr *Sema::CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
InitializationFailed = true;
break;
}
ConvertedArgs.push_back(R.take());
ConvertedArgs.push_back(R.get());
} else {
ExprResult R =
PerformCopyInitialization(InitializedEntity::InitializeParameter(
Expand All @@ -5720,7 +5720,7 @@ EnableIfAttr *Sema::CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
InitializationFailed = true;
break;
}
ConvertedArgs.push_back(R.take());
ConvertedArgs.push_back(R.get());
}
}

Expand Down Expand Up @@ -10153,12 +10153,12 @@ bool Sema::ResolveAndFixSingleFunctionTemplateSpecialization(

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

// If desired, do function-to-pointer decay.
if (doFunctionPointerConverion) {
SingleFunctionExpression =
DefaultFunctionArrayLvalueConversion(SingleFunctionExpression.take());
DefaultFunctionArrayLvalueConversion(SingleFunctionExpression.get());
if (SingleFunctionExpression.isInvalid()) {
SrcExpr = ExprError();
return true;
Expand Down Expand Up @@ -10490,7 +10490,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
// This shouldn't cause an infinite loop because we're giving it
// an expression with viable lookup results, which should never
// end up here.
return SemaRef.ActOnCallExpr(/*Scope*/ nullptr, NewFn.take(), LParenLoc,
return SemaRef.ActOnCallExpr(/*Scope*/ nullptr, NewFn.get(), LParenLoc,
MultiExprArg(Args.data(), Args.size()),
RParenLoc);
}
Expand Down Expand Up @@ -10770,7 +10770,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
Best->FoundDecl, Method);
if (InputRes.isInvalid())
return ExprError();
Input = InputRes.take();
Input = InputRes.get();
} else {
// Convert the arguments.
ExprResult InputInit
Expand All @@ -10781,7 +10781,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
Input);
if (InputInit.isInvalid())
return ExprError();
Input = InputInit.take();
Input = InputInit.get();
}

// Build the actual expression node.
Expand All @@ -10797,7 +10797,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,

Args[0] = Input;
CallExpr *TheCall =
new (Context) CXXOperatorCallExpr(Context, Op, FnExpr.take(), ArgsArray,
new (Context) CXXOperatorCallExpr(Context, Op, FnExpr.get(), ArgsArray,
ResultTy, VK, OpLoc, false);

if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall, FnDecl))
Expand All @@ -10813,7 +10813,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
Best->Conversions[0], AA_Passing);
if (InputRes.isInvalid())
return ExprError();
Input = InputRes.take();
Input = InputRes.get();
break;
}
}
Expand Down Expand Up @@ -10994,8 +10994,8 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
Best->FoundDecl, Method);
if (Arg0.isInvalid())
return ExprError();
Args[0] = Arg0.takeAs<Expr>();
Args[1] = RHS = Arg1.takeAs<Expr>();
Args[0] = Arg0.getAs<Expr>();
Args[1] = RHS = Arg1.getAs<Expr>();
} else {
// Convert the arguments.
ExprResult Arg0 = PerformCopyInitialization(
Expand All @@ -11012,8 +11012,8 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
SourceLocation(), Owned(Args[1]));
if (Arg1.isInvalid())
return ExprError();
Args[0] = LHS = Arg0.takeAs<Expr>();
Args[1] = RHS = Arg1.takeAs<Expr>();
Args[0] = LHS = Arg0.getAs<Expr>();
Args[1] = RHS = Arg1.getAs<Expr>();
}

// Build the actual expression node.
Expand All @@ -11029,7 +11029,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
ResultTy = ResultTy.getNonLValueExprType(Context);

CXXOperatorCallExpr *TheCall =
new (Context) CXXOperatorCallExpr(Context, Op, FnExpr.take(),
new (Context) CXXOperatorCallExpr(Context, Op, FnExpr.get(),
Args, ResultTy, VK, OpLoc,
FPFeatures.fp_contract);

Expand All @@ -11054,14 +11054,14 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
Best->Conversions[0], AA_Passing);
if (ArgsRes0.isInvalid())
return ExprError();
Args[0] = ArgsRes0.take();
Args[0] = ArgsRes0.get();

ExprResult ArgsRes1 =
PerformImplicitConversion(Args[1], Best->BuiltinTypes.ParamTypes[1],
Best->Conversions[1], AA_Passing);
if (ArgsRes1.isInvalid())
return ExprError();
Args[1] = ArgsRes1.take();
Args[1] = ArgsRes1.get();
break;
}
}
Expand Down Expand Up @@ -11214,7 +11214,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
Best->FoundDecl, Method);
if (Arg0.isInvalid())
return ExprError();
Args[0] = Arg0.take();
Args[0] = Arg0.get();

// Convert the arguments.
ExprResult InputInit
Expand All @@ -11226,7 +11226,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
if (InputInit.isInvalid())
return ExprError();

Args[1] = InputInit.takeAs<Expr>();
Args[1] = InputInit.getAs<Expr>();

// Build the actual expression node.
DeclarationNameInfo OpLocInfo(OpName, LLoc);
Expand All @@ -11246,7 +11246,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,

CXXOperatorCallExpr *TheCall =
new (Context) CXXOperatorCallExpr(Context, OO_Subscript,
FnExpr.take(), Args,
FnExpr.get(), Args,
ResultTy, VK, RLoc,
false);

Expand All @@ -11263,14 +11263,14 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
Best->Conversions[0], AA_Passing);
if (ArgsRes0.isInvalid())
return ExprError();
Args[0] = ArgsRes0.take();
Args[0] = ArgsRes0.get();

ExprResult ArgsRes1 =
PerformImplicitConversion(Args[1], Best->BuiltinTypes.ParamTypes[1],
Best->Conversions[1], AA_Passing);
if (ArgsRes1.isInvalid())
return ExprError();
Args[1] = ArgsRes1.take();
Args[1] = ArgsRes1.get();

break;
}
Expand Down Expand Up @@ -11531,7 +11531,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
FoundDecl, Method);
if (ObjectArg.isInvalid())
return ExprError();
MemExpr->setBase(ObjectArg.take());
MemExpr->setBase(ObjectArg.get());
}

// Convert the rest of the arguments
Expand Down Expand Up @@ -11774,7 +11774,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
ResultTy = ResultTy.getNonLValueExprType(Context);

CXXOperatorCallExpr *TheCall = new (Context)
CXXOperatorCallExpr(Context, OO_Call, NewFn.take(),
CXXOperatorCallExpr(Context, OO_Call, NewFn.get(),
llvm::makeArrayRef(MethodArgs.get(), Args.size() + 1),
ResultTy, VK, RParenLoc, false);
MethodArgs.reset();
Expand All @@ -11797,7 +11797,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
IsError = true;
else
Object = ObjRes;
TheCall->setArg(0, Object.take());
TheCall->setArg(0, Object.get());

// Check the argument types.
for (unsigned i = 0; i != NumParams; i++) {
Expand All @@ -11814,7 +11814,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
SourceLocation(), Arg);

IsError |= InputInit.isInvalid();
Arg = InputInit.takeAs<Expr>();
Arg = InputInit.getAs<Expr>();
} else {
ExprResult DefArg
= BuildCXXDefaultArgExpr(LParenLoc, Method, Method->getParamDecl(i));
Expand All @@ -11823,7 +11823,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
break;
}

Arg = DefArg.takeAs<Expr>();
Arg = DefArg.getAs<Expr>();
}

TheCall->setArg(i + 1, Arg);
Expand All @@ -11836,7 +11836,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod,
nullptr);
IsError |= Arg.isInvalid();
TheCall->setArg(i + 1, Arg.take());
TheCall->setArg(i + 1, Arg.get());
}
}

Expand Down Expand Up @@ -11944,7 +11944,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc,
Best->FoundDecl, Method);
if (BaseResult.isInvalid())
return ExprError();
Base = BaseResult.take();
Base = BaseResult.get();

// Build the operator call.
ExprResult FnExpr = CreateFunctionRefExpr(*this, Method, Best->FoundDecl,
Expand All @@ -11956,7 +11956,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc,
ExprValueKind VK = Expr::getValueKindForType(ResultTy);
ResultTy = ResultTy.getNonLValueExprType(Context);
CXXOperatorCallExpr *TheCall =
new (Context) CXXOperatorCallExpr(Context, OO_Arrow, FnExpr.take(),
new (Context) CXXOperatorCallExpr(Context, OO_Arrow, FnExpr.get(),
Base, ResultTy, VK, OpLoc, false);

if (CheckCallReturnType(Method->getReturnType(), OpLoc, TheCall, Method))
Expand Down Expand Up @@ -12018,15 +12018,15 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R,
SourceLocation(), Args[ArgIdx]);
if (InputInit.isInvalid())
return true;
ConvArgs[ArgIdx] = InputInit.take();
ConvArgs[ArgIdx] = InputInit.get();
}

QualType ResultTy = FD->getReturnType();
ExprValueKind VK = Expr::getValueKindForType(ResultTy);
ResultTy = ResultTy.getNonLValueExprType(Context);

UserDefinedLiteral *UDL =
new (Context) UserDefinedLiteral(Context, Fn.take(),
new (Context) UserDefinedLiteral(Context, Fn.get(),
llvm::makeArrayRef(ConvArgs, Args.size()),
ResultTy, VK, LitEndLoc, UDSuffixLoc);

Expand Down
Loading