Fix ClangFormat issue of recognizing ObjC subscript as C++ attributes when message target is a result of a C-style method.
Summary:
The issue is that for array subscript like:
```
arr[[Foo() bar]];
```
ClangFormat will recognize it as C++11 attribute syntax and put a space between 'arr' and first '[', like:
```
arr [[Foo() bar]];
```
Now it is fixed. Tested with:
```
ninja FormatTests
```
Reviewers: benhamilton
Reviewed By: benhamilton
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D54288
llvm-svn: 346566
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 635a344..2714a51 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -6472,6 +6472,8 @@
// Make sure we do not mistake attributes for array subscripts.
verifyFormat("int a() {}\n"
"[[unused]] int b() {}\n");
+ verifyFormat("NSArray *arr;\n"
+ "arr[[Foo() bar]];");
// On the other hand, we still need to correctly find array subscripts.
verifyFormat("int a = std::vector<int>{1, 2, 3}[0];");