summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/Format.cpp15
-rw-r--r--clang/unittests/Format/FormatTest.cpp6
2 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 69b3881a7ac..e9d1fafe860 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1449,6 +1449,19 @@ private:
// 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 @@ private:
"NSURLQueryItem",
"NSUUID",
"NSValue",
+ "UIImage",
+ "UIView",
};
for (auto &Line : AnnotatedLines) {
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index bdb3fbe4835..400a55827a0 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud