From 289e4a37ee25a2d9fd0bcd26532570d24160e1d4 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 31 Oct 2012 17:29:28 +0000 Subject: [PATCH] If skipping bodies is enabled outside code-completion, just skip the body directly without using tentative parsing. llvm-svn: 167142 --- clang/lib/Parse/ParseStmt.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 04d950f..1511675 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -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; } -- 2.7.4