diff options
-rw-r--r-- | include/clang/Parse/Parser.h | 2 | ||||
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 5 | ||||
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 17 |
3 files changed, 13 insertions, 11 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index b1823d50e4..ce2692c619 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -1266,7 +1266,7 @@ private: /// unless the body contains the code-completion point. /// /// \returns true if the function body was skipped. - bool MaybeSkipFunctionBodyForCodeCompletion(); + bool trySkippingFunctionBodyForCodeCompletion(); bool ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, const ParsedTemplateInfo &TemplateInfo, diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 25829e8975..e1c36e8eaa 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1718,8 +1718,9 @@ Decl *Parser::ParseObjCMethodDefinition() { // specified Declarator for the method. Actions.ActOnStartOfObjCMethodDef(getCurScope(), MDecl); - if (MaybeSkipFunctionBodyForCodeCompletion()) - return Actions.ActOnFinishFunctionBody(MDecl, 0); + if (PP.isCodeCompletionEnabled()) + if (trySkippingFunctionBodyForCodeCompletion()) + return Actions.ActOnFinishFunctionBody(MDecl, 0); StmtResult FnBody(ParseCompoundStatementBody()); diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 28b140e731..b1d40d2a5c 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -1466,8 +1466,9 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl) { assert(Tok.is(tok::l_brace)); SourceLocation LBraceLoc = Tok.getLocation(); - if (MaybeSkipFunctionBodyForCodeCompletion()) - return Actions.ActOnFinishFunctionBody(Decl, 0); + if (PP.isCodeCompletionEnabled()) + if (trySkippingFunctionBodyForCodeCompletion()) + return Actions.ActOnFinishFunctionBody(Decl, 0); PrettyDeclStackTraceEntry CrashInfo(Actions, Decl, LBraceLoc, "parsing function body"); @@ -1501,8 +1502,9 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl) { if (Tok.is(tok::colon)) ParseConstructorInitializer(Decl); - if (MaybeSkipFunctionBodyForCodeCompletion()) - return Actions.ActOnFinishFunctionBody(Decl, 0); + if (PP.isCodeCompletionEnabled()) + if (trySkippingFunctionBodyForCodeCompletion()) + return Actions.ActOnFinishFunctionBody(Decl, 0); SourceLocation LBraceLoc = Tok.getLocation(); StmtResult FnBody(ParseCXXTryBlockCommon(TryLoc)); @@ -1515,11 +1517,10 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl) { return Actions.ActOnFinishFunctionBody(Decl, FnBody.take()); } -bool Parser::MaybeSkipFunctionBodyForCodeCompletion() { +bool Parser::trySkippingFunctionBodyForCodeCompletion() { assert(Tok.is(tok::l_brace)); - - if (!PP.isCodeCompletionEnabled()) - return false; + assert(PP.isCodeCompletionEnabled() && + "Should only be called when in code-completion mode"); // We're in code-completion mode. Skip parsing for all function bodies unless // the body contains the code-completion point. |