summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index c4abad228d0..c1cec110137 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -7027,6 +7027,12 @@ TEST_F(FormatTest, UnderstandsSquareAttributes) {
// On the other hand, we still need to correctly find array subscripts.
verifyFormat("int a = std::vector<int>{1, 2, 3}[0];");
+ // Make sure that we do not mistake Objective-C method inside array literals
+ // as attributes, even if those method names are also keywords.
+ verifyFormat("@[ [foo bar] ];");
+ verifyFormat("@[ [NSArray class] ];");
+ verifyFormat("@[ [foo enum] ];");
+
// Make sure we do not parse attributes as lambda introducers.
FormatStyle MultiLineFunctions = getLLVMStyle();
MultiLineFunctions.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None;
OpenPOWER on IntegriCloud