[cfe-commits] r122792 - in /cfe/trunk: include/clang/Parse/Parser.h lib/Parse/ParseObjc.cpp lib/Parse/ParseStmt.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Jan 3 16:27:27 PST 2011


Author: akirtzidis
Date: Mon Jan  3 18:27:27 2011
New Revision: 122792

URL: http://llvm.org/viewvc/llvm-project?rev=122792&view=rev
Log:
Rename MaybeSkipFunctionBodyForCodeCompletion -> trySkippingFunctionBodyForCodeCompletion and check isCodeCompletionEnabled() before doing the call.
Suggestions by Chris.

Modified:
    cfe/trunk/include/clang/Parse/Parser.h
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/lib/Parse/ParseStmt.cpp

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=122792&r1=122791&r2=122792&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Mon Jan  3 18:27:27 2011
@@ -1266,7 +1266,7 @@
   /// 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,

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=122792&r1=122791&r2=122792&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Mon Jan  3 18:27:27 2011
@@ -1718,8 +1718,9 @@
   // 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());
 

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=122792&r1=122791&r2=122792&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Mon Jan  3 18:27:27 2011
@@ -1466,8 +1466,9 @@
   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 @@
   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 @@
   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.





More information about the cfe-commits mailing list