Simplify the interface to ParseFunctionStatementBody to not take

locations that are the current tok loc.  Note that inline C++ methods
have a big fixme that could cause a crash.

llvm-svn: 66113
This commit is contained in:
Chris Lattner 2009-03-05 00:49:17 +00:00
parent ad6b47377f
commit 12f2ea5015
4 changed files with 10 additions and 8 deletions

View File

@ -788,8 +788,7 @@ private:
DeclTy *ParseDeclaration(unsigned Context);
DeclTy *ParseSimpleDeclaration(unsigned Context);
DeclTy *ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D);
DeclTy *ParseFunctionStatementBody(DeclTy *Decl,
SourceLocation L, SourceLocation R);
DeclTy *ParseFunctionStatementBody(DeclTy *Decl);
void ParseDeclarationSpecifiers(DeclSpec &DS,
TemplateParameterLists *TemplateParams = 0);
bool ParseOptionalTypeSpecifier(DeclSpec &DS, int &isInvalid,

View File

@ -136,8 +136,8 @@ void Parser::ParseLexedMethodDefs() {
if (Tok.is(tok::colon))
ParseConstructorInitializer(LM.D);
ParseFunctionStatementBody(LM.D, Tok.getLocation(), Tok.getLocation());
// FIXME: What if ParseConstructorInitializer doesn't leave us with a '{'??
ParseFunctionStatementBody(LM.D);
}
}

View File

@ -1284,8 +1284,10 @@ bool Parser::ParseAsmOperandsOpt(llvm::SmallVectorImpl<std::string> &Names,
return true;
}
Parser::DeclTy *Parser::ParseFunctionStatementBody(DeclTy *Decl,
SourceLocation L, SourceLocation R) {
Parser::DeclTy *Parser::ParseFunctionStatementBody(DeclTy *Decl) {
assert(Tok.is(tok::l_brace));
SourceLocation LBraceLoc = Tok.getLocation();
// 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.
@ -1293,7 +1295,8 @@ Parser::DeclTy *Parser::ParseFunctionStatementBody(DeclTy *Decl,
// If the function body could not be parsed, make a bogus compoundstmt.
if (FnBody.isInvalid())
FnBody = Actions.ActOnCompoundStmt(L, R, MultiStmtArg(Actions), false);
FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc,
MultiStmtArg(Actions), false);
return Actions.ActOnFinishFunctionBody(Decl, move(FnBody));
}

View File

@ -590,7 +590,7 @@ Parser::DeclTy *Parser::ParseFunctionDefinition(Declarator &D) {
ParseConstructorInitializer(Res);
SourceLocation BraceLoc = Tok.getLocation();
return ParseFunctionStatementBody(Res, BraceLoc, BraceLoc);
return ParseFunctionStatementBody(Res);
}
/// ParseKNRParamDeclarations - Parse 'declaration-list[opt]' which provides