From 1b273c403734d343d720acb28f04011807c8aa56 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Sun, 16 Sep 2007 14:56:35 +0000 Subject: [PATCH] Rename statement actions (from Parse-prefix to ActOn-prefix). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42000 91177308-0d34-0410-b5e6-96231b3b80d8 --- Parse/ParseExpr.cpp | 10 +++--- Parse/ParseExprCXX.cpp | 4 +-- Parse/ParseStmt.cpp | 62 ++++++++++++++++++------------------ Sema/Sema.h | 58 ++++++++++++++++----------------- Sema/SemaExpr.cpp | 12 +++---- Sema/SemaExprCXX.cpp | 8 ++--- Sema/SemaStmt.cpp | 46 +++++++++++++------------- include/clang/Parse/Action.h | 58 ++++++++++++++++----------------- 8 files changed, 129 insertions(+), 129 deletions(-) diff --git a/Parse/ParseExpr.cpp b/Parse/ParseExpr.cpp index e4e30638d1..2e2a64ef88 100644 --- a/Parse/ParseExpr.cpp +++ b/Parse/ParseExpr.cpp @@ -578,7 +578,7 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) { } Diag(AmpAmpLoc, diag::ext_gnu_address_of_label); - Res = Actions.ParseAddrLabel(AmpAmpLoc, Tok.getLocation(), + Res = Actions.ActOnAddrLabel(AmpAmpLoc, Tok.getLocation(), Tok.getIdentifierInfo()); ConsumeToken(); return Res; @@ -848,7 +848,7 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() { Comps.back().LocEnd = MatchRHSPunctuation(tok::r_square, Comps.back().LocStart); } else if (Tok.getKind() == tok::r_paren) { - Res = Actions.ParseBuiltinOffsetOf(StartLoc, TypeLoc, Ty, &Comps[0], + Res = Actions.ActOnBuiltinOffsetOf(StartLoc, TypeLoc, Ty, &Comps[0], Comps.size(), ConsumeParen()); break; } else { @@ -884,7 +884,7 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() { Diag(Tok, diag::err_expected_rparen); return ExprResult(true); } - Res = Actions.ParseChooseExpr(StartLoc, Cond.Val, Expr1.Val, Expr2.Val, + Res = Actions.ActOnChooseExpr(StartLoc, Cond.Val, Expr1.Val, Expr2.Val, ConsumeParen()); break; } @@ -900,7 +900,7 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() { Diag(Tok, diag::err_expected_rparen); return ExprResult(true); } - Res = Actions.ParseTypesCompatibleExpr(StartLoc, Ty1, Ty2, ConsumeParen()); + Res = Actions.ActOnTypesCompatibleExpr(StartLoc, Ty1, Ty2, ConsumeParen()); break; } @@ -937,7 +937,7 @@ Parser::ExprResult Parser::ParseParenExpression(ParenParseOption &ExprType, // If the substmt parsed correctly, build the AST node. if (!Stmt.isInvalid && Tok.getKind() == tok::r_paren) - Result = Actions.ParseStmtExpr(OpenLoc, Stmt.Val, Tok.getLocation()); + Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.Val, Tok.getLocation()); } else if (ExprType >= CompoundLiteral && isTypeSpecifierQualifier()) { // Otherwise, this is a compound literal expression or cast expression. diff --git a/Parse/ParseExprCXX.cpp b/Parse/ParseExprCXX.cpp index 7048660467..192172d242 100644 --- a/Parse/ParseExprCXX.cpp +++ b/Parse/ParseExprCXX.cpp @@ -60,7 +60,7 @@ Parser::ExprResult Parser::ParseCXXCasts() { ExprResult Result = ParseSimpleParenExpression(RParenLoc); if (!Result.isInvalid) - Result = Actions.ParseCXXCasts(OpLoc, Kind, + Result = Actions.ActOnCXXCasts(OpLoc, Kind, LAngleBracketLoc, CastTy, RAngleBracketLoc, LParenLoc, Result.Val, RParenLoc); @@ -74,5 +74,5 @@ Parser::ExprResult Parser::ParseCXXCasts() { /// 'false' Parser::ExprResult Parser::ParseCXXBoolLiteral() { tok::TokenKind Kind = Tok.getKind(); - return Actions.ParseCXXBoolLiteral(ConsumeToken(), Kind); + return Actions.ActOnCXXBoolLiteral(ConsumeToken(), Kind); } diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp index 95008cdc80..fb4fe1e339 100644 --- a/Parse/ParseStmt.cpp +++ b/Parse/ParseStmt.cpp @@ -84,7 +84,7 @@ Parser::StmtResult Parser::ParseStatementOrDeclaration(bool OnlyStatement) { default: if (!OnlyStatement && isDeclarationSpecifier()) { - return Actions.ParseDeclStmt(ParseDeclaration(Declarator::BlockContext)); + return Actions.ActOnDeclStmt(ParseDeclaration(Declarator::BlockContext)); } else if (Tok.getKind() == tok::r_brace) { Diag(Tok, diag::err_expected_statement); return true; @@ -100,7 +100,7 @@ Parser::StmtResult Parser::ParseStatementOrDeclaration(bool OnlyStatement) { } // Otherwise, eat the semicolon. ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr); - return Actions.ParseExprStmt(Res.Val); + return Actions.ActOnExprStmt(Res.Val); } case tok::kw_case: // C99 6.8.1: labeled-statement @@ -111,7 +111,7 @@ Parser::StmtResult Parser::ParseStatementOrDeclaration(bool OnlyStatement) { case tok::l_brace: // C99 6.8.2: compound-statement return ParseCompoundStatement(); case tok::semi: // C99 6.8.3p3: expression[opt] ';' - return Actions.ParseNullStmt(ConsumeToken()); + return Actions.ActOnNullStmt(ConsumeToken()); case tok::kw_if: // C99 6.8.4.1: if-statement return ParseIfStatement(); @@ -193,9 +193,9 @@ Parser::StmtResult Parser::ParseIdentifierStatement(bool OnlyStatement) { // Broken substmt shouldn't prevent the label from being added to the AST. if (SubStmt.isInvalid) - SubStmt = Actions.ParseNullStmt(ColonLoc); + SubStmt = Actions.ActOnNullStmt(ColonLoc); - return Actions.ParseLabelStmt(IdentTok.getLocation(), + return Actions.ActOnLabelStmt(IdentTok.getLocation(), IdentTok.getIdentifierInfo(), ColonLoc, SubStmt.Val); } @@ -233,7 +233,7 @@ Parser::StmtResult Parser::ParseIdentifierStatement(bool OnlyStatement) { ParseDeclarator(DeclaratorInfo); DeclTy *Decl = ParseInitDeclaratorListAfterFirstDeclarator(DeclaratorInfo); - return Decl ? Actions.ParseDeclStmt(Decl) : 0; + return Decl ? Actions.ActOnDeclStmt(Decl) : 0; } // Otherwise, this is an expression. Seed it with II and parse it. @@ -248,7 +248,7 @@ Parser::StmtResult Parser::ParseIdentifierStatement(bool OnlyStatement) { } else { ConsumeToken(); // Convert expr to a stmt. - return Actions.ParseExprStmt(Res.Val); + return Actions.ActOnExprStmt(Res.Val); } } @@ -302,9 +302,9 @@ Parser::StmtResult Parser::ParseCaseStatement() { // Broken substmt shouldn't prevent the case from being added to the AST. if (SubStmt.isInvalid) - SubStmt = Actions.ParseNullStmt(ColonLoc); + SubStmt = Actions.ActOnNullStmt(ColonLoc); - return Actions.ParseCaseStmt(CaseLoc, LHS.Val, DotDotDotLoc, RHSVal, ColonLoc, + return Actions.ActOnCaseStmt(CaseLoc, LHS.Val, DotDotDotLoc, RHSVal, ColonLoc, SubStmt.Val); } @@ -335,7 +335,7 @@ Parser::StmtResult Parser::ParseDefaultStatement() { if (SubStmt.isInvalid) return true; - return Actions.ParseDefaultStmt(DefaultLoc, ColonLoc, SubStmt.Val, CurScope); + return Actions.ActOnDefaultStmt(DefaultLoc, ColonLoc, SubStmt.Val, CurScope); } @@ -382,7 +382,7 @@ Parser::StmtResult Parser::ParseCompoundStatement(bool isStmtExpr) { /// ParseCompoundStatementBody - Parse a sequence of statements and invoke the -/// ParseCompoundStmt action. This expects the '{' to be the current token, and +/// 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::StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { @@ -408,7 +408,7 @@ Parser::StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { if (isDeclarationSpecifier()) { // FIXME: Save the __extension__ on the decl as a node somehow. // FIXME: disable extwarns. - R = Actions.ParseDeclStmt(ParseDeclaration(Declarator::BlockContext)); + R = Actions.ActOnDeclStmt(ParseDeclaration(Declarator::BlockContext)); } else { // Otherwise this was a unary __extension__ marker. Parse the // subexpression and add the __extension__ unary op. @@ -426,7 +426,7 @@ Parser::StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { // Eat the semicolon at the end of stmt and convert the expr into a stmt. ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr); - R = Actions.ParseExprStmt(Res.Val); + R = Actions.ActOnExprStmt(Res.Val); } } @@ -441,7 +441,7 @@ Parser::StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { } SourceLocation RBraceLoc = ConsumeBrace(); - return Actions.ParseCompoundStmt(LBraceLoc, RBraceLoc, + return Actions.ActOnCompoundStmt(LBraceLoc, RBraceLoc, &Stmts[0], Stmts.size(), isStmtExpr); } @@ -485,7 +485,7 @@ Parser::StmtResult Parser::ParseIfStatement() { // Broken substmt shouldn't prevent the label from being added to the AST. if (CondStmt.isInvalid) - CondStmt = Actions.ParseNullStmt(Tok.getLocation()); + CondStmt = Actions.ActOnNullStmt(Tok.getLocation()); // Pop the 'if' scope if needed. if (NeedsInnerScope) ExitScope(); @@ -509,13 +509,13 @@ Parser::StmtResult Parser::ParseIfStatement() { if (NeedsInnerScope) ExitScope(); if (ElseStmt.isInvalid) - ElseStmt = Actions.ParseNullStmt(ElseLoc); + ElseStmt = Actions.ActOnNullStmt(ElseLoc); } if (getLang().C99) ExitScope(); - return Actions.ParseIfStmt(IfLoc, CondExp.Val, CondStmt.Val, + return Actions.ActOnIfStmt(IfLoc, CondExp.Val, CondStmt.Val, ElseLoc, ElseStmt.Val); } @@ -547,7 +547,7 @@ Parser::StmtResult Parser::ParseSwitchStatement() { return true; } - StmtResult Switch = Actions.StartSwitchStmt(Cond.Val); + StmtResult Switch = Actions.ActOnStartOfSwitchStmt(Cond.Val); // C99 6.8.4p3 - In C99, the body of the switch statement is a scope, even if // there is no compound stmt. C90 does not have this clause. We only do this @@ -562,13 +562,13 @@ Parser::StmtResult Parser::ParseSwitchStatement() { if (NeedsInnerScope) ExitScope(); if (Body.isInvalid) { - Body = Actions.ParseNullStmt(Tok.getLocation()); + Body = Actions.ActOnNullStmt(Tok.getLocation()); // FIXME: Remove the case statement list from the Switch statement. } ExitScope(); - return Actions.FinishSwitchStmt(SwitchLoc, Switch.Val, Body.Val); + return Actions.ActOnFinishSwitchStmt(SwitchLoc, Switch.Val, Body.Val); } /// ParseWhileStatement @@ -611,7 +611,7 @@ Parser::StmtResult Parser::ParseWhileStatement() { if (Cond.isInvalid || Body.isInvalid) return true; - return Actions.ParseWhileStmt(WhileLoc, Cond.Val, Body.Val); + return Actions.ActOnWhileStmt(WhileLoc, Cond.Val, Body.Val); } /// ParseDoStatement @@ -664,7 +664,7 @@ Parser::StmtResult Parser::ParseDoStatement() { if (Cond.isInvalid || Body.isInvalid) return true; - return Actions.ParseDoStmt(DoLoc, Body.Val, WhileLoc, Cond.Val); + return Actions.ActOnDoStmt(DoLoc, Body.Val, WhileLoc, Cond.Val); } /// ParseForStatement @@ -704,14 +704,14 @@ Parser::StmtResult Parser::ParseForStatement() { if (!getLang().C99) // Use of C99-style for loops in C90 mode? Diag(Tok, diag::ext_c99_variable_decl_in_for_loop); DeclTy *aBlockVarDecl = ParseDeclaration(Declarator::ForContext); - StmtResult stmtResult = Actions.ParseDeclStmt(aBlockVarDecl); + StmtResult stmtResult = Actions.ActOnDeclStmt(aBlockVarDecl); FirstPart = stmtResult.isInvalid ? 0 : stmtResult.Val; } else { Value = ParseExpression(); // Turn the expression into a stmt. if (!Value.isInvalid) { - StmtResult R = Actions.ParseExprStmt(Value.Val); + StmtResult R = Actions.ActOnExprStmt(Value.Val); if (!R.isInvalid) FirstPart = R.Val; } @@ -749,7 +749,7 @@ Parser::StmtResult Parser::ParseForStatement() { Value = ParseExpression(); if (!Value.isInvalid) { // Turn the expression into a stmt. - StmtResult R = Actions.ParseExprStmt(Value.Val); + StmtResult R = Actions.ActOnExprStmt(Value.Val); if (!R.isInvalid) ThirdPart = R.Val; } @@ -776,7 +776,7 @@ Parser::StmtResult Parser::ParseForStatement() { if (Body.isInvalid) return Body; - return Actions.ParseForStmt(ForLoc, LParenLoc, FirstPart, SecondPart, + return Actions.ActOnForStmt(ForLoc, LParenLoc, FirstPart, SecondPart, ThirdPart, RParenLoc, Body.Val); } @@ -793,7 +793,7 @@ Parser::StmtResult Parser::ParseGotoStatement() { StmtResult Res; if (Tok.getKind() == tok::identifier) { - Res = Actions.ParseGotoStmt(GotoLoc, Tok.getLocation(), + Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(), Tok.getIdentifierInfo()); ConsumeToken(); } else if (Tok.getKind() == tok::star && !getLang().NoExtensions) { @@ -805,7 +805,7 @@ Parser::StmtResult Parser::ParseGotoStatement() { SkipUntil(tok::semi, false, true); return true; } - Res = Actions.ParseIndirectGotoStmt(GotoLoc, StarLoc, R.Val); + Res = Actions.ActOnIndirectGotoStmt(GotoLoc, StarLoc, R.Val); } else { Diag(Tok, diag::err_expected_ident); return true; @@ -822,7 +822,7 @@ Parser::StmtResult Parser::ParseGotoStatement() { /// Parser::StmtResult Parser::ParseContinueStatement() { SourceLocation ContinueLoc = ConsumeToken(); // eat the 'continue'. - return Actions.ParseContinueStmt(ContinueLoc, CurScope); + return Actions.ActOnContinueStmt(ContinueLoc, CurScope); } /// ParseBreakStatement @@ -833,7 +833,7 @@ Parser::StmtResult Parser::ParseContinueStatement() { /// Parser::StmtResult Parser::ParseBreakStatement() { SourceLocation BreakLoc = ConsumeToken(); // eat the 'break'. - return Actions.ParseBreakStmt(BreakLoc, CurScope); + return Actions.ActOnBreakStmt(BreakLoc, CurScope); } /// ParseReturnStatement @@ -851,7 +851,7 @@ Parser::StmtResult Parser::ParseReturnStatement() { return true; } } - return Actions.ParseReturnStmt(ReturnLoc, R.Val); + return Actions.ActOnReturnStmt(ReturnLoc, R.Val); } /// ParseAsmStatement - Parse a GNU extended asm statement. diff --git a/Sema/Sema.h b/Sema/Sema.h index 900a913fd7..a6ce9cfbcf 100644 --- a/Sema/Sema.h +++ b/Sema/Sema.h @@ -203,47 +203,47 @@ private: //===--------------------------------------------------------------------===// // Statement Parsing Callbacks: SemaStmt.cpp. public: - virtual StmtResult ParseExprStmt(ExprTy *Expr); + virtual StmtResult ActOnExprStmt(ExprTy *Expr); - virtual StmtResult ParseNullStmt(SourceLocation SemiLoc); - virtual StmtResult ParseCompoundStmt(SourceLocation L, SourceLocation R, + virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc); + virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, StmtTy **Elts, unsigned NumElts, bool isStmtExpr); - virtual StmtResult ParseDeclStmt(DeclTy *Decl); - virtual StmtResult ParseCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal, + virtual StmtResult ActOnDeclStmt(DeclTy *Decl); + virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal, SourceLocation DotDotDotLoc, ExprTy *RHSVal, SourceLocation ColonLoc, StmtTy *SubStmt); - virtual StmtResult ParseDefaultStmt(SourceLocation DefaultLoc, + virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, StmtTy *SubStmt, Scope *CurScope); - virtual StmtResult ParseLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, + virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, SourceLocation ColonLoc, StmtTy *SubStmt); - virtual StmtResult ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal, + virtual StmtResult ActOnIfStmt(SourceLocation IfLoc, ExprTy *CondVal, StmtTy *ThenVal, SourceLocation ElseLoc, StmtTy *ElseVal); - virtual StmtResult StartSwitchStmt(ExprTy *Cond); - virtual StmtResult FinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch, + virtual StmtResult ActOnStartOfSwitchStmt(ExprTy *Cond); + virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch, ExprTy *Body); - virtual StmtResult ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, + virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body); - virtual StmtResult ParseDoStmt(SourceLocation DoLoc, StmtTy *Body, + virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body, SourceLocation WhileLoc, ExprTy *Cond); - virtual StmtResult ParseForStmt(SourceLocation ForLoc, + virtual StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, StmtTy *First, ExprTy *Second, ExprTy *Third, SourceLocation RParenLoc, StmtTy *Body); - virtual StmtResult ParseGotoStmt(SourceLocation GotoLoc, + virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, IdentifierInfo *LabelII); - virtual StmtResult ParseIndirectGotoStmt(SourceLocation GotoLoc, + virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, ExprTy *DestExp); - virtual StmtResult ParseContinueStmt(SourceLocation ContinueLoc, + virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope); - virtual StmtResult ParseBreakStmt(SourceLocation GotoLoc, Scope *CurScope); + virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc, Scope *CurScope); - virtual StmtResult ParseReturnStmt(SourceLocation ReturnLoc, + virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, ExprTy *RetValExp); //===--------------------------------------------------------------------===// @@ -309,39 +309,39 @@ public: SourceLocation ColonLoc, ExprTy *Cond, ExprTy *LHS, ExprTy *RHS); - /// ParseAddrLabel - Parse the GNU address of label extension: "&&foo". - virtual ExprResult ParseAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, + /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo". + virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, IdentifierInfo *LabelII); - virtual ExprResult ParseStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt, + virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt, SourceLocation RPLoc); // "({..})" /// __builtin_offsetof(type, a.b[123][456].c) - virtual ExprResult ParseBuiltinOffsetOf(SourceLocation BuiltinLoc, + virtual ExprResult ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc, SourceLocation TypeLoc, TypeTy *Arg1, OffsetOfComponent *CompPtr, unsigned NumComponents, SourceLocation RParenLoc); // __builtin_types_compatible_p(type1, type2) - virtual ExprResult ParseTypesCompatibleExpr(SourceLocation BuiltinLoc, + virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc, TypeTy *arg1, TypeTy *arg2, SourceLocation RPLoc); // __builtin_choose_expr(constExpr, expr1, expr2) - virtual ExprResult ParseChooseExpr(SourceLocation BuiltinLoc, + virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, ExprTy *cond, ExprTy *expr1, ExprTy *expr2, SourceLocation RPLoc); - /// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's. - virtual ExprResult ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind, + /// ActOnCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's. + virtual ExprResult ActOnCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, TypeTy *Ty, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, ExprTy *E, SourceLocation RParenLoc); - /// ParseCXXBoolLiteral - Parse {true,false} literals. - virtual ExprResult ParseCXXBoolLiteral(SourceLocation OpLoc, + /// ActOnCXXBoolLiteral - Parse {true,false} literals. + virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind); // ParseObjCStringLiteral - Parse Objective-C string literals. @@ -406,7 +406,7 @@ private: AssignmentCheckResult CheckAssignmentConstraints(QualType lhs, QualType rhs); // CheckSingleAssignmentConstraints - Currently used by ActOnCallExpr, - // CheckAssignmentOperands, and ParseReturnStmt. Prior to type checking, + // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking, // this routine performs the default function/array converions. AssignmentCheckResult CheckSingleAssignmentConstraints(QualType lhs, Expr *&rExpr); diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index b08508b2d4..b479c0a3ba 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -1685,8 +1685,8 @@ Action::ExprResult Sema::ActOnUnaryOp(SourceLocation OpLoc, tok::TokenKind Op, return new UnaryOperator(Input, Opc, resultType, OpLoc); } -/// ParseAddrLabel - Parse the GNU address of label extension: "&&foo". -Sema::ExprResult Sema::ParseAddrLabel(SourceLocation OpLoc, +/// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo". +Sema::ExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, IdentifierInfo *LabelII) { // Look up the record for this label identifier. @@ -1701,7 +1701,7 @@ Sema::ExprResult Sema::ParseAddrLabel(SourceLocation OpLoc, Context.getPointerType(Context.VoidTy)); } -Sema::ExprResult Sema::ParseStmtExpr(SourceLocation LPLoc, StmtTy *substmt, +Sema::ExprResult Sema::ActOnStmtExpr(SourceLocation LPLoc, StmtTy *substmt, SourceLocation RPLoc) { // "({..})" Stmt *SubStmt = static_cast(substmt); assert(SubStmt && isa(SubStmt) && "Invalid action invocation!"); @@ -1725,7 +1725,7 @@ Sema::ExprResult Sema::ParseStmtExpr(SourceLocation LPLoc, StmtTy *substmt, return new StmtExpr(Compound, Ty, LPLoc, RPLoc); } -Sema::ExprResult Sema::ParseBuiltinOffsetOf(SourceLocation BuiltinLoc, +Sema::ExprResult Sema::ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc, SourceLocation TypeLoc, TypeTy *argty, OffsetOfComponent *CompPtr, @@ -1799,7 +1799,7 @@ Sema::ExprResult Sema::ParseBuiltinOffsetOf(SourceLocation BuiltinLoc, } -Sema::ExprResult Sema::ParseTypesCompatibleExpr(SourceLocation BuiltinLoc, +Sema::ExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc, TypeTy *arg1, TypeTy *arg2, SourceLocation RPLoc) { QualType argT1 = QualType::getFromOpaquePtr(arg1); @@ -1810,7 +1810,7 @@ Sema::ExprResult Sema::ParseTypesCompatibleExpr(SourceLocation BuiltinLoc, return new TypesCompatibleExpr(Context.IntTy, BuiltinLoc, argT1, argT2,RPLoc); } -Sema::ExprResult Sema::ParseChooseExpr(SourceLocation BuiltinLoc, ExprTy *cond, +Sema::ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc, ExprTy *cond, ExprTy *expr1, ExprTy *expr2, SourceLocation RPLoc) { Expr *CondExpr = static_cast(cond); diff --git a/Sema/SemaExprCXX.cpp b/Sema/SemaExprCXX.cpp index be1d551cd6..0e3c968bca 100644 --- a/Sema/SemaExprCXX.cpp +++ b/Sema/SemaExprCXX.cpp @@ -16,9 +16,9 @@ #include "clang/AST/ASTContext.h" using namespace clang; -/// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's. +/// ActOnCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's. Action::ExprResult -Sema::ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind, +Sema::ActOnCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, TypeTy *Ty, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, ExprTy *E, @@ -36,9 +36,9 @@ Sema::ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind, return new CXXCastExpr(Op, QualType::getFromOpaquePtr(Ty), (Expr*)E, OpLoc); } -/// ParseCXXBoolLiteral - Parse {true,false} literals. +/// ActOnCXXBoolLiteral - Parse {true,false} literals. Action::ExprResult -Sema::ParseCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) { +Sema::ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) { assert((Kind != tok::kw_true || Kind != tok::kw_false) && "Unknown C++ Boolean value!"); return new CXXBoolLiteralExpr(Kind == tok::kw_true, Context.BoolTy, OpLoc); diff --git a/Sema/SemaStmt.cpp b/Sema/SemaStmt.cpp index 7dac6011f8..0522996a55 100644 --- a/Sema/SemaStmt.cpp +++ b/Sema/SemaStmt.cpp @@ -21,28 +21,28 @@ #include "clang/Lex/IdentifierTable.h" using namespace clang; -Sema::StmtResult Sema::ParseExprStmt(ExprTy *expr) { +Sema::StmtResult Sema::ActOnExprStmt(ExprTy *expr) { Expr *E = static_cast(expr); - assert(E && "ParseExprStmt(): missing expression"); + assert(E && "ActOnExprStmt(): missing expression"); return E; } -Sema::StmtResult Sema::ParseNullStmt(SourceLocation SemiLoc) { +Sema::StmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc) { return new NullStmt(SemiLoc); } -Sema::StmtResult Sema::ParseDeclStmt(DeclTy *decl) { +Sema::StmtResult Sema::ActOnDeclStmt(DeclTy *decl) { if (decl) { ScopedDecl *SD = dyn_cast(static_cast(decl)); - assert(SD && "Sema::ParseDeclStmt(): expected ScopedDecl"); + assert(SD && "Sema::ActOnDeclStmt(): expected ScopedDecl"); return new DeclStmt(SD); } else return true; // error } Action::StmtResult -Sema::ParseCompoundStmt(SourceLocation L, SourceLocation R, +Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, StmtTy **elts, unsigned NumElts, bool isStmtExpr) { Stmt **Elts = reinterpret_cast(elts); // If we're in C89 mode, check that we don't have any decls after stmts. If @@ -93,7 +93,7 @@ Sema::ParseCompoundStmt(SourceLocation L, SourceLocation R, } Action::StmtResult -Sema::ParseCaseStmt(SourceLocation CaseLoc, ExprTy *lhsval, +Sema::ActOnCaseStmt(SourceLocation CaseLoc, ExprTy *lhsval, SourceLocation DotDotDotLoc, ExprTy *rhsval, SourceLocation ColonLoc, StmtTy *subStmt) { Stmt *SubStmt = static_cast(subStmt); @@ -126,7 +126,7 @@ Sema::ParseCaseStmt(SourceLocation CaseLoc, ExprTy *lhsval, } Action::StmtResult -Sema::ParseDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, +Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, StmtTy *subStmt, Scope *CurScope) { Stmt *SubStmt = static_cast(subStmt); @@ -142,7 +142,7 @@ Sema::ParseDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, } Action::StmtResult -Sema::ParseLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, +Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, SourceLocation ColonLoc, StmtTy *subStmt) { Stmt *SubStmt = static_cast(subStmt); // Look up the record for this label identifier. @@ -170,11 +170,11 @@ Sema::ParseLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, } Action::StmtResult -Sema::ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal, +Sema::ActOnIfStmt(SourceLocation IfLoc, ExprTy *CondVal, StmtTy *ThenVal, SourceLocation ElseLoc, StmtTy *ElseVal) { Expr *condExpr = (Expr *)CondVal; - assert(condExpr && "ParseIfStmt(): missing expression"); + assert(condExpr && "ActOnIfStmt(): missing expression"); DefaultFunctionArrayConversion(condExpr); QualType condType = condExpr->getType(); @@ -187,7 +187,7 @@ Sema::ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal, } Action::StmtResult -Sema::StartSwitchStmt(ExprTy *cond) { +Sema::ActOnStartOfSwitchStmt(ExprTy *cond) { Expr *Cond = static_cast(cond); // C99 6.8.4.2p5 - Integer promotions are performed on the controlling expr. @@ -260,7 +260,7 @@ namespace { } Action::StmtResult -Sema::FinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch, ExprTy *Body) { +Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch, ExprTy *Body) { Stmt *BodyStmt = (Stmt*)Body; SwitchStmt *SS = SwitchStack.back(); @@ -440,9 +440,9 @@ Sema::FinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch, ExprTy *Body) { } Action::StmtResult -Sema::ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body) { +Sema::ActOnWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body) { Expr *condExpr = (Expr *)Cond; - assert(condExpr && "ParseWhileStmt(): missing expression"); + assert(condExpr && "ActOnWhileStmt(): missing expression"); DefaultFunctionArrayConversion(condExpr); QualType condType = condExpr->getType(); @@ -455,10 +455,10 @@ Sema::ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body) { } Action::StmtResult -Sema::ParseDoStmt(SourceLocation DoLoc, StmtTy *Body, +Sema::ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body, SourceLocation WhileLoc, ExprTy *Cond) { Expr *condExpr = (Expr *)Cond; - assert(condExpr && "ParseDoStmt(): missing expression"); + assert(condExpr && "ActOnDoStmt(): missing expression"); DefaultFunctionArrayConversion(condExpr); QualType condType = condExpr->getType(); @@ -471,7 +471,7 @@ Sema::ParseDoStmt(SourceLocation DoLoc, StmtTy *Body, } Action::StmtResult -Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, +Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, StmtTy *first, ExprTy *second, ExprTy *third, SourceLocation RParenLoc, StmtTy *body) { Stmt *First = static_cast(first); @@ -505,7 +505,7 @@ Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Action::StmtResult -Sema::ParseGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, +Sema::ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, IdentifierInfo *LabelII) { // Look up the record for this label identifier. LabelStmt *&LabelDecl = LabelMap[LabelII]; @@ -518,7 +518,7 @@ Sema::ParseGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, } Action::StmtResult -Sema::ParseIndirectGotoStmt(SourceLocation GotoLoc,SourceLocation StarLoc, +Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc,SourceLocation StarLoc, ExprTy *DestExp) { // FIXME: Verify that the operand is convertible to void*. @@ -526,7 +526,7 @@ Sema::ParseIndirectGotoStmt(SourceLocation GotoLoc,SourceLocation StarLoc, } Action::StmtResult -Sema::ParseContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) { +Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) { Scope *S = CurScope->getContinueParent(); if (!S) { // C99 6.8.6.2p1: A break shall appear only in or as a loop body. @@ -538,7 +538,7 @@ Sema::ParseContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) { } Action::StmtResult -Sema::ParseBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { +Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { Scope *S = CurScope->getBreakParent(); if (!S) { // C99 6.8.6.3p1: A break shall appear only in or as a switch/loop body. @@ -551,7 +551,7 @@ Sema::ParseBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { Action::StmtResult -Sema::ParseReturnStmt(SourceLocation ReturnLoc, ExprTy *rex) { +Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprTy *rex) { Expr *RetValExp = static_cast(rex); QualType lhsType = CurFunctionDecl->getResultType(); diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 5d5333cdcf..e16d3f0fe9 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -196,88 +196,88 @@ public: // Statement Parsing Callbacks. //===--------------------------------------------------------------------===// - virtual StmtResult ParseNullStmt(SourceLocation SemiLoc) { + virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc) { return 0; } - virtual StmtResult ParseCompoundStmt(SourceLocation L, SourceLocation R, + virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, StmtTy **Elts, unsigned NumElts, bool isStmtExpr) { return 0; } - virtual StmtResult ParseDeclStmt(DeclTy *Decl) { + virtual StmtResult ActOnDeclStmt(DeclTy *Decl) { return 0; } - virtual StmtResult ParseExprStmt(ExprTy *Expr) { + virtual StmtResult ActOnExprStmt(ExprTy *Expr) { return StmtResult(Expr); } - /// ParseCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension, + /// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension, /// which can specify an RHS value. - virtual StmtResult ParseCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal, + virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal, SourceLocation DotDotDotLoc, ExprTy *RHSVal, SourceLocation ColonLoc, StmtTy *SubStmt) { return 0; } - virtual StmtResult ParseDefaultStmt(SourceLocation DefaultLoc, + virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, StmtTy *SubStmt, Scope *CurScope){ return 0; } - virtual StmtResult ParseLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, + virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II, SourceLocation ColonLoc, StmtTy *SubStmt) { return 0; } - virtual StmtResult ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal, + virtual StmtResult ActOnIfStmt(SourceLocation IfLoc, ExprTy *CondVal, StmtTy *ThenVal, SourceLocation ElseLoc, StmtTy *ElseVal) { return 0; } - virtual StmtResult StartSwitchStmt(ExprTy *Cond) { + virtual StmtResult ActOnStartOfSwitchStmt(ExprTy *Cond) { return 0; } - virtual StmtResult FinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch, - ExprTy *Body) { + virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, + StmtTy *Switch, ExprTy *Body) { return 0; } - virtual StmtResult ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, + virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body) { return 0; } - virtual StmtResult ParseDoStmt(SourceLocation DoLoc, StmtTy *Body, + virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body, SourceLocation WhileLoc, ExprTy *Cond) { return 0; } - virtual StmtResult ParseForStmt(SourceLocation ForLoc, + virtual StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, StmtTy *First, ExprTy *Second, ExprTy *Third, SourceLocation RParenLoc, StmtTy *Body) { return 0; } - virtual StmtResult ParseGotoStmt(SourceLocation GotoLoc, + virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, IdentifierInfo *LabelII) { return 0; } - virtual StmtResult ParseIndirectGotoStmt(SourceLocation GotoLoc, + virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, ExprTy *DestExp) { return 0; } - virtual StmtResult ParseContinueStmt(SourceLocation ContinueLoc, + virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) { return 0; } - virtual StmtResult ParseBreakStmt(SourceLocation GotoLoc, Scope *CurScope) { + virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc, Scope *CurScope) { return 0; } - virtual StmtResult ParseReturnStmt(SourceLocation ReturnLoc, + virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, ExprTy *RetValExp) { return 0; } @@ -383,12 +383,12 @@ public: //===---------------------- GNU Extension Expressions -------------------===// - virtual ExprResult ParseAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, + virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, IdentifierInfo *LabelII) { // "&&foo" return 0; } - virtual ExprResult ParseStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt, + virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt, SourceLocation RPLoc) { // "({..})" return 0; } @@ -403,7 +403,7 @@ public: } U; }; - virtual ExprResult ParseBuiltinOffsetOf(SourceLocation BuiltinLoc, + virtual ExprResult ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc, SourceLocation TypeLoc, TypeTy *Arg1, OffsetOfComponent *CompPtr, unsigned NumComponents, @@ -412,13 +412,13 @@ public: } // __builtin_types_compatible_p(type1, type2) - virtual ExprResult ParseTypesCompatibleExpr(SourceLocation BuiltinLoc, + virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc, TypeTy *arg1, TypeTy *arg2, SourceLocation RPLoc) { return 0; } // __builtin_choose_expr(constExpr, expr1, expr2) - virtual ExprResult ParseChooseExpr(SourceLocation BuiltinLoc, + virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, ExprTy *cond, ExprTy *expr1, ExprTy *expr2, SourceLocation RPLoc) { return 0; @@ -426,8 +426,8 @@ public: //===------------------------- C++ Expressions --------------------------===// - /// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's. - virtual ExprResult ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind, + /// ActOnCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's. + virtual ExprResult ActOnCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, TypeTy *Ty, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, ExprTy *Op, @@ -435,8 +435,8 @@ public: return 0; } - /// ParseCXXBoolLiteral - Parse {true,false} literals. - virtual ExprResult ParseCXXBoolLiteral(SourceLocation OpLoc, + /// ActOnCXXBoolLiteral - Parse {true,false} literals. + virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) { return 0; }