https://bugs.llvm.org/show_bug.cgi?id=40489

            Bug ID: 40489
           Summary: clang-format with BreakBeforeBraces: Allman removes
                    brace break at selector beginning
           Product: clang
           Version: 7.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: sop...@smartelectronix.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Created attachment 21391
  --> https://bugs.llvm.org/attachment.cgi?id=21391&action=edit
example source code + clang-format configuration file

The following code:

@interface Stuff
@end

@implementation Stuff

- (void)method
{
  int a = 0;
  if (YES)
  {
    a++;
  }
}

@end

if run through clang-form with configuration:
BreakBeforeBraces: Allman

then the method body changes to:
- (void)method {
  int a = 0;
  if (YES)
  {
    a++;
  }
}

which is incorrect brace breaking after the method signature.  Everything else,
like the if block, formats brace line breaks correctly.

I have attached the example source file and .clang-format and ran the following
with it:
clang-format -i test.m

This is a regression introduced in 7.0 (version 6.0.1 did not have this bug).

This is an upgrade blocker for me as it riddles Objective-C projects with new
diffs that are all incorrect.


I also tried adding the following language-specific section as an attempted
workaround:

---
Language: ObjC
BreakBeforeBraces: Custom
BraceWrapping:
  AfterClass: true
  AfterControlStatement: true
  AfterEnum: true
  AfterExternBlock: true
  AfterFunction: true
  AfterNamespace: true
  AfterObjCDeclaration: true
  AfterStruct: true
  AfterUnion: true
  BeforeCatch: true
  BeforeElse: true
  IndentBraces: false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true

but it did not resolve the issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to