diff options
-rw-r--r-- | clang/include/clang/Parse/Parser.h | 3 | ||||
-rw-r--r-- | clang/lib/Parse/ParseCXXInlineMethods.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 2 |
4 files changed, 10 insertions, 8 deletions
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index 5d5265df358..4efde44d1ec 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -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, diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 4aa923ca009..cc61f0f6fd3 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -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); } } diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 4f7affc69ca..1ecbe8bd84a 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -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)); } diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 30db5e67590..3cdaab6e889 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -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 |