Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Option to format code with braces indented #17389

Open Quuxplusone opened 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR17390
Status NEW
Importance P enhancement
Reported by Chet Skolos (cskolos@hotmail.com)
Reported on 2013-09-27 18:06:38 -0700
Last modified on 2015-09-02 07:35:23 -0700
Version unspecified
Hardware PC All
CC alexfh@google.com, djasper@google.com, klimek@google.com, mydeveloperday@gmail.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
The Visual Studio 2012 IDE has a setting for this in Tools > Options > Text
Editor > C/C++ > Formatting > Indentation > Indent Braces

To clang-format, add an option to have braces indented when a brace is on its
own line (for example when BreakBeforeBraces is Allman).

Example:
Input of clang-format:
-----------
void foo()
{
  if (something) {
    dothat();
}
else if (somethingelse)
{
  dothis();
} else { domore(); }
dorest();
}

-----------

Output would be:
-----------

void foo()
  {
  if (something)
    {
    dothat();
    }
  else if (somethingelse)
    {
    dothis();
    }
  else
    {
    domore();
    }
  dorest();
  }
-----------
Quuxplusone commented 10 years ago

Patches are welcome ;)

Quuxplusone commented 9 years ago

I wonder if this is really Whitesmiths style

https://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style

one design might be new BreakBeforeBraces style of "Whitesmiths"