summaryrefslogtreecommitdiff
path: root/unittests/Format
diff options
context:
space:
mode:
authorBen Hamilton <benhamilton@google.com>2018-03-22 03:25:22 +0000
committerBen Hamilton <benhamilton@google.com>2018-03-22 03:25:22 +0000
commit541a3de27e33d37aa1ad2ebe3729e7482d96a0e0 (patch)
treed3effeec0cc1e2c3c94d3b65139087e774e28ae5 /unittests/Format
parent23ecb164a296cf283a63fd69c179e0d4b4068565 (diff)
downloadclang-541a3de27e33d37aa1ad2ebe3729e7482d96a0e0.tar.gz
[clang-format] Add a few more Core Graphics identifiers to ObjC heuristic
Summary: We received reports of the Objective-C style guesser getting a false negative on header files like: CGSize SizeOfThing(MyThing thing); This adds more Core Graphics identifiers to the Objective-C style guesser. Test Plan: New tests added. Ran tests with: % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: jolesiak, djasper Reviewed By: jolesiak, djasper Subscribers: krasimir, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D44632 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format')
-rw-r--r--unittests/Format/FormatTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index bdb3fbe483..400a55827a 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -12108,6 +12108,12 @@ TEST_F(FormatTest, FileAndCode) {
EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@interface Foo\n@end\n"));
EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo", ""));
EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo", "@interface Foo\n@end\n"));
+ EXPECT_EQ(FormatStyle::LK_ObjC,
+ guessLanguage("foo.h", "int DoStuff(CGRect rect);\n"));
+ EXPECT_EQ(
+ FormatStyle::LK_ObjC,
+ guessLanguage("foo.h",
+ "#define MY_POINT_MAKE(x, y) CGPointMake((x), (y));\n"));
}
TEST_F(FormatTest, GuessLanguageWithCpp11AttributeSpecifiers) {