OwningExprResult -> ExprResult. This patch brought to you by
M-x query-replace-regexp
\(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111903 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index 06eea9c..61c4d3e 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -138,7 +138,7 @@
assert(Tok.is(tok::equal) && "Default argument not starting with '='");
SourceLocation EqualLoc = ConsumeToken();
- OwningExprResult DefArgResult(ParseAssignmentExpression());
+ ExprResult DefArgResult(ParseAssignmentExpression());
if (DefArgResult.isInvalid())
Actions.ActOnParamDefaultArgumentError(LM.DefaultArgs[I].Param);
else {
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index ea468b0..6e1b5a4 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -131,7 +131,7 @@
// now parse the non-empty comma separated list of expressions
while (1) {
- OwningExprResult ArgExpr(ParseAssignmentExpression());
+ ExprResult ArgExpr(ParseAssignmentExpression());
if (ArgExpr.isInvalid()) {
ArgExprsOk = false;
SkipUntil(tok::r_paren);
@@ -191,7 +191,7 @@
// now parse the list of expressions
while (1) {
- OwningExprResult ArgExpr(ParseAssignmentExpression());
+ ExprResult ArgExpr(ParseAssignmentExpression());
if (ArgExpr.isInvalid()) {
ArgExprsOk = false;
SkipUntil(tok::r_paren);
@@ -256,7 +256,7 @@
ConsumeParen();
// FIXME: This doesn't parse __declspec(property(get=get_func_name))
// correctly.
- OwningExprResult ArgExpr(ParseAssignmentExpression());
+ ExprResult ArgExpr(ParseAssignmentExpression());
if (!ArgExpr.isInvalid()) {
Expr *ExprList = ArgExpr.take();
CurrAttr = new AttributeList(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
@@ -514,7 +514,7 @@
// If a simple-asm-expr is present, parse it.
if (Tok.is(tok::kw_asm)) {
SourceLocation Loc;
- OwningExprResult AsmLabel(ParseSimpleAsm(&Loc));
+ ExprResult AsmLabel(ParseSimpleAsm(&Loc));
if (AsmLabel.isInvalid()) {
SkipUntil(tok::semi, true, true);
return 0;
@@ -582,7 +582,7 @@
return ThisDecl;
}
- OwningExprResult Init(ParseInitializer());
+ ExprResult Init(ParseInitializer());
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl);
@@ -1756,7 +1756,7 @@
if (Tok.is(tok::colon)) {
ConsumeToken();
- OwningExprResult Res(ParseConstantExpression());
+ ExprResult Res(ParseConstantExpression());
if (Res.isInvalid())
SkipUntil(tok::semi, true, true);
else
@@ -2078,7 +2078,7 @@
SourceLocation IdentLoc = ConsumeToken();
SourceLocation EqualLoc;
- OwningExprResult AssignedVal;
+ ExprResult AssignedVal;
if (Tok.is(tok::equal)) {
EqualLoc = ConsumeToken();
AssignedVal = ParseConstantExpression();
@@ -3131,7 +3131,7 @@
// Consume the '='.
ConsumeToken();
- OwningExprResult DefArgResult(ParseAssignmentExpression());
+ ExprResult DefArgResult(ParseAssignmentExpression());
if (DefArgResult.isInvalid()) {
Actions.ActOnParamDefaultArgumentError(Param);
SkipUntil(tok::comma, tok::r_paren, true, true);
@@ -3309,7 +3309,7 @@
}
// Remember that we parsed the empty array type.
- OwningExprResult NumElements;
+ ExprResult NumElements;
D.AddTypeInfo(DeclaratorChunk::getArray(0, false, false, 0,
StartLoc, EndLoc),
EndLoc);
@@ -3317,7 +3317,7 @@
} else if (Tok.getKind() == tok::numeric_constant &&
GetLookAheadToken(1).is(tok::r_square)) {
// [4] is very common. Parse the numeric constant expression.
- OwningExprResult ExprRes(Actions.ActOnNumericConstant(Tok));
+ ExprResult ExprRes(Actions.ActOnNumericConstant(Tok));
ConsumeToken();
SourceLocation EndLoc = MatchRHSPunctuation(tok::r_square, StartLoc);
@@ -3355,7 +3355,7 @@
// Handle "direct-declarator [ type-qual-list[opt] * ]".
bool isStar = false;
- OwningExprResult NumElements;
+ ExprResult NumElements;
// Handle the case where we have '[*]' as the array size. However, a leading
// star could be the start of an expression, for example 'X[*p + 4]'. Verify
@@ -3422,7 +3422,7 @@
bool isCastExpr;
ParsedType CastTy;
SourceRange CastRange;
- OwningExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
+ ExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
isCastExpr,
CastTy,
CastRange);
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index c8cab42..e412f25 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -389,7 +389,7 @@
SourceLocation LParenLoc = ConsumeParen();
- OwningExprResult AssertExpr(ParseConstantExpression());
+ ExprResult AssertExpr(ParseConstantExpression());
if (AssertExpr.isInvalid()) {
SkipUntil(tok::semi);
return 0;
@@ -404,7 +404,7 @@
return 0;
}
- OwningExprResult AssertMessage(ParseStringLiteralExpression());
+ ExprResult AssertMessage(ParseStringLiteralExpression());
if (AssertMessage.isInvalid())
return 0;
@@ -440,7 +440,7 @@
// The operand of the decltype specifier is an unevaluated operand.
EnterExpressionEvaluationContext Unevaluated(Actions,
Action::Unevaluated);
- OwningExprResult Result = ParseExpression();
+ ExprResult Result = ParseExpression();
if (Result.isInvalid()) {
SkipUntil(tok::r_paren);
return;
@@ -1404,8 +1404,8 @@
// member-declarator-list ',' member-declarator
llvm::SmallVector<Decl *, 8> DeclsInGroup;
- OwningExprResult BitfieldSize;
- OwningExprResult Init;
+ ExprResult BitfieldSize;
+ ExprResult Init;
bool Deleted = false;
while (1) {
@@ -1444,7 +1444,7 @@
// If a simple-asm-expr is present, parse it.
if (Tok.is(tok::kw_asm)) {
SourceLocation Loc;
- OwningExprResult AsmLabel(ParseSimpleAsm(&Loc));
+ ExprResult AsmLabel(ParseSimpleAsm(&Loc));
if (AsmLabel.isInvalid())
SkipUntil(tok::comma, true, true);
@@ -2015,7 +2015,7 @@
}
SourceLocation ParamLoc = ConsumeParen();
- OwningExprResult ArgExpr = ParseCXX0XAlignArgument(ParamLoc);
+ ExprResult ArgExpr = ParseCXX0XAlignArgument(ParamLoc);
MatchRHSPunctuation(tok::r_paren, ParamLoc);
@@ -2060,7 +2060,7 @@
///
/// [C++0x] 'align' '(' type-id ')'
/// [C++0x] 'align' '(' assignment-expression ')'
-Parser::OwningExprResult Parser::ParseCXX0XAlignArgument(SourceLocation Start) {
+ExprResult Parser::ParseCXX0XAlignArgument(SourceLocation Start) {
if (isTypeIdInParens()) {
EnterExpressionEvaluationContext Unevaluated(Actions,
Action::Unevaluated);
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index fac5473..c42fdec 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -175,8 +175,8 @@
/// assignment-expression
/// expression ',' assignment-expression
///
-Parser::OwningExprResult Parser::ParseExpression() {
- OwningExprResult LHS(ParseAssignmentExpression());
+ExprResult Parser::ParseExpression() {
+ ExprResult LHS(ParseAssignmentExpression());
if (LHS.isInvalid()) return move(LHS);
return ParseRHSOfBinaryExpression(move(LHS), prec::Comma);
@@ -187,9 +187,9 @@
/// routine is necessary to disambiguate @try-statement from,
/// for example, @encode-expression.
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseExpressionWithLeadingAt(SourceLocation AtLoc) {
- OwningExprResult LHS(ParseObjCAtExpression(AtLoc));
+ ExprResult LHS(ParseObjCAtExpression(AtLoc));
if (LHS.isInvalid()) return move(LHS);
return ParseRHSOfBinaryExpression(move(LHS), prec::Comma);
@@ -198,9 +198,9 @@
/// This routine is called when a leading '__extension__' is seen and
/// consumed. This is necessary because the token gets consumed in the
/// process of disambiguating between an expression and a declaration.
-Parser::OwningExprResult
+ExprResult
Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
- OwningExprResult LHS(true);
+ ExprResult LHS(true);
{
// Silence extension warnings in the sub-expression
ExtensionRAIIObject O(Diags);
@@ -218,7 +218,7 @@
/// ParseAssignmentExpression - Parse an expr that doesn't include commas.
///
-Parser::OwningExprResult Parser::ParseAssignmentExpression() {
+ExprResult Parser::ParseAssignmentExpression() {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Expression);
ConsumeCodeCompletionToken();
@@ -227,7 +227,7 @@
if (Tok.is(tok::kw_throw))
return ParseThrowExpression();
- OwningExprResult LHS(ParseCastExpression(false));
+ ExprResult LHS(ParseCastExpression(false));
if (LHS.isInvalid()) return move(LHS);
return ParseRHSOfBinaryExpression(LHS.take(), prec::Assignment);
@@ -241,12 +241,12 @@
///
/// Since this handles full assignment-expression's, it handles postfix
/// expressions and other binary operators for these expressions as well.
-Parser::OwningExprResult
+ExprResult
Parser::ParseAssignmentExprWithObjCMessageExprStart(SourceLocation LBracLoc,
SourceLocation SuperLoc,
ParsedType ReceiverType,
Expr *ReceiverExpr) {
- OwningExprResult R
+ ExprResult R
= ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
ReceiverType, ReceiverExpr);
if (R.isInvalid()) return move(R);
@@ -256,14 +256,14 @@
}
-Parser::OwningExprResult Parser::ParseConstantExpression() {
+ExprResult Parser::ParseConstantExpression() {
// C++ [basic.def.odr]p2:
// An expression is potentially evaluated unless it appears where an
// integral constant expression is required (see 5.19) [...].
EnterExpressionEvaluationContext Unevaluated(Actions,
Action::Unevaluated);
- OwningExprResult LHS(ParseCastExpression(false));
+ ExprResult LHS(ParseCastExpression(false));
if (LHS.isInvalid()) return move(LHS);
return ParseRHSOfBinaryExpression(LHS.take(), prec::Conditional);
@@ -271,8 +271,8 @@
/// ParseRHSOfBinaryExpression - Parse a binary expression that starts with
/// LHS and has a precedence of at least MinPrec.
-Parser::OwningExprResult
-Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, prec::Level MinPrec) {
+ExprResult
+Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
prec::Level NextTokPrec = getBinOpPrecedence(Tok.getKind(),
GreaterThanIsOperator,
getLang().CPlusPlus0x);
@@ -290,7 +290,7 @@
ConsumeToken();
// Special case handling for the ternary operator.
- OwningExprResult TernaryMiddle(true);
+ ExprResult TernaryMiddle(true);
if (NextTokPrec == prec::Conditional) {
if (Tok.isNot(tok::colon)) {
// Don't parse FOO:BAR as if it were a typo for FOO::BAR.
@@ -357,7 +357,7 @@
// Therefore we need some special-casing here.
// Also note that the third operand of the conditional operator is
// an assignment-expression in C++.
- OwningExprResult RHS;
+ ExprResult RHS;
if (getLang().CPlusPlus && NextTokPrec <= prec::Conditional)
RHS = ParseAssignmentExpression();
else
@@ -421,11 +421,11 @@
/// id-expression that is the operand of address-of gets special treatment
/// due to member pointers.
///
-Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
+ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
ParsedType TypeOfCast) {
bool NotCastExpr;
- OwningExprResult Res = ParseCastExpression(isUnaryExpression,
+ ExprResult Res = ParseCastExpression(isUnaryExpression,
isAddressOfOperand,
NotCastExpr,
TypeOfCast);
@@ -545,11 +545,11 @@
/// [GNU] binary-type-trait:
/// '__is_base_of' [TODO]
///
-Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
+ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
bool &NotCastExpr,
ParsedType TypeOfCast) {
- OwningExprResult Res;
+ ExprResult Res;
tok::TokenKind SavedKind = Tok.getKind();
NotCastExpr = false;
@@ -942,8 +942,8 @@
/// argument-expression
/// argument-expression-list ',' assignment-expression
///
-Parser::OwningExprResult
-Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
+ExprResult
+Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
// Now that the primary-expression piece of the postfix-expression has been
// parsed, see if there are any postfix-expression pieces here.
SourceLocation Loc;
@@ -963,7 +963,7 @@
return move(LHS);
Loc = ConsumeBracket();
- OwningExprResult Idx(ParseExpression());
+ ExprResult Idx(ParseExpression());
SourceLocation RLoc = Tok.getLocation();
@@ -1105,7 +1105,7 @@
/// typeof ( type-name )
/// [GNU/C++] typeof unary-expression
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
bool &isCastExpr,
ParsedType &CastTy,
@@ -1115,7 +1115,7 @@
OpTok.is(tok::kw___alignof) || OpTok.is(tok::kw_alignof)) &&
"Not a typeof/sizeof/alignof expression!");
- OwningExprResult Operand;
+ ExprResult Operand;
// If the operand doesn't start with an '(', it must be an expression.
if (Tok.isNot(tok::l_paren)) {
@@ -1183,7 +1183,7 @@
/// [GNU] '__alignof' unary-expression
/// [GNU] '__alignof' '(' type-name ')'
/// [C++0x] 'alignof' '(' type-id ')'
-Parser::OwningExprResult Parser::ParseSizeofAlignofExpression() {
+ExprResult Parser::ParseSizeofAlignofExpression() {
assert((Tok.is(tok::kw_sizeof) || Tok.is(tok::kw___alignof)
|| Tok.is(tok::kw_alignof)) &&
"Not a sizeof/alignof expression!");
@@ -1193,7 +1193,7 @@
bool isCastExpr;
ParsedType CastTy;
SourceRange CastRange;
- OwningExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
+ ExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
isCastExpr,
CastTy,
CastRange);
@@ -1228,8 +1228,8 @@
/// [GNU] offsetof-member-designator '.' identifier
/// [GNU] offsetof-member-designator '[' expression ']'
///
-Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
- OwningExprResult Res;
+ExprResult Parser::ParseBuiltinPrimaryExpression() {
+ ExprResult Res;
const IdentifierInfo *BuiltinII = Tok.getIdentifierInfo();
tok::TokenKind T = Tok.getKind();
@@ -1246,7 +1246,7 @@
switch (T) {
default: assert(0 && "Not a builtin primary expression!");
case tok::kw___builtin_va_arg: {
- OwningExprResult Expr(ParseAssignmentExpression());
+ ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid()) {
SkipUntil(tok::r_paren);
return ExprError();
@@ -1340,7 +1340,7 @@
break;
}
case tok::kw___builtin_choose_expr: {
- OwningExprResult Cond(ParseAssignmentExpression());
+ ExprResult Cond(ParseAssignmentExpression());
if (Cond.isInvalid()) {
SkipUntil(tok::r_paren);
return move(Cond);
@@ -1348,7 +1348,7 @@
if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
return ExprError();
- OwningExprResult Expr1(ParseAssignmentExpression());
+ ExprResult Expr1(ParseAssignmentExpression());
if (Expr1.isInvalid()) {
SkipUntil(tok::r_paren);
return move(Expr1);
@@ -1356,7 +1356,7 @@
if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
return ExprError();
- OwningExprResult Expr2(ParseAssignmentExpression());
+ ExprResult Expr2(ParseAssignmentExpression());
if (Expr2.isInvalid()) {
SkipUntil(tok::r_paren);
return move(Expr2);
@@ -1412,20 +1412,20 @@
/// cast-expression: [C99 6.5.4]
/// '(' type-name ')' cast-expression
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
ParsedType TypeOfCast, ParsedType &CastTy,
SourceLocation &RParenLoc) {
assert(Tok.is(tok::l_paren) && "Not a paren expr!");
GreaterThanIsOperatorScope G(GreaterThanIsOperator, true);
SourceLocation OpenLoc = ConsumeParen();
- OwningExprResult Result(true);
+ ExprResult Result(true);
bool isAmbiguousTypeId;
CastTy = ParsedType();
if (ExprType >= CompoundStmt && Tok.is(tok::l_brace)) {
Diag(Tok, diag::ext_gnu_statement_expr);
- OwningStmtResult Stmt(ParseCompoundStatement(0, true));
+ StmtResult Stmt(ParseCompoundStatement(0, true));
ExprType = CompoundStmt;
// If the substmt parsed correctly, build the AST node.
@@ -1470,7 +1470,7 @@
// Note that this doesn't parse the subsequent cast-expression, it just
// returns the parsed type to the callee.
if (stopIfCastExpr)
- return OwningExprResult();
+ return ExprResult();
// Reject the cast of super idiom in ObjC.
if (Tok.is(tok::identifier) && getLang().ObjC1 &&
@@ -1531,14 +1531,14 @@
/// '(' type-name ')' '{' initializer-list '}'
/// '(' type-name ')' '{' initializer-list ',' '}'
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseCompoundLiteralExpression(ParsedType Ty,
SourceLocation LParenLoc,
SourceLocation RParenLoc) {
assert(Tok.is(tok::l_brace) && "Not a compound literal!");
if (!getLang().C99) // Compound literals don't exist in C90.
Diag(LParenLoc, diag::ext_c99_compound_literal);
- OwningExprResult Result = ParseInitializer();
+ ExprResult Result = ParseInitializer();
if (!Result.isInvalid() && Ty)
return Actions.ActOnCompoundLiteral(LParenLoc, Ty, RParenLoc, Result.take());
return move(Result);
@@ -1550,7 +1550,7 @@
///
/// primary-expression: [C99 6.5.1]
/// string-literal
-Parser::OwningExprResult Parser::ParseStringLiteralExpression() {
+ExprResult Parser::ParseStringLiteralExpression() {
assert(isTokenStringLiteral() && "Not a string literal!");
// String concat. Note that keywords like __func__ and __FUNCTION__ are not
@@ -1590,7 +1590,7 @@
ConsumeCodeCompletionToken();
}
- OwningExprResult Expr(ParseAssignmentExpression());
+ ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid())
return true;
@@ -1640,7 +1640,7 @@
/// [clang] block-args:
/// [clang] '(' parameter-list ')'
///
-Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
+ExprResult Parser::ParseBlockLiteralExpression() {
assert(Tok.is(tok::caret) && "block literal starts with ^");
SourceLocation CaretLoc = ConsumeToken();
@@ -1715,7 +1715,7 @@
}
- OwningExprResult Result(true);
+ ExprResult Result(true);
if (!Tok.is(tok::l_brace)) {
// Saw something like: ^expr
Diag(Tok, diag::err_expected_expression);
@@ -1723,7 +1723,7 @@
return ExprError();
}
- OwningStmtResult Stmt(ParseCompoundStatementBody());
+ StmtResult Stmt(ParseCompoundStatementBody());
if (!Stmt.isInvalid())
Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.take(), getCurScope());
else
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index b8c16a2..de9498e 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -397,7 +397,7 @@
/// the only place where a qualified-id naming a non-static class member may
/// appear.
///
-Parser::OwningExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) {
+ExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) {
// qualified-id:
// '::'[opt] nested-name-specifier 'template'[opt] unqualified-id
// '::' unqualified-id
@@ -446,7 +446,7 @@
/// 'reinterpret_cast' '<' type-name '>' '(' expression ')'
/// 'const_cast' '<' type-name '>' '(' expression ')'
///
-Parser::OwningExprResult Parser::ParseCXXCasts() {
+ExprResult Parser::ParseCXXCasts() {
tok::TokenKind Kind = Tok.getKind();
const char *CastName = 0; // For error messages
@@ -475,7 +475,7 @@
if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after, CastName))
return ExprError();
- OwningExprResult Result = ParseExpression();
+ ExprResult Result = ParseExpression();
// Match the ')'.
RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
@@ -495,7 +495,7 @@
/// 'typeid' '(' expression ')'
/// 'typeid' '(' type-id ')'
///
-Parser::OwningExprResult Parser::ParseCXXTypeid() {
+ExprResult Parser::ParseCXXTypeid() {
assert(Tok.is(tok::kw_typeid) && "Not 'typeid'!");
SourceLocation OpLoc = ConsumeToken();
@@ -507,7 +507,7 @@
"typeid"))
return ExprError();
- OwningExprResult Result;
+ ExprResult Result;
if (isTypeIdInParens()) {
TypeResult Ty = ParseTypeName();
@@ -561,7 +561,7 @@
/// ~type-name
/// ::[opt] nested-name-specifier[opt] ~type-name
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseCXXPseudoDestructor(ExprArg Base, SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@@ -625,7 +625,7 @@
/// boolean-literal: [C++ 2.13.5]
/// 'true'
/// 'false'
-Parser::OwningExprResult Parser::ParseCXXBoolLiteral() {
+ExprResult Parser::ParseCXXBoolLiteral() {
tok::TokenKind Kind = Tok.getKind();
return Actions.ActOnCXXBoolLiteral(ConsumeToken(), Kind);
}
@@ -634,7 +634,7 @@
///
/// throw-expression: [C++ 15]
/// 'throw' assignment-expression[opt]
-Parser::OwningExprResult Parser::ParseThrowExpression() {
+ExprResult Parser::ParseThrowExpression() {
assert(Tok.is(tok::kw_throw) && "Not throw!");
SourceLocation ThrowLoc = ConsumeToken(); // Eat the throw token.
@@ -651,7 +651,7 @@
return Actions.ActOnCXXThrow(ThrowLoc, 0);
default:
- OwningExprResult Expr(ParseAssignmentExpression());
+ ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid()) return move(Expr);
return Actions.ActOnCXXThrow(ThrowLoc, Expr.take());
}
@@ -662,7 +662,7 @@
/// C++ 9.3.2: In the body of a non-static member function, the keyword this is
/// a non-lvalue expression whose value is the address of the object for which
/// the function is called.
-Parser::OwningExprResult Parser::ParseCXXThis() {
+ExprResult Parser::ParseCXXThis() {
assert(Tok.is(tok::kw_this) && "Not 'this'!");
SourceLocation ThisLoc = ConsumeToken();
return Actions.ActOnCXXThis(ThisLoc);
@@ -677,7 +677,7 @@
/// simple-type-specifier '(' expression-list[opt] ')' [C++ 5.2.3]
/// typename-specifier '(' expression-list[opt] ')' [TODO]
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
ParsedType TypeRep = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
@@ -730,8 +730,8 @@
/// converted to a boolean value.
///
/// \returns true if there was a parsing, false otherwise.
-bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
- Decl *&DeclResult,
+bool Parser::ParseCXXCondition(ExprResult &ExprOut,
+ Decl *&DeclOut,
SourceLocation Loc,
bool ConvertToBoolean) {
if (Tok.is(tok::code_completion)) {
@@ -741,16 +741,16 @@
if (!isCXXConditionDeclaration()) {
// Parse the expression.
- ExprResult = ParseExpression(); // expression
- DeclResult = 0;
- if (ExprResult.isInvalid())
+ ExprOut = ParseExpression(); // expression
+ DeclOut = 0;
+ if (ExprOut.isInvalid())
return true;
// If required, convert to a boolean value.
if (ConvertToBoolean)
- ExprResult
- = Actions.ActOnBooleanCondition(getCurScope(), Loc, ExprResult.take());
- return ExprResult.isInvalid();
+ ExprOut
+ = Actions.ActOnBooleanCondition(getCurScope(), Loc, ExprOut.get());
+ return ExprOut.isInvalid();
}
// type-specifier-seq
@@ -764,7 +764,7 @@
// simple-asm-expr[opt]
if (Tok.is(tok::kw_asm)) {
SourceLocation Loc;
- OwningExprResult AsmLabel(ParseSimpleAsm(&Loc));
+ ExprResult AsmLabel(ParseSimpleAsm(&Loc));
if (AsmLabel.isInvalid()) {
SkipUntil(tok::semi);
return true;
@@ -781,17 +781,17 @@
}
// Type-check the declaration itself.
- Action::DeclResult Dcl = Actions.ActOnCXXConditionDeclaration(getCurScope(),
+ DeclResult Dcl = Actions.ActOnCXXConditionDeclaration(getCurScope(),
DeclaratorInfo);
- DeclResult = Dcl.get();
- ExprResult = ExprError();
+ DeclOut = Dcl.get();
+ ExprOut = ExprError();
// '=' assignment-expression
if (Tok.is(tok::equal)) {
SourceLocation EqualLoc = ConsumeToken();
- OwningExprResult AssignExpr(ParseAssignmentExpression());
+ ExprResult AssignExpr(ParseAssignmentExpression());
if (!AssignExpr.isInvalid())
- Actions.AddInitializerToDecl(DeclResult, AssignExpr.take());
+ Actions.AddInitializerToDecl(DeclOut, AssignExpr.take());
} else {
// FIXME: C++0x allows a braced-init-list
Diag(Tok, diag::err_expected_equal_after_declarator);
@@ -1566,7 +1566,7 @@
/// '(' expression-list[opt] ')'
/// [C++0x] braced-init-list [TODO]
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {
assert(Tok.is(tok::kw_new) && "expected 'new' token");
ConsumeToken(); // Consume 'new'
@@ -1670,7 +1670,7 @@
bool first = true;
while (Tok.is(tok::l_square)) {
SourceLocation LLoc = ConsumeBracket();
- OwningExprResult Size(first ? ParseExpression()
+ ExprResult Size(first ? ParseExpression()
: ParseConstantExpression());
if (Size.isInvalid()) {
// Recover
@@ -1727,7 +1727,7 @@
/// delete-expression:
/// '::'[opt] 'delete' cast-expression
/// '::'[opt] 'delete' '[' ']' cast-expression
-Parser::OwningExprResult
+ExprResult
Parser::ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start) {
assert(Tok.is(tok::kw_delete) && "Expected 'delete' keyword");
ConsumeToken(); // Consume 'delete'
@@ -1742,7 +1742,7 @@
return ExprError();
}
- OwningExprResult Operand(ParseCastExpression(false));
+ ExprResult Operand(ParseCastExpression(false));
if (Operand.isInvalid())
return move(Operand);
@@ -1778,7 +1778,7 @@
/// primary-expression:
/// [GNU] unary-type-trait '(' type-id ')'
///
-Parser::OwningExprResult Parser::ParseUnaryTypeTrait() {
+ExprResult Parser::ParseUnaryTypeTrait() {
UnaryTypeTrait UTT = UnaryTypeTraitFromTokKind(Tok.getKind());
SourceLocation Loc = ConsumeToken();
@@ -1802,7 +1802,7 @@
/// ParseCXXAmbiguousParenExpression - We have parsed the left paren of a
/// parenthesized ambiguous type-id. This uses tentative parsing to disambiguate
/// based on the context past the parens.
-Parser::OwningExprResult
+ExprResult
Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
ParsedType &CastTy,
SourceLocation LParenLoc,
@@ -1811,7 +1811,7 @@
assert(ExprType == CastExpr && "Compound literals are not ambiguous!");
assert(isTypeIdInParens() && "Not a type-id!");
- OwningExprResult Result(true);
+ ExprResult Result(true);
CastTy = ParsedType();
// We need to disambiguate a very ugly part of the C++ syntax:
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index 8d2bc83..2589867 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -71,7 +71,7 @@
/// initializer (because it is an expression). We need to consider this case
/// when parsing array designators.
///
-Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
+ExprResult Parser::ParseInitializerWithPotentialDesignator() {
// If this is the old-style GNU extension:
// designation ::= identifier ':'
@@ -137,7 +137,7 @@
// [4][foo bar] -> obsolete GNU designation with objc message send.
//
SourceLocation StartLoc = ConsumeBracket();
- OwningExprResult Idx;
+ ExprResult Idx;
// If Objective-C is enabled and this is a typename (class message
// send) or send to 'super', parse this as a message send
@@ -176,7 +176,7 @@
// whether we have a message send or an array designator; just
// adopt the expression for further analysis below.
// FIXME: potentially-potentially evaluated expression above?
- Idx = OwningExprResult(static_cast<Expr*>(TypeOrExpr));
+ Idx = ExprResult(static_cast<Expr*>(TypeOrExpr));
} else if (getLang().ObjC1 && Tok.is(tok::identifier)) {
IdentifierInfo *II = Tok.getIdentifierInfo();
SourceLocation IILoc = Tok.getLocation();
@@ -252,7 +252,7 @@
Diag(Tok, diag::ext_gnu_array_range);
SourceLocation EllipsisLoc = ConsumeToken();
- OwningExprResult RHS(ParseConstantExpression());
+ ExprResult RHS(ParseConstantExpression());
if (RHS.isInvalid()) {
SkipUntil(tok::r_square);
return move(RHS);
@@ -309,7 +309,7 @@
/// designation[opt] initializer
/// initializer-list ',' designation[opt] initializer
///
-Parser::OwningExprResult Parser::ParseBraceInitializer() {
+ExprResult Parser::ParseBraceInitializer() {
SourceLocation LBraceLoc = ConsumeBrace();
/// InitExprs - This is the actual list of expressions contained in the
@@ -332,7 +332,7 @@
// If we know that this cannot be a designation, just parse the nested
// initializer directly.
- OwningExprResult SubElt;
+ ExprResult SubElt;
if (MayBeDesignationStart(Tok.getKind(), PP))
SubElt = ParseInitializerWithPotentialDesignator();
else
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index ead7013..1b09b1f 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1463,8 +1463,8 @@
/// objc-throw-statement:
/// throw expression[opt];
///
-Parser::OwningStmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
- OwningExprResult Res;
+StmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
+ ExprResult Res;
ConsumeToken(); // consume throw
if (Tok.isNot(tok::semi)) {
Res = ParseExpression();
@@ -1481,7 +1481,7 @@
/// objc-synchronized-statement:
/// @synchronized '(' expression ')' compound-statement
///
-Parser::OwningStmtResult
+StmtResult
Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
ConsumeToken(); // consume synchronized
if (Tok.isNot(tok::l_paren)) {
@@ -1489,7 +1489,7 @@
return StmtError();
}
ConsumeParen(); // '('
- OwningExprResult Res(ParseExpression());
+ ExprResult Res(ParseExpression());
if (Res.isInvalid()) {
SkipUntil(tok::semi);
return StmtError();
@@ -1507,7 +1507,7 @@
// statements can always hold declarations.
ParseScope BodyScope(this, Scope::DeclScope);
- OwningStmtResult SynchBody(ParseCompoundStatementBody());
+ StmtResult SynchBody(ParseCompoundStatementBody());
BodyScope.Exit();
if (SynchBody.isInvalid())
@@ -1526,7 +1526,7 @@
/// parameter-declaration
/// '...' [OBJC2]
///
-Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
+StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
bool catch_or_finally_seen = false;
ConsumeToken(); // consume try
@@ -1535,9 +1535,9 @@
return StmtError();
}
StmtVector CatchStmts(Actions);
- OwningStmtResult FinallyStmt;
+ StmtResult FinallyStmt;
ParseScope TryScope(this, Scope::DeclScope);
- OwningStmtResult TryBody(ParseCompoundStatementBody());
+ StmtResult TryBody(ParseCompoundStatementBody());
TryScope.Exit();
if (TryBody.isInvalid())
TryBody = Actions.ActOnNullStmt(Tok.getLocation());
@@ -1580,7 +1580,7 @@
else // Skip over garbage, until we get to ')'. Eat the ')'.
SkipUntil(tok::r_paren, true, false);
- OwningStmtResult CatchBody(true);
+ StmtResult CatchBody(true);
if (Tok.is(tok::l_brace))
CatchBody = ParseCompoundStatementBody();
else
@@ -1588,7 +1588,7 @@
if (CatchBody.isInvalid())
CatchBody = Actions.ActOnNullStmt(Tok.getLocation());
- OwningStmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
+ StmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
RParenLoc,
FirstPart,
CatchBody.take());
@@ -1606,7 +1606,7 @@
ConsumeToken(); // consume finally
ParseScope FinallyScope(this, Scope::DeclScope);
- OwningStmtResult FinallyBody(true);
+ StmtResult FinallyBody(true);
if (Tok.is(tok::l_brace))
FinallyBody = ParseCompoundStatementBody();
else
@@ -1668,7 +1668,7 @@
// specified Declarator for the method.
Actions.ActOnStartOfObjCMethodDef(getCurScope(), MDecl);
- OwningStmtResult FnBody(ParseCompoundStatementBody());
+ StmtResult FnBody(ParseCompoundStatementBody());
// If the function body could not be parsed, make a bogus compoundstmt.
if (FnBody.isInvalid())
@@ -1684,7 +1684,7 @@
return MDecl;
}
-Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
+StmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCAtStatement(getCurScope());
ConsumeCodeCompletionToken();
@@ -1700,7 +1700,7 @@
if (Tok.isObjCAtKeyword(tok::objc_synchronized))
return ParseObjCSynchronizedStmt(AtLoc);
- OwningExprResult Res(ParseExpressionWithLeadingAt(AtLoc));
+ ExprResult Res(ParseExpressionWithLeadingAt(AtLoc));
if (Res.isInvalid()) {
// If the expression is invalid, skip ahead to the next semicolon. Not
// doing this opens us up to the possibility of infinite loops if
@@ -1714,7 +1714,7 @@
return Actions.ActOnExprStmt(Actions.MakeFullExpr(Res.take()));
}
-Parser::OwningExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
+ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
switch (Tok.getKind()) {
case tok::code_completion:
Actions.CodeCompleteObjCAtExpression(getCurScope());
@@ -1771,7 +1771,7 @@
if (!isCXXSimpleTypeSpecifier()) {
// objc-receiver:
// expression
- OwningExprResult Receiver = ParseExpression();
+ ExprResult Receiver = ParseExpression();
if (Receiver.isInvalid())
return true;
@@ -1800,7 +1800,7 @@
// postfix-expression suffix, followed by the (optional)
// right-hand side of the binary expression. We have an
// instance method.
- OwningExprResult Receiver = ParseCXXTypeConstructExpression(DS);
+ ExprResult Receiver = ParseCXXTypeConstructExpression(DS);
if (!Receiver.isInvalid())
Receiver = ParsePostfixExpressionSuffix(Receiver.take());
if (!Receiver.isInvalid())
@@ -1847,7 +1847,7 @@
/// class-name
/// type-name
///
-Parser::OwningExprResult Parser::ParseObjCMessageExpression() {
+ExprResult Parser::ParseObjCMessageExpression() {
assert(Tok.is(tok::l_square) && "'[' expected");
SourceLocation LBracLoc = ConsumeBracket(); // consume '['
@@ -1918,7 +1918,7 @@
}
// Otherwise, an arbitrary expression can be the receiver of a send.
- OwningExprResult Res(ParseExpression());
+ ExprResult Res(ParseExpression());
if (Res.isInvalid()) {
SkipUntil(tok::r_square);
return move(Res);
@@ -1966,7 +1966,7 @@
/// assignment-expression
/// nonempty-expr-list , assignment-expression
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
SourceLocation SuperLoc,
ParsedType ReceiverType,
@@ -2007,7 +2007,7 @@
ConsumeToken(); // Eat the ':'.
/// Parse the expression after ':'
- OwningExprResult Res(ParseAssignmentExpression());
+ ExprResult Res(ParseAssignmentExpression());
if (Res.isInvalid()) {
// We must manually skip to a ']', otherwise the expression skipper will
// stop at the ']' when it skips to the ';'. We want it to skip beyond
@@ -2046,7 +2046,7 @@
while (Tok.is(tok::comma)) {
ConsumeToken(); // Eat the ','.
/// Parse the expression after ','
- OwningExprResult Res(ParseAssignmentExpression());
+ ExprResult Res(ParseAssignmentExpression());
if (Res.isInvalid()) {
// We must manually skip to a ']', otherwise the expression skipper will
// stop at the ']' when it skips to the ';'. We want it to skip beyond
@@ -2106,8 +2106,8 @@
KeyExprs.size()));
}
-Parser::OwningExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
- OwningExprResult Res(ParseStringLiteralExpression());
+ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
+ ExprResult Res(ParseStringLiteralExpression());
if (Res.isInvalid()) return move(Res);
// @"foo" @"bar" is a valid concatenated string. Eat any subsequent string
@@ -2125,7 +2125,7 @@
if (!isTokenStringLiteral())
return ExprError(Diag(Tok, diag::err_objc_concat_string));
- OwningExprResult Lit(ParseStringLiteralExpression());
+ ExprResult Lit(ParseStringLiteralExpression());
if (Lit.isInvalid())
return move(Lit);
@@ -2138,7 +2138,7 @@
/// objc-encode-expression:
/// @encode ( type-name )
-Parser::OwningExprResult
+ExprResult
Parser::ParseObjCEncodeExpression(SourceLocation AtLoc) {
assert(Tok.isObjCAtKeyword(tok::objc_encode) && "Not an @encode expression!");
@@ -2162,7 +2162,7 @@
/// objc-protocol-expression
/// @protocol ( protocol-name )
-Parser::OwningExprResult
+ExprResult
Parser::ParseObjCProtocolExpression(SourceLocation AtLoc) {
SourceLocation ProtoLoc = ConsumeToken();
@@ -2185,8 +2185,7 @@
/// objc-selector-expression
/// @selector '(' objc-keyword-selector ')'
-Parser::OwningExprResult
-Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) {
+ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) {
SourceLocation SelectorLoc = ConsumeToken();
if (Tok.isNot(tok::l_paren))
diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp
index 6c90e12..e4693ad 100644
--- a/lib/Parse/ParsePragma.cpp
+++ b/lib/Parse/ParsePragma.cpp
@@ -87,7 +87,7 @@
Action::PragmaPackKind Kind = Action::PPK_Default;
IdentifierInfo *Name = 0;
- Action::OwningExprResult Alignment;
+ ExprResult Alignment;
SourceLocation LParenLoc = Tok.getLocation();
PP.Lex(Tok);
if (Tok.is(tok::numeric_constant)) {
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index fc672eb..6e0a482 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -73,10 +73,10 @@
/// [OBC] '@' 'throw' expression ';'
/// [OBC] '@' 'throw' ';'
///
-Parser::OwningStmtResult
+StmtResult
Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
const char *SemiError = 0;
- OwningStmtResult Res;
+ StmtResult Res;
ParenBraceBracketBalancer BalancerRAIIObj(*this);
@@ -125,7 +125,7 @@
// FIXME: Use the attributes
// expression[opt] ';'
- OwningExprResult Expr(ParseExpression());
+ ExprResult Expr(ParseExpression());
if (Expr.isInvalid()) {
// If the expression is invalid, skip ahead to the next semicolon or '}'.
// Not doing this opens us up to the possibility of infinite loops if
@@ -217,7 +217,7 @@
/// identifier ':' statement
/// [GNU] identifier ':' attributes[opt] statement
///
-Parser::OwningStmtResult Parser::ParseLabeledStatement(AttributeList *Attr) {
+StmtResult Parser::ParseLabeledStatement(AttributeList *Attr) {
assert(Tok.is(tok::identifier) && Tok.getIdentifierInfo() &&
"Not an identifier!");
@@ -234,7 +234,7 @@
if (Tok.is(tok::kw___attribute))
AttrList.reset(addAttributeLists(AttrList.take(), ParseGNUAttributes()));
- OwningStmtResult SubStmt(ParseStatement());
+ StmtResult SubStmt(ParseStatement());
// Broken substmt shouldn't prevent the label from being added to the AST.
if (SubStmt.isInvalid())
@@ -251,7 +251,7 @@
/// 'case' constant-expression ':' statement
/// [GNU] 'case' constant-expression '...' constant-expression ':' statement
///
-Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
+StmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
assert(Tok.is(tok::kw_case) && "Not a case stmt!");
// FIXME: Use attributes?
delete Attr;
@@ -272,7 +272,7 @@
// TopLevelCase - This is the highest level we have parsed. 'case 1' in the
// example above.
- OwningStmtResult TopLevelCase(true);
+ StmtResult TopLevelCase(true);
// DeepestParsedCaseStmt - This is the deepest statement we have parsed, which
// gets updated each time a new case is parsed, and whose body is unset so
@@ -293,7 +293,7 @@
/// expression.
ColonProtectionRAIIObject ColonProtection(*this);
- OwningExprResult LHS(ParseConstantExpression());
+ ExprResult LHS(ParseConstantExpression());
if (LHS.isInvalid()) {
SkipUntil(tok::colon);
return StmtError();
@@ -301,7 +301,7 @@
// GNU case range extension.
SourceLocation DotDotDotLoc;
- OwningExprResult RHS;
+ ExprResult RHS;
if (Tok.is(tok::ellipsis)) {
Diag(Tok, diag::ext_gnu_case_range);
DotDotDotLoc = ConsumeToken();
@@ -323,7 +323,7 @@
SourceLocation ColonLoc = ConsumeToken();
- OwningStmtResult Case =
+ StmtResult Case =
Actions.ActOnCaseStmt(CaseLoc, LHS.get(), DotDotDotLoc,
RHS.get(), ColonLoc);
@@ -350,7 +350,7 @@
assert(!TopLevelCase.isInvalid() && "Should have parsed at least one case!");
// If we found a non-case statement, start by parsing it.
- OwningStmtResult SubStmt;
+ StmtResult SubStmt;
if (Tok.isNot(tok::r_brace)) {
SubStmt = ParseStatement();
@@ -378,7 +378,7 @@
/// 'default' ':' statement
/// Note that this does not parse the 'statement' at the end.
///
-Parser::OwningStmtResult Parser::ParseDefaultStatement(AttributeList *Attr) {
+StmtResult Parser::ParseDefaultStatement(AttributeList *Attr) {
//FIXME: Use attributes?
delete Attr;
@@ -399,7 +399,7 @@
return StmtError();
}
- OwningStmtResult SubStmt(ParseStatement());
+ StmtResult SubStmt(ParseStatement());
if (SubStmt.isInvalid())
return StmtError();
@@ -435,7 +435,7 @@
/// [OMP] barrier-directive
/// [OMP] flush-directive
///
-Parser::OwningStmtResult Parser::ParseCompoundStatement(AttributeList *Attr,
+StmtResult Parser::ParseCompoundStatement(AttributeList *Attr,
bool isStmtExpr) {
//FIXME: Use attributes?
delete Attr;
@@ -455,7 +455,7 @@
/// ActOnCompoundStmt action. This expects the '{' to be the current token, and
/// consume the '}' at the end of the block. It does not manipulate the scope
/// stack.
-Parser::OwningStmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
+StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
PrettyStackTraceLoc CrashInfo(PP.getSourceManager(),
Tok.getLocation(),
"in compound statement ('{}')");
@@ -468,7 +468,7 @@
typedef StmtVector StmtsTy;
StmtsTy Stmts(Actions);
while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
- OwningStmtResult R;
+ StmtResult R;
if (Tok.isNot(tok::kw___extension__)) {
R = ParseStatementOrDeclaration(false);
} else {
@@ -496,7 +496,7 @@
R = Actions.ActOnDeclStmt(Res, DeclStart, DeclEnd);
} else {
// Otherwise this was a unary __extension__ marker.
- OwningExprResult Res(ParseExpressionWithLeadingExtension(ExtLoc));
+ ExprResult Res(ParseExpressionWithLeadingExtension(ExtLoc));
if (Res.isInvalid()) {
SkipUntil(tok::semi);
@@ -537,7 +537,7 @@
/// should try to recover harder. It returns false if the condition is
/// successfully parsed. Note that a successful parse can still have semantic
/// errors in the condition.
-bool Parser::ParseParenExprOrCondition(OwningExprResult &ExprResult,
+bool Parser::ParseParenExprOrCondition(ExprResult &ExprResult,
Decl *&DeclResult,
SourceLocation Loc,
bool ConvertToBoolean) {
@@ -581,7 +581,7 @@
/// [C++] 'if' '(' condition ')' statement
/// [C++] 'if' '(' condition ')' statement 'else' statement
///
-Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
+StmtResult Parser::ParseIfStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@@ -611,7 +611,7 @@
ParseScope IfScope(this, Scope::DeclScope | Scope::ControlScope, C99orCXX);
// Parse the condition.
- OwningExprResult CondExp;
+ ExprResult CondExp;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(CondExp, CondVar, IfLoc, true))
return StmtError();
@@ -641,7 +641,7 @@
// Read the 'then' stmt.
SourceLocation ThenStmtLoc = Tok.getLocation();
- OwningStmtResult ThenStmt(ParseStatement());
+ StmtResult ThenStmt(ParseStatement());
// Pop the 'if' scope if needed.
InnerScope.Exit();
@@ -649,7 +649,7 @@
// If it has an else, parse it.
SourceLocation ElseLoc;
SourceLocation ElseStmtLoc;
- OwningStmtResult ElseStmt;
+ StmtResult ElseStmt;
if (Tok.is(tok::kw_else)) {
ElseLoc = ConsumeToken();
@@ -704,7 +704,7 @@
/// switch-statement:
/// 'switch' '(' expression ')' statement
/// [C++] 'switch' '(' condition ')' statement
-Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
+StmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@@ -737,12 +737,12 @@
ParseScope SwitchScope(this, ScopeFlags);
// Parse the condition.
- OwningExprResult Cond;
+ ExprResult Cond;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(Cond, CondVar, SwitchLoc, false))
return StmtError();
- OwningStmtResult Switch
+ StmtResult Switch
= Actions.ActOnStartOfSwitchStmt(SwitchLoc, Cond.get(), CondVar);
if (Switch.isInvalid()) {
@@ -773,7 +773,7 @@
C99orCXX && Tok.isNot(tok::l_brace));
// Read the body statement.
- OwningStmtResult Body(ParseStatement());
+ StmtResult Body(ParseStatement());
// Pop the scopes.
InnerScope.Exit();
@@ -790,7 +790,7 @@
/// while-statement: [C99 6.8.5.1]
/// 'while' '(' expression ')' statement
/// [C++] 'while' '(' condition ')' statement
-Parser::OwningStmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
+StmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@@ -827,7 +827,7 @@
ParseScope WhileScope(this, ScopeFlags);
// Parse the condition.
- OwningExprResult Cond;
+ ExprResult Cond;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(Cond, CondVar, WhileLoc, true))
return StmtError();
@@ -849,7 +849,7 @@
C99orCXX && Tok.isNot(tok::l_brace));
// Read the body statement.
- OwningStmtResult Body(ParseStatement());
+ StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
@@ -865,7 +865,7 @@
/// do-statement: [C99 6.8.5.2]
/// 'do' statement 'while' '(' expression ')' ';'
/// Note: this lets the caller parse the end ';'.
-Parser::OwningStmtResult Parser::ParseDoStatement(AttributeList *Attr) {
+StmtResult Parser::ParseDoStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@@ -895,7 +895,7 @@
Tok.isNot(tok::l_brace));
// Read the body statement.
- OwningStmtResult Body(ParseStatement());
+ StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
@@ -918,7 +918,7 @@
// Parse the parenthesized condition.
SourceLocation LPLoc = ConsumeParen();
- OwningExprResult Cond = ParseExpression();
+ ExprResult Cond = ParseExpression();
SourceLocation RPLoc = MatchRHSPunctuation(tok::r_paren, LPLoc);
DoScope.Exit();
@@ -942,7 +942,7 @@
/// [C++] expression-statement
/// [C++] simple-declaration
///
-Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
+StmtResult Parser::ParseForStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@@ -982,13 +982,13 @@
ParseScope ForScope(this, ScopeFlags);
SourceLocation LParenLoc = ConsumeParen();
- OwningExprResult Value;
+ ExprResult Value;
bool ForEach = false;
- OwningStmtResult FirstPart;
+ StmtResult FirstPart;
bool SecondPartIsInvalid = false;
FullExprArg SecondPart(Actions);
- OwningExprResult Collection;
+ ExprResult Collection;
FullExprArg ThirdPart(Actions);
Decl *SecondVar = 0;
@@ -1061,7 +1061,7 @@
if (Tok.is(tok::semi)) { // for (...;;
// no second part.
} else {
- OwningExprResult Second;
+ ExprResult Second;
if (getLang().CPlusPlus)
ParseCXXCondition(Second, SecondVar, ForLoc, true);
else {
@@ -1084,7 +1084,7 @@
// Parse the third part of the for specifier.
if (Tok.isNot(tok::r_paren)) { // for (...;...;)
- OwningExprResult Third = ParseExpression();
+ ExprResult Third = ParseExpression();
ThirdPart = Actions.MakeFullExpr(Third.take());
}
}
@@ -1106,7 +1106,7 @@
C99orCXXorObjC && Tok.isNot(tok::l_brace));
// Read the body statement.
- OwningStmtResult Body(ParseStatement());
+ StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
@@ -1135,14 +1135,14 @@
///
/// Note: this lets the caller parse the end ';'.
///
-Parser::OwningStmtResult Parser::ParseGotoStatement(AttributeList *Attr) {
+StmtResult Parser::ParseGotoStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
SourceLocation GotoLoc = ConsumeToken(); // eat the 'goto'.
- OwningStmtResult Res;
+ StmtResult Res;
if (Tok.is(tok::identifier)) {
Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(),
Tok.getIdentifierInfo());
@@ -1151,7 +1151,7 @@
// GNU indirect goto extension.
Diag(Tok, diag::ext_gnu_indirect_goto);
SourceLocation StarLoc = ConsumeToken();
- OwningExprResult R(ParseExpression());
+ ExprResult R(ParseExpression());
if (R.isInvalid()) { // Skip to the semicolon, but don't consume it.
SkipUntil(tok::semi, false, true);
return StmtError();
@@ -1171,7 +1171,7 @@
///
/// Note: this lets the caller parse the end ';'.
///
-Parser::OwningStmtResult Parser::ParseContinueStatement(AttributeList *Attr) {
+StmtResult Parser::ParseContinueStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@@ -1185,7 +1185,7 @@
///
/// Note: this lets the caller parse the end ';'.
///
-Parser::OwningStmtResult Parser::ParseBreakStatement(AttributeList *Attr) {
+StmtResult Parser::ParseBreakStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@@ -1196,14 +1196,14 @@
/// ParseReturnStatement
/// jump-statement:
/// 'return' expression[opt] ';'
-Parser::OwningStmtResult Parser::ParseReturnStatement(AttributeList *Attr) {
+StmtResult Parser::ParseReturnStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
assert(Tok.is(tok::kw_return) && "Not a return stmt!");
SourceLocation ReturnLoc = ConsumeToken(); // eat the 'return'.
- OwningExprResult R;
+ ExprResult R;
if (Tok.isNot(tok::semi)) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteReturn(getCurScope());
@@ -1223,7 +1223,7 @@
/// FuzzyParseMicrosoftAsmStatement. When -fms-extensions is enabled, this
/// routine is called to skip/ignore tokens that comprise the MS asm statement.
-Parser::OwningStmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
+StmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
if (Tok.is(tok::l_brace)) {
unsigned short savedBraceCount = BraceCount;
do {
@@ -1247,7 +1247,7 @@
t.setLiteralData("\"/*FIXME: not done*/\"");
t.clearFlag(Token::NeedsCleaning);
t.setLength(21);
- OwningExprResult AsmString(Actions.ActOnStringLiteral(&t, 1));
+ ExprResult AsmString(Actions.ActOnStringLiteral(&t, 1));
ExprVector Constraints(Actions);
ExprVector Exprs(Actions);
ExprVector Clobbers(Actions);
@@ -1284,7 +1284,7 @@
/// assembly-instruction ';'[opt]
/// assembly-instruction-list ';' assembly-instruction ';'[opt]
///
-Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) {
+StmtResult Parser::ParseAsmStatement(bool &msAsm) {
assert(Tok.is(tok::kw_asm) && "Not an asm stmt");
SourceLocation AsmLoc = ConsumeToken();
@@ -1311,7 +1311,7 @@
}
Loc = ConsumeParen();
- OwningExprResult AsmString(ParseAsmStringLiteral());
+ ExprResult AsmString(ParseAsmStringLiteral());
if (AsmString.isInvalid())
return StmtError();
@@ -1374,7 +1374,7 @@
// Parse the asm-string list for clobbers if present.
if (Tok.isNot(tok::r_paren)) {
while (1) {
- OwningExprResult Clobber(ParseAsmStringLiteral());
+ ExprResult Clobber(ParseAsmStringLiteral());
if (Clobber.isInvalid())
break;
@@ -1434,7 +1434,7 @@
} else
Names.push_back(0);
- OwningExprResult Constraint(ParseAsmStringLiteral());
+ ExprResult Constraint(ParseAsmStringLiteral());
if (Constraint.isInvalid()) {
SkipUntil(tok::r_paren);
return true;
@@ -1449,7 +1449,7 @@
// Read the parenthesized expression.
SourceLocation OpenLoc = ConsumeParen();
- OwningExprResult Res(ParseExpression());
+ ExprResult Res(ParseExpression());
MatchRHSPunctuation(tok::r_paren, OpenLoc);
if (Res.isInvalid()) {
SkipUntil(tok::r_paren);
@@ -1475,7 +1475,7 @@
// Do not enter a scope for the brace, as the arguments are in the same scope
// (the function body) as the body itself. Instead, just read the statement
// list and put it into a CompoundStmt for safe keeping.
- OwningStmtResult FnBody(ParseCompoundStatementBody());
+ StmtResult FnBody(ParseCompoundStatementBody());
// If the function body could not be parsed, make a bogus compoundstmt.
if (FnBody.isInvalid())
@@ -1503,7 +1503,7 @@
ParseConstructorInitializer(Decl);
SourceLocation LBraceLoc = Tok.getLocation();
- OwningStmtResult FnBody(ParseCXXTryBlockCommon(TryLoc));
+ StmtResult FnBody(ParseCXXTryBlockCommon(TryLoc));
// If we failed to parse the try-catch, we just give the function an empty
// compound statement as the body.
if (FnBody.isInvalid())
@@ -1518,7 +1518,7 @@
/// try-block:
/// 'try' compound-statement handler-seq
///
-Parser::OwningStmtResult Parser::ParseCXXTryBlock(AttributeList* Attr) {
+StmtResult Parser::ParseCXXTryBlock(AttributeList* Attr) {
// FIXME: Add attributes?
delete Attr;
@@ -1540,11 +1540,11 @@
/// handler-seq:
/// handler handler-seq[opt]
///
-Parser::OwningStmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) {
+StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) {
if (Tok.isNot(tok::l_brace))
return StmtError(Diag(Tok, diag::err_expected_lbrace));
// FIXME: Possible draft standard bug: attribute-specifier should be allowed?
- OwningStmtResult TryBlock(ParseCompoundStatement(0));
+ StmtResult TryBlock(ParseCompoundStatement(0));
if (TryBlock.isInvalid())
return move(TryBlock);
@@ -1557,7 +1557,7 @@
if (Tok.isNot(tok::kw_catch))
return StmtError(Diag(Tok, diag::err_expected_catch));
while (Tok.is(tok::kw_catch)) {
- OwningStmtResult Handler(ParseCXXCatchBlock());
+ StmtResult Handler(ParseCXXCatchBlock());
if (!Handler.isInvalid())
Handlers.push_back(Handler.release());
}
@@ -1580,7 +1580,7 @@
/// type-specifier-seq
/// '...'
///
-Parser::OwningStmtResult Parser::ParseCXXCatchBlock() {
+StmtResult Parser::ParseCXXCatchBlock() {
assert(Tok.is(tok::kw_catch) && "Expected 'catch'");
SourceLocation CatchLoc = ConsumeToken();
@@ -1614,7 +1614,7 @@
return StmtError(Diag(Tok, diag::err_expected_lbrace));
// FIXME: Possible draft standard bug: attribute-specifier should be allowed?
- OwningStmtResult Block(ParseCompoundStatement(0));
+ StmtResult Block(ParseCompoundStatement(0));
if (Block.isInvalid())
return move(Block);
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index a1c64ea..d9a468e 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -601,7 +601,7 @@
// Per C++0x [basic.scope.pdecl]p9, we parse the default argument before
// we introduce the template parameter into the local scope.
SourceLocation EqualLoc;
- OwningExprResult DefaultArg;
+ ExprResult DefaultArg;
if (Tok.is(tok::equal)) {
EqualLoc = ConsumeToken();
@@ -988,7 +988,7 @@
// Parse a non-type template argument.
SourceLocation Loc = Tok.getLocation();
- OwningExprResult ExprArg = ParseConstantExpression();
+ ExprResult ExprArg = ParseConstantExpression();
if (ExprArg.isInvalid() || !ExprArg.get())
return ParsedTemplateArgument();
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index a339894..2f5070c 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -436,7 +436,7 @@
Diag(Attr.Range.getBegin(), diag::err_attributes_not_allowed)
<< Attr.Range;
- OwningExprResult Result(ParseSimpleAsm());
+ ExprResult Result(ParseSimpleAsm());
ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
"top-level asm block");
@@ -829,13 +829,13 @@
/// [GNU] asm-string-literal:
/// string-literal
///
-Parser::OwningExprResult Parser::ParseAsmStringLiteral() {
+Parser::ExprResult Parser::ParseAsmStringLiteral() {
if (!isTokenStringLiteral()) {
Diag(Tok, diag::err_expected_string_literal);
return ExprError();
}
- OwningExprResult Res(ParseStringLiteralExpression());
+ ExprResult Res(ParseStringLiteralExpression());
if (Res.isInvalid()) return move(Res);
// TODO: Diagnose: wide string literal in 'asm'
@@ -848,7 +848,7 @@
/// [GNU] simple-asm-expr:
/// 'asm' '(' asm-string-literal ')'
///
-Parser::OwningExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
+Parser::ExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
assert(Tok.is(tok::kw_asm) && "Not an asm!");
SourceLocation Loc = ConsumeToken();
@@ -869,7 +869,7 @@
Loc = ConsumeParen();
- OwningExprResult Result(ParseAsmStringLiteral());
+ ExprResult Result(ParseAsmStringLiteral());
if (Result.isInvalid()) {
SkipUntil(tok::r_paren, true, true);