forked from OSchip/llvm-project
[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 llvm-svn: 328175
This commit is contained in:
parent
5f91134344
commit
19c782d520
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue