[cfe-commits] r122781 - in /cfe/trunk: include/clang/Parse/Parser.h lib/Parse/ParseObjc.cpp lib/Parse/ParseStmt.cpp lib/Sema/SemaDecl.cpp test/Index/complete-synthesized.m

Chris Lattner clattner at apple.com
Mon Jan 3 15:57:30 PST 2011


On Jan 3, 2011, at 2:33 PM, Argyrios Kyrtzidis wrote:

> Author: akirtzidis
> Date: Mon Jan  3 16:33:06 2011
> New Revision: 122781
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=122781&view=rev
> Log:
> When in code-completion, skip obj-c method bodies for speed up.

Very nice.  A minor comment on the style of this.  Instead of:

> +  if (MaybeSkipFunctionBodyForCodeCompletion())
> +    return Actions.ActOnFinishFunctionBody(MDecl, 0);

I'd prefer that this look like:

  if (PP.isCodeCompletionEnabled())
    if (trySkippingFunctionBodyForCodeCompletion())
      return Actions.ActOnFinishFunctionBody(MDecl, 0);

Reasons why:

1. This isn't a hot codepath, but this is more efficient because the call won't happen when not in code completion mode.
2. "Maybe" as a prefix is bad because it doesn't mean anything :), and because it is capitalized.
3. It's now really clear reading this in Parser that this has no impact when code completion is off.

-Chris



More information about the cfe-commits mailing list