]> granicus.if.org Git - clang/commitdiff
Simplify the interface to ParseFunctionStatementBody to not take
authorChris Lattner <sabre@nondot.org>
Thu, 5 Mar 2009 00:49:17 +0000 (00:49 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 5 Mar 2009 00:49:17 +0000 (00:49 +0000)
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

include/clang/Parse/Parser.h
lib/Parse/ParseCXXInlineMethods.cpp
lib/Parse/ParseStmt.cpp
lib/Parse/Parser.cpp

index 5d5265df358c708f231d7d862ad3a21ba3469279..4efde44d1ec39a1e2a8ff0d08704ccd10a31d177 100644 (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, 
index 4aa923ca009f08ce04c1b1a66612ba982fcb4510..cc61f0f6fd3006ac0b265a2bf1792ab8054ee54d 100644 (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);
   }
 }
 
index 4f7affc69cae49e77f6469dc0719916b2056ce66..1ecbe8bd84a647e9a4cdf26709708367c2d55bc1 100644 (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));
 }
index 30db5e67590ccc55d033aaedd7cb727ff7480359..3cdaab6e889453b976ba62a57517f3d348e8b911 100644 (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