[llvm-bugs] [Bug 39412] New: [Format/ObjC] Incorrect spacing before array subscript operation containing ObjC method call

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 23 13:02:43 PDT 2018


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

            Bug ID: 39412
           Summary: [Format/ObjC] Incorrect spacing before array subscript
                    operation containing ObjC method call
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bhamiltoncx at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

clang-format currently incorrectly inserts a space between an identifier and an
array subscript operation when the value of the index is the result of an
Objective-C method call:

% cat /tmp/test.m
foo[[Bar() blech]];

% ./bin/clang-format -debug /tmp/test.m
Args: ./bin/clang-format -debug /tmp/test.m 
Trying /tmp/.clang-format...
Trying /tmp/_clang-format...
Trying /.clang-format...
Trying /_clang-format...
File encoding: UTF8
Language: Objective-C
----
Line(0, FSC=0): identifier[T=68, OC=0] l_square[T=68, OC=3] l_square[T=68,
OC=4] identifier[T=68, OC=5] l_paren[T=68, OC=8] r_paren[T=68, OC=9]
identifier[T=68, OC=11] r_square[T=68, OC=16] r_square[T=68, OC=17] semi[T=68,
OC=18] 
Line(0, FSC=0): eof[T=68, OC=0] 
Run 0...
AnnotatedTokens(L=0):
 M=0 C=0 T=Unknown S=1 B=0 BK=0 P=0 Name=identifier L=3 PPK=2 FakeLParens=
FakeRParens=0 II=0x5610d7887bb0 Text='foo'
 M=0 C=1 T=AttributeSquare S=1 B=0 BK=0 P=23 Name=l_square L=5 PPK=2
FakeLParens= FakeRParens=0 II=0x0 Text='['
 M=0 C=1 T=AttributeSquare S=0 B=0 BK=0 P=59 Name=l_square L=6 PPK=2
FakeLParens= FakeRParens=0 II=0x0 Text='['
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=79 Name=identifier L=9 PPK=2 FakeLParens=
FakeRParens=0 II=0x5610d7887be0 Text='Bar'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=63 Name=l_paren L=10 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text='('
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=99 Name=r_paren L=11 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text=')'
 M=0 C=1 T=Unknown S=1 B=0 BK=0 P=63 Name=identifier L=17 PPK=2 FakeLParens=
FakeRParens=0 II=0x5610d7887c10 Text='blech'
 M=0 C=0 T=AttributeSquare S=0 B=0 BK=0 P=63 Name=r_square L=18 PPK=2
FakeLParens= FakeRParens=0 II=0x0 Text=']'
 M=0 C=0 T=AttributeSquare S=0 B=0 BK=0 P=43 Name=r_square L=19 PPK=2
FakeLParens= FakeRParens=0 II=0x0 Text=']'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=23 Name=semi L=20 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text=';'
----
AnnotatedTokens(L=0):
 M=0 C=0 T=Unknown S=1 B=0 BK=0 P=0 Name=eof L=0 PPK=2 FakeLParens=
FakeRParens=0 II=0x0 Text=''
----
Replacements for run 0:
/tmp/test.m: 3:+0:" "
foo [[Bar() blech]];

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181023/564b2f01/attachment.html>


More information about the llvm-bugs mailing list