Sundry incremental steps towards killing off Action.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111795 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 2113ac4..8a548cf 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -258,7 +258,7 @@
// correctly.
OwningExprResult ArgExpr(ParseAssignmentExpression());
if (!ArgExpr.isInvalid()) {
- ExprTy* ExprList = ArgExpr.take();
+ Expr *ExprList = ArgExpr.take();
CurrAttr = new AttributeList(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
SourceLocation(), &ExprList, 1,
CurrAttr, true);
@@ -900,7 +900,7 @@
goto DoneWithDeclSpec;
CXXScopeSpec SS;
- SS.setScopeRep(Tok.getAnnotationValue());
+ SS.setScopeRep((NestedNameSpecifier*) Tok.getAnnotationValue());
SS.setRange(Tok.getAnnotationRange());
// We are looking for a qualified typename.
@@ -2052,7 +2052,7 @@
SourceLocation IdentLoc = ConsumeToken();
SourceLocation EqualLoc;
- OwningExprResult AssignedVal(Actions);
+ OwningExprResult AssignedVal;
if (Tok.is(tok::equal)) {
EqualLoc = ConsumeToken();
AssignedVal = ParseConstantExpression();
@@ -3283,7 +3283,7 @@
}
// Remember that we parsed the empty array type.
- OwningExprResult NumElements(Actions);
+ OwningExprResult NumElements;
D.AddTypeInfo(DeclaratorChunk::getArray(0, false, false, 0,
StartLoc, EndLoc),
EndLoc);
@@ -3329,7 +3329,7 @@
// Handle "direct-declarator [ type-qual-list[opt] * ]".
bool isStar = false;
- OwningExprResult NumElements(Actions);
+ OwningExprResult 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
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 1673aa8..3687f54 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -1070,7 +1070,7 @@
ConsumeToken();
// Build up an array of parsed base specifiers.
- llvm::SmallVector<BaseTy *, 8> BaseInfo;
+ llvm::SmallVector<CXXBaseSpecifier *, 8> BaseInfo;
while (true) {
// Parse a base-specifier.
@@ -1406,8 +1406,8 @@
// member-declarator-list ',' member-declarator
llvm::SmallVector<Decl *, 8> DeclsInGroup;
- OwningExprResult BitfieldSize(Actions);
- OwningExprResult Init(Actions);
+ OwningExprResult BitfieldSize;
+ OwningExprResult Init;
bool Deleted = false;
while (1) {
@@ -1706,7 +1706,7 @@
SourceLocation ColonLoc = ConsumeToken();
- llvm::SmallVector<MemInitTy*, 4> MemInitializers;
+ llvm::SmallVector<CXXBaseOrMemberInitializer*, 4> MemInitializers;
bool AnyErrors = false;
do {
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 21033b4..f7b03f2 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -200,7 +200,7 @@
/// process of disambiguating between an expression and a declaration.
Parser::OwningExprResult
Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
- OwningExprResult LHS(Actions, true);
+ OwningExprResult LHS(true);
{
// Silence extension warnings in the sub-expression
ExtensionRAIIObject O(Diags);
@@ -290,7 +290,7 @@
ConsumeToken();
// Special case handling for the ternary operator.
- OwningExprResult TernaryMiddle(Actions, true);
+ OwningExprResult 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(Actions);
+ OwningExprResult RHS;
if (getLang().CPlusPlus && NextTokPrec <= prec::Conditional)
RHS = ParseAssignmentExpression();
else
@@ -549,7 +549,7 @@
bool isAddressOfOperand,
bool &NotCastExpr,
TypeTy *TypeOfCast) {
- OwningExprResult Res(Actions);
+ OwningExprResult Res;
tok::TokenKind SavedKind = Tok.getKind();
NotCastExpr = false;
@@ -1127,7 +1127,7 @@
OpTok.is(tok::kw___alignof) || OpTok.is(tok::kw_alignof)) &&
"Not a typeof/sizeof/alignof expression!");
- OwningExprResult Operand(Actions);
+ OwningExprResult Operand;
// If the operand doesn't start with an '(', it must be an expression.
if (Tok.isNot(tok::l_paren)) {
@@ -1241,7 +1241,7 @@
/// [GNU] offsetof-member-designator '[' expression ']'
///
Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
- OwningExprResult Res(Actions);
+ OwningExprResult Res;
const IdentifierInfo *BuiltinII = Tok.getIdentifierInfo();
tok::TokenKind T = Tok.getKind();
@@ -1428,7 +1428,7 @@
assert(Tok.is(tok::l_paren) && "Not a paren expr!");
GreaterThanIsOperatorScope G(GreaterThanIsOperator, true);
SourceLocation OpenLoc = ConsumeParen();
- OwningExprResult Result(Actions, true);
+ OwningExprResult Result(true);
bool isAmbiguousTypeId;
CastTy = 0;
@@ -1479,7 +1479,7 @@
// Note that this doesn't parse the subsequent cast-expression, it just
// returns the parsed type to the callee.
if (stopIfCastExpr)
- return OwningExprResult(Actions);
+ return OwningExprResult();
// Reject the cast of super idiom in ObjC.
if (Tok.is(tok::identifier) && getLang().ObjC1 &&
@@ -1585,12 +1585,13 @@
/// [C++] assignment-expression
/// [C++] expression-list , assignment-expression
///
-bool Parser::ParseExpressionList(ExprListTy &Exprs, CommaLocsTy &CommaLocs,
+bool Parser::ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs,
+ llvm::SmallVectorImpl<SourceLocation> &CommaLocs,
void (Action::*Completer)(Scope *S,
- void *Data,
- ExprTy **Args,
+ Expr *Data,
+ Expr **Args,
unsigned NumArgs),
- void *Data) {
+ Expr *Data) {
while (1) {
if (Tok.is(tok::code_completion)) {
if (Completer)
@@ -1723,7 +1724,7 @@
}
- OwningExprResult Result(Actions, true);
+ OwningExprResult Result(true);
if (!Tok.is(tok::l_brace)) {
// Saw something like: ^expr
Diag(Tok, diag::err_expected_expression);
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 55d2d3b..606eb4c 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -64,7 +64,7 @@
"Call sites of this function should be guarded by checking for C++");
if (Tok.is(tok::annot_cxxscope)) {
- SS.setScopeRep(Tok.getAnnotationValue());
+ SS.setScopeRep(static_cast<NestedNameSpecifier*>(Tok.getAnnotationValue()));
SS.setRange(Tok.getAnnotationRange());
ConsumeToken();
return false;
@@ -507,7 +507,7 @@
"typeid"))
return ExprError();
- OwningExprResult Result(Actions);
+ OwningExprResult Result;
if (isTypeIdInParens()) {
TypeResult Ty = ParseTypeName();
@@ -1698,7 +1698,8 @@
/// new-placement:
/// '(' expression-list ')'
///
-bool Parser::ParseExpressionListOrTypeId(ExprListTy &PlacementArgs,
+bool Parser::ParseExpressionListOrTypeId(
+ llvm::SmallVectorImpl<Expr*> &PlacementArgs,
Declarator &D) {
// The '(' was already consumed.
if (isTypeIdInParens()) {
@@ -1809,7 +1810,7 @@
assert(ExprType == CastExpr && "Compound literals are not ambiguous!");
assert(isTypeIdInParens() && "Not a type-id!");
- OwningExprResult Result(Actions, true);
+ OwningExprResult Result(true);
CastTy = 0;
// 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 1380585..52b6e3c 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -137,7 +137,7 @@
// [4][foo bar] -> obsolete GNU designation with objc message send.
//
SourceLocation StartLoc = ConsumeBracket();
- OwningExprResult Idx(Actions);
+ OwningExprResult Idx;
// If Objective-C is enabled and this is a typename (class message
// send) or send to 'super', parse this as a message send
@@ -167,7 +167,7 @@
CheckArrayDesignatorSyntax(*this, StartLoc, Desig);
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
- TypeOrExpr,
+ TypeOrExpr,
ExprArg(Actions));
}
@@ -175,7 +175,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(Actions, TypeOrExpr);
+ Idx = OwningExprResult(static_cast<Expr*>(TypeOrExpr));
} else if (getLang().ObjC1 && Tok.is(tok::identifier)) {
IdentifierInfo *II = Tok.getIdentifierInfo();
SourceLocation IILoc = Tok.getLocation();
@@ -330,7 +330,7 @@
// If we know that this cannot be a designation, just parse the nested
// initializer directly.
- OwningExprResult SubElt(Actions);
+ OwningExprResult SubElt;
if (MayBeDesignationStart(Tok.getKind(), PP))
SubElt = ParseInitializerWithPotentialDesignator();
else
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 5861d95..1b456ed 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1458,7 +1458,7 @@
/// throw expression[opt];
///
Parser::OwningStmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
- OwningExprResult Res(Actions);
+ OwningExprResult Res;
ConsumeToken(); // consume throw
if (Tok.isNot(tok::semi)) {
Res = ParseExpression();
@@ -1529,7 +1529,7 @@
return StmtError();
}
StmtVector CatchStmts(Actions);
- OwningStmtResult FinallyStmt(Actions);
+ OwningStmtResult FinallyStmt;
ParseScope TryScope(this, Scope::DeclScope);
OwningStmtResult TryBody(ParseCompoundStatementBody());
TryScope.Exit();
@@ -1574,7 +1574,7 @@
else // Skip over garbage, until we get to ')'. Eat the ')'.
SkipUntil(tok::r_paren, true, false);
- OwningStmtResult CatchBody(Actions, true);
+ OwningStmtResult CatchBody(true);
if (Tok.is(tok::l_brace))
CatchBody = ParseCompoundStatementBody();
else
@@ -1600,7 +1600,7 @@
ConsumeToken(); // consume finally
ParseScope FinallyScope(this, Scope::DeclScope);
- OwningStmtResult FinallyBody(Actions, true);
+ OwningStmtResult FinallyBody(true);
if (Tok.is(tok::l_brace))
FinallyBody = ParseCompoundStatementBody();
else
@@ -1874,7 +1874,7 @@
if (IsExpr)
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), 0,
- OwningExprResult(Actions, TypeOrExpr));
+ OwningExprResult(static_cast<Expr*>(TypeOrExpr)));
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
TypeOrExpr, ExprArg(Actions));
diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp
index c468869..6c90e12 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(Actions);
+ Action::OwningExprResult 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 1e24380..de39a92 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -76,7 +76,7 @@
Parser::OwningStmtResult
Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
const char *SemiError = 0;
- OwningStmtResult Res(Actions);
+ OwningStmtResult Res;
ParenBraceBracketBalancer BalancerRAIIObj(*this);
@@ -272,7 +272,7 @@
// TopLevelCase - This is the highest level we have parsed. 'case 1' in the
// example above.
- OwningStmtResult TopLevelCase(Actions, true);
+ OwningStmtResult 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
@@ -301,7 +301,7 @@
// GNU case range extension.
SourceLocation DotDotDotLoc;
- OwningExprResult RHS(Actions);
+ OwningExprResult RHS;
if (Tok.is(tok::ellipsis)) {
Diag(Tok, diag::ext_gnu_case_range);
DotDotDotLoc = ConsumeToken();
@@ -336,7 +336,7 @@
} else {
// If this is the first case statement we parsed, it becomes TopLevelCase.
// Otherwise we link it into the current chain.
- StmtTy *NextDeepest = Case.get();
+ Stmt *NextDeepest = Case.get();
if (TopLevelCase.isInvalid())
TopLevelCase = move(Case);
else
@@ -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(Actions);
+ OwningStmtResult SubStmt;
if (Tok.isNot(tok::r_brace)) {
SubStmt = ParseStatement();
@@ -468,7 +468,7 @@
typedef StmtVector StmtsTy;
StmtsTy Stmts(Actions);
while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
- OwningStmtResult R(Actions);
+ OwningStmtResult R;
if (Tok.isNot(tok::kw___extension__)) {
R = ParseStatementOrDeclaration(false);
} else {
@@ -611,7 +611,7 @@
ParseScope IfScope(this, Scope::DeclScope | Scope::ControlScope, C99orCXX);
// Parse the condition.
- OwningExprResult CondExp(Actions);
+ OwningExprResult CondExp;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(CondExp, CondVar, IfLoc, true))
return StmtError();
@@ -649,7 +649,7 @@
// If it has an else, parse it.
SourceLocation ElseLoc;
SourceLocation ElseStmtLoc;
- OwningStmtResult ElseStmt(Actions);
+ OwningStmtResult ElseStmt;
if (Tok.is(tok::kw_else)) {
ElseLoc = ConsumeToken();
@@ -737,7 +737,7 @@
ParseScope SwitchScope(this, ScopeFlags);
// Parse the condition.
- OwningExprResult Cond(Actions);
+ OwningExprResult Cond;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(Cond, CondVar, SwitchLoc, false))
return StmtError();
@@ -827,7 +827,7 @@
ParseScope WhileScope(this, ScopeFlags);
// Parse the condition.
- OwningExprResult Cond(Actions);
+ OwningExprResult Cond;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(Cond, CondVar, WhileLoc, true))
return StmtError();
@@ -982,13 +982,13 @@
ParseScope ForScope(this, ScopeFlags);
SourceLocation LParenLoc = ConsumeParen();
- OwningExprResult Value(Actions);
+ OwningExprResult Value;
bool ForEach = false;
- OwningStmtResult FirstPart(Actions);
+ OwningStmtResult FirstPart;
bool SecondPartIsInvalid = false;
FullExprArg SecondPart(Actions);
- OwningExprResult Collection(Actions);
+ OwningExprResult Collection;
FullExprArg ThirdPart(Actions);
Decl *SecondVar = 0;
@@ -1051,7 +1051,7 @@
if (Tok.is(tok::semi)) { // for (...;;
// no second part.
} else {
- OwningExprResult Second(Actions);
+ OwningExprResult Second;
if (getLang().CPlusPlus)
ParseCXXCondition(Second, SecondVar, ForLoc, true);
else {
@@ -1132,7 +1132,7 @@
assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
SourceLocation GotoLoc = ConsumeToken(); // eat the 'goto'.
- OwningStmtResult Res(Actions);
+ OwningStmtResult Res;
if (Tok.is(tok::identifier)) {
Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(),
Tok.getIdentifierInfo());
@@ -1193,7 +1193,7 @@
assert(Tok.is(tok::kw_return) && "Not a return stmt!");
SourceLocation ReturnLoc = ConsumeToken(); // eat the 'return'.
- OwningExprResult R(Actions);
+ OwningExprResult R;
if (Tok.isNot(tok::semi)) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteReturn(getCurScope());
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index c584cd4..dec41d9 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(Actions);
+ OwningExprResult DefaultArg;
if (Tok.is(tok::equal)) {
EqualLoc = ConsumeToken();