]> granicus.if.org Git - clang/commitdiff
Rename MaybeSkipFunctionBodyForCodeCompletion -> trySkippingFunctionBodyForCodeComple...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 4 Jan 2011 00:27:27 +0000 (00:27 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 4 Jan 2011 00:27:27 +0000 (00:27 +0000)
Suggestions by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122792 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Parser.h
lib/Parse/ParseObjc.cpp
lib/Parse/ParseStmt.cpp

index b1823d50e4cf10f35876f182f4aa4b290031958e..ce2692c6194f6a39c803ba165285fc61b19ff363 100644 (file)
@@ -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,
index 25829e8975fb7bb7c2e8af1652b48374ad836e54..e1c36e8eaacfa1a760ca84c5325f034962f0ece4 100644 (file)
@@ -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());
 
index 28b140e731bb986cb0d77fe5227685f51d7ea515..b1d40d2a5c14a3a0779240a2ebaf26ef9205f1dd 100644 (file)
@@ -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.