From bd9dfb2e297bb29f33d631566bcf0b6db6e3f61e Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 4 Jan 2011 00:27:27 +0000 Subject: Rename MaybeSkipFunctionBodyForCodeCompletion -> trySkippingFunctionBodyForCodeCompletion and check isCodeCompletionEnabled() before doing the call. Suggestions by Chris. llvm-svn: 122792 --- clang/lib/Parse/ParseStmt.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'clang/lib/Parse/ParseStmt.cpp') diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 28b140e731b..b1d40d2a5c1 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/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. -- cgit v1.2.3