aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-04 00:27:27 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-04 00:27:27 +0000
commitb162054ba8f5b64fe87fbc4837933ab23eebd52b (patch)
tree4421c4b4676ed5b6713211343fc6d833488c4044 /lib/Parse/ParseStmt.cpp
parent1b21391b3b1b7dd829c35f9b69199ed2a67da25a (diff)
Rename MaybeSkipFunctionBodyForCodeCompletion -> trySkippingFunctionBodyForCodeCompletion and check isCodeCompletionEnabled() before doing the call.
Suggestions by Chris. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122792 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r--lib/Parse/ParseStmt.cpp17
1 files changed, 9 insertions, 8 deletions
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.