diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-01-04 00:27:27 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-01-04 00:27:27 +0000 |
commit | bd9dfb2e297bb29f33d631566bcf0b6db6e3f61e (patch) | |
tree | eeaf4fb0200c05d8224775e502d846f00f8697a8 /clang/lib/Parse/ParseStmt.cpp | |
parent | e9249693806259e20740d0012566a2267493c857 (diff) | |
download | bcm5719-llvm-bd9dfb2e297bb29f33d631566bcf0b6db6e3f61e.tar.gz bcm5719-llvm-bd9dfb2e297bb29f33d631566bcf0b6db6e3f61e.zip |
Rename MaybeSkipFunctionBodyForCodeCompletion -> trySkippingFunctionBodyForCodeCompletion and check isCodeCompletionEnabled() before doing the call.
Suggestions by Chris.
llvm-svn: 122792
Diffstat (limited to 'clang/lib/Parse/ParseStmt.cpp')
-rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
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. |