locations that are the current tok loc. Note that inline C++ methods
have a big fixme that could cause a crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66113
91177308-0d34-0410-b5e6-
96231b3b80d8
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,
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);
}
}
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.
// 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));
}
ParseConstructorInitializer(Res);
SourceLocation BraceLoc = Tok.getLocation();
- return ParseFunctionStatementBody(Res, BraceLoc, BraceLoc);
+ return ParseFunctionStatementBody(Res);
}
/// ParseKNRParamDeclarations - Parse 'declaration-list[opt]' which provides