[PATCH] D44609: [Clang-Format] New option BreakBeforeLambdaBody to manage lambda line break inside function parameter call
    Manuel Klimek via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Tue Jul  3 02:28:28 PDT 2018
    
    
  
klimek added inline comments.
================
Comment at: lib/Format/TokenAnnotator.cpp:627
     }
+    if(Style.BraceWrapping.BeforeLambdaBody && Current->is(TT_LambdaLSquare)) {
+        ++Left->BlockParameterCount;
----------------
Wawha wrote:
> klimek wrote:
> > Why do we want to increase the parameter count here? Specifically, why is it not enough to || this condition to the first is in the function?
> I'm not sure to understand. You want to move this test in the first "if" of updateParameterCount()?
> Like :
> 
> ```
> if ((Current->is(tok::l_brace) && Current->BlockKind == BK_Block) ||
>  Style.BraceWrapping.BeforeLambdaBody && Current->is(TT_LambdaLSquare))
> ++Left->BlockParameterCount;
> ```
> If it's the case, doing that won't work, because updateParameterCount() is call only for brace, not square, so the condition while be true only once and the BlockParameterCount while be equal to 1.
> And ContinuationIndenter::moveStatePastScopeOpener() while require a value greater than 1 to flag true 'HasMultipleNestedBlocks'.
> Same for ParameterCount.
> 
> I had this code because I was thinking that you want me to have this BlockParameterCount equal to 2 in case a lambda is alone inside a function.
Ok, sorry, I'll need to look at this on more detail again. If we only have one nested block Blockparametercount should probably be one. I'm unfortunately out for the next two weeks. If Sam or Daniel or somebody else can look at that it might work earlier, otherwise we'll need to wait. 
Repository:
  rC Clang
https://reviews.llvm.org/D44609
    
    
More information about the cfe-commits
mailing list