forked from OSchip/llvm-project
clang-format: [ObjC] Fix using selector names as macro arguments.
Before: [self aaaaa:MACRO(a, b :, c :)]; After: [self aaaaa:MACRO(a, b:, c:)]; llvm-svn: 220197
This commit is contained in:
parent
e8f63a54b4
commit
7858079246
|
@ -413,6 +413,11 @@ private:
|
|||
} else if (Contexts.size() == 1 &&
|
||||
!Line.First->isOneOf(tok::kw_enum, tok::kw_case)) {
|
||||
Tok->Type = TT_InheritanceColon;
|
||||
} else if (Tok->Previous->is(tok::identifier) && Tok->Next &&
|
||||
Tok->Next->isOneOf(tok::r_paren, tok::comma)) {
|
||||
// This handles a special macro in ObjC code where selectors including
|
||||
// the colon are passed as macro arguments.
|
||||
Tok->Type = TT_ObjCMethodExpr;
|
||||
} else if (Contexts.back().ContextKind == tok::l_paren) {
|
||||
Tok->Type = TT_InlineASMColon;
|
||||
}
|
||||
|
|
|
@ -6539,6 +6539,7 @@ TEST_F(FormatTest, FormatObjCMethodExpr) {
|
|||
verifyFormat("return in[42];");
|
||||
verifyFormat("for (id foo in [self getStuffFor:bla]) {\n"
|
||||
"}");
|
||||
verifyFormat("[self aaaaa:MACRO(a, b:, c:)];");
|
||||
|
||||
verifyFormat("[self stuffWithInt:(4 + 2) float:4.5];");
|
||||
verifyFormat("[self stuffWithInt:a ? b : c float:4.5];");
|
||||
|
|
Loading…
Reference in New Issue