summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp5
-rw-r--r--clang/lib/Parse/ParseStmt.cpp17
2 files changed, 12 insertions, 10 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 25829e8975f..e1c36e8eaac 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/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/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.
OpenPOWER on IntegriCloud