]> granicus.if.org Git - clang/commitdiff
If skipping bodies is enabled outside code-completion, just skip the body directly
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 31 Oct 2012 17:29:28 +0000 (17:29 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 31 Oct 2012 17:29:28 +0000 (17:29 +0000)
without using tentative parsing.

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

lib/Parse/ParseStmt.cpp

index 04d950fb7c79485d6df4421dcbe38286fa19f526..151167515ee7e0654b1ecc95bb8f11769e0622e3 100644 (file)
@@ -2028,12 +2028,18 @@ bool Parser::trySkippingFunctionBody() {
   assert(SkipFunctionBodies &&
          "Should only be called when SkipFunctionBodies is enabled");
 
+  if (!PP.isCodeCompletionEnabled()) {
+    ConsumeBrace();
+    SkipUntil(tok::r_brace, /*StopAtSemi=*/false, /*DontConsume=*/false);
+    return true;
+  }
+
   // We're in code-completion mode. Skip parsing for all function bodies unless
   // the body contains the code-completion point.
   TentativeParsingAction PA(*this);
   ConsumeBrace();
   if (SkipUntil(tok::r_brace, /*StopAtSemi=*/false, /*DontConsume=*/false,
-                /*StopAtCodeCompletion=*/PP.isCodeCompletionEnabled())) {
+                /*StopAtCodeCompletion=*/true)) {
     PA.Commit();
     return true;
   }