summaryrefslogtreecommitdiffstats
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
commitbd9dfb2e297bb29f33d631566bcf0b6db6e3f61e (patch)
treeeeaf4fb0200c05d8224775e502d846f00f8697a8
parente9249693806259e20740d0012566a2267493c857 (diff)
downloadbcm5719-llvm-bd9dfb2e297bb29f33d631566bcf0b6db6e3f61e.tar.gz
bcm5719-llvm-bd9dfb2e297bb29f33d631566bcf0b6db6e3f61e.zip
Rename MaybeSkipFunctionBodyForCodeCompletion -> trySkippingFunctionBodyForCodeCompletion and check isCodeCompletionEnabled() before doing the call.
Suggestions by Chris. llvm-svn: 122792
-rw-r--r--clang/include/clang/Parse/Parser.h2
-rw-r--r--clang/lib/Parse/ParseObjc.cpp5
-rw-r--r--clang/lib/Parse/ParseStmt.cpp17
3 files changed, 13 insertions, 11 deletions
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index b1823d50e4c..ce2692c6194 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/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/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