[cfe-users] clang-format "ContinuationIndentWidth: 3" format style	not working?
    Ray Mitchell via cfe-users 
    cfe-users at lists.llvm.org
       
    Fri Mar  2 17:41:18 PST 2018
    
    
  
Hello,
I am currently using the following format style options with clang-format v6.0.0:
---
Language:        Cpp
TabWidth: 3
IndentWidth: 3
ContinuationIndentWidth: 3
IndentCaseLabels: false
BreakBeforeBraces: Custom
BraceWrapping:
  AfterClass: true
  AfterControlStatement: true
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: true
  AfterStruct: true
  AfterUnion: true
  AfterExternBlock: true
  BeforeCatch: true
  BeforeElse: true
...
Here a snippet of my original code, which uses 3-space indents and doesn't look to me like it should be changed at all by clang-format:
   for (bin = hashTable->firstBin; bin < end; ++bin)
   {
      printf("%d entries for bin %d:\n",
         (int)bin->nodes, (int)(bin - hashTable->firstBin)); 
      PrintTree(bin->firstNode);
   }
However, clang-format changes the continuation line of printf as shown below.  Note that it is now indented by 7 spaces from the printf instead of the 3 spaces I would expect.  In addition, obviously 7 isn't even an integral multiple of 3.  Is there something additional I should specify to correct this?
   for (bin = hashTable->firstBin; bin < end; ++bin)
   {
      printf("%d entries for bin %d:\n",
             (int)bin->nodes, (int)(bin - hashTable->firstBin)); 
      PrintTree(bin->firstNode);
   }
   
Thanks,
Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20180302/08286158/attachment.html>
    
    
More information about the cfe-users
mailing list