<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Formatter/Objective-C] Formatter should put __attribute__((foo)) on its own line before @interface / @implementation / @protocol"
   href="https://bugs.llvm.org/show_bug.cgi?id=52015">52015</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Formatter/Objective-C] Formatter should put __attribute__((foo)) on its own line before @interface / @implementation / @protocol
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bhamiltoncx@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>`ClangFormat` incorrectly removes line breaks after `__attribute__((foo))` when
followed by Objective-C `@interface` / `@implementation` / `@protocol`:

% cat /tmp/test.h
__attribute__((objc_subclassing_restricted))
@interface Foo
@end

% ./clang-format -debug -style=Google /tmp/test.h
Args: ./clang-format -debug -style=Google /tmp/test.h 
File encoding: UTF8
Language: C++
----
Line(0, FSC=0): __attribute[T=88, OC=0] l_paren[T=88, OC=13] l_paren[T=88,
OC=14] identifier[T=88, OC=15] r_paren[T=88, OC=42] r_paren[T=88, OC=43]
at[T=88, OC=0] identifier[T=88, OC=1] identifier[T=88, OC=11] 
Line(0, FSC=0): at[T=88, OC=0] identifier[T=88, OC=1] 
Line(0, FSC=0): eof[T=88, OC=0] 
Run 0...
Detected ObjC at location /tmp/test.h:2:1 token: @ token type: ObjCDecl
Replacements for run 0:
File encoding: UTF8
Language: Objective-C
----
Line(0, FSC=0): __attribute[T=88, OC=0] l_paren[T=88, OC=13] l_paren[T=88,
OC=14] identifier[T=88, OC=15] r_paren[T=88, OC=42] r_paren[T=88, OC=43]
at[T=88, OC=0] identifier[T=88, OC=1] identifier[T=88, OC=11] 
Line(0, FSC=0): at[T=88, OC=0] identifier[T=88, OC=1] 
Line(0, FSC=0): eof[T=88, OC=0] 
Run 0...
AnnotatedTokens(L=0):
 M=0 C=0 T=Unknown S=1 F=0 B=0 BK=0 P=0 Name=__attribute L=13 PPK=2
FakeLParens= FakeRParens=0 II=0x55c3be1fb758 Text='__attribute__'
 M=0 C=0 T=AttributeParen S=0 F=0 B=0 BK=0 P=23 Name=l_paren L=14 PPK=2
FakeLParens= FakeRParens=0 II=0x0 Text='('
 M=0 C=0 T=Unknown S=0 F=0 B=0 BK=0 P=59 Name=l_paren L=15 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text='('
 M=0 C=1 T=Unknown S=0 F=0 B=0 BK=0 P=79 Name=identifier L=42 PPK=2
FakeLParens= FakeRParens=0 II=0x55c3be230810 Text='objc_subclassing_restricted'
 M=0 C=0 T=Unknown S=0 F=0 B=0 BK=0 P=63 Name=r_paren L=43 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text=')'
 M=0 C=0 T=AttributeParen S=0 F=0 B=0 BK=0 P=43 Name=r_paren L=44 PPK=2
FakeLParens= FakeRParens=0 II=0x0 Text=')'
 M=0 C=1 T=ObjCDecl S=1 F=0 B=0 BK=0 P=23 Name=at L=46 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text='@'
 M=0 C=0 T=Unknown S=0 F=0 B=0 BK=0 P=23 Name=identifier L=55 PPK=2
FakeLParens= FakeRParens=0 II=0x55c3be22f498 Text='interface'
 M=0 C=0 T=StartOfName S=1 F=0 B=0 BK=0 P=220 Name=identifier L=59 PPK=2
FakeLParens= FakeRParens=0 II=0x55c3be230840 Text='Foo'
----
AnnotatedTokens(L=0):
 M=0 C=0 T=Unknown S=1 F=0 B=0 BK=0 P=0 Name=at L=1 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text='@'
 M=0 C=0 T=Unknown S=0 F=0 B=0 BK=0 P=23 Name=identifier L=4 PPK=2 FakeLParens=
FakeRParens=0 II=0x55c3be22f428 Text='end'
----
AnnotatedTokens(L=0):
 M=0 C=0 T=Unknown S=1 F=0 B=0 BK=0 P=0 Name=eof L=0 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text=''
----
Replacements for run 0:
/tmp/test.h: 44:+1:" "
__attribute__((objc_subclassing_restricted)) @interface Foo
@end</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>