summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/Format.cpp11
-rw-r--r--clang/unittests/Format/FormatTest.cpp6
2 files changed, 13 insertions, 4 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index f7e74abab37..98b2656ee29 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1465,6 +1465,7 @@ private:
"NSAffineTransform",
"NSArray",
"NSAttributedString",
+ "NSBlockOperation",
"NSBundle",
"NSCache",
"NSCalendar",
@@ -1480,6 +1481,7 @@ private:
"NSIndexPath",
"NSIndexSet",
"NSInteger",
+ "NSInvocationOperation",
"NSLocale",
"NSMapTable",
"NSMutableArray",
@@ -1494,9 +1496,13 @@ private:
"NSNumber",
"NSNumberFormatter",
"NSObject",
+ "NSOperation",
+ "NSOperationQueue",
+ "NSOperationQueuePriority",
"NSOrderedSet",
"NSPoint",
"NSPointerArray",
+ "NSQualityOfService",
"NSRange",
"NSRect",
"NSRegularExpression",
@@ -1518,10 +1524,7 @@ private:
for (const FormatToken *FormatTok = Line->First; FormatTok;
FormatTok = FormatTok->Next) {
if ((FormatTok->Previous && FormatTok->Previous->is(tok::at) &&
- (FormatTok->isObjCAtKeyword(tok::objc_interface) ||
- FormatTok->isObjCAtKeyword(tok::objc_implementation) ||
- FormatTok->isObjCAtKeyword(tok::objc_protocol) ||
- FormatTok->isObjCAtKeyword(tok::objc_end) ||
+ (FormatTok->Tok.getObjCKeywordID() != tok::objc_not_keyword ||
FormatTok->isOneOf(tok::numeric_constant, tok::l_square,
tok::l_brace))) ||
(FormatTok->Tok.isAnyIdentifier() &&
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index d1869d2494a..4397cdfe692 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -12118,6 +12118,12 @@ TEST_F(FormatTest, FileAndCode) {
EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.mm", ""));
EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", ""));
EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@interface Foo\n@end\n"));
+ EXPECT_EQ(
+ FormatStyle::LK_ObjC,
+ guessLanguage("foo.h", "#define TRY(x, y) @try { x; } @finally { y; }"));
+ EXPECT_EQ(FormatStyle::LK_ObjC,
+ guessLanguage("foo.h", "#define AVAIL(x) @available(x, *))"));
+ EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@class Foo;"));
EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo", ""));
EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo", "@interface Foo\n@end\n"));
EXPECT_EQ(FormatStyle::LK_ObjC,
OpenPOWER on IntegriCloud