[PATCH] D44632: [clang-format] Add a few more Core Graphics identifiers to ObjC heuristic
Ben Hamilton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 21 20:28:03 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL328175: [clang-format] Add a few more Core Graphics identifiers to ObjC heuristic (authored by benhamilton, committed by ).
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
https://reviews.llvm.org/D44632
Files:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Index: cfe/trunk/lib/Format/Format.cpp
===================================================================
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1449,6 +1449,19 @@
// Keep this array sorted, since we are binary searching over it.
static constexpr llvm::StringLiteral FoundationIdentifiers[] = {
"CGFloat",
+ "CGPoint",
+ "CGPointMake",
+ "CGPointZero",
+ "CGRect",
+ "CGRectEdge",
+ "CGRectInfinite",
+ "CGRectMake",
+ "CGRectNull",
+ "CGRectZero",
+ "CGSize",
+ "CGSizeMake",
+ "CGVector",
+ "CGVectorMake",
"NSAffineTransform",
"NSArray",
"NSAttributedString",
@@ -1497,6 +1510,8 @@
"NSURLQueryItem",
"NSUUID",
"NSValue",
+ "UIImage",
+ "UIView",
};
for (auto &Line : AnnotatedLines) {
Index: cfe/trunk/unittests/Format/FormatTest.cpp
===================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -12108,6 +12108,12 @@
EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@interface Foo\n at end\n"));
EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo", ""));
EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo", "@interface Foo\n at 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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44632.139411.patch
Type: text/x-patch
Size: 1707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180322/0f94c724/attachment.bin>
More information about the cfe-commits
mailing list