Previously:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional - (void) optional;
@required - (void) required;
@end
Now:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional
- (void)optional;
@required
- (void)required;
@end
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172023
91177308-0d34-0410-b5e6-
96231b3b80d8
void addTokenToState(bool Newline, bool DryRun, IndentState &State) {
const AnnotatedToken &Current = *State.NextToken;
const AnnotatedToken &Previous = *State.NextToken->Parent;
+ assert(State.Indent.size());
unsigned ParenLevel = State.Indent.size() - 1;
if (Newline) {
/// accordingly.
void moveStateToNextToken(IndentState &State) {
const AnnotatedToken &Current = *State.NextToken;
+ assert(State.Indent.size());
unsigned ParenLevel = State.Indent.size() - 1;
if (Current.is(tok::lessless) && State.FirstLessLess[ParenLevel] == 0)
return parseObjCProtocol();
case tok::objc_end:
return; // Handled by the caller.
+ case tok::objc_optional:
+ case tok::objc_required:
+ nextToken();
+ addUnwrappedLine();
+ return;
default:
break;
}
@end
// CHECK: <Declaration>@protocol MyProto\n@end</Declaration>
// CHECK: <Declaration>- (unsigned int)MethodMyProto:(id)anObject inRange:(unsigned int)range;</Declaration>
-// CHECK: <Declaration>@optional\n @property(readwrite, copy, atomic) id PropertyMyProto;</Declaration>
+// CHECK: <Declaration>@optional\n@property(readwrite, copy, atomic) id PropertyMyProto;</Declaration>
// CHECK: <Declaration>+ (id)ClassMethodMyProto;</Declaration>
/**
"@end\n"
"@protocol Bar\n"
"@end");
+
+ verifyFormat("@protocol myProtocol\n"
+ "- (void)mandatoryWithInt:(int)i;\n"
+ "@optional\n"
+ "- (void)optional;\n"
+ "@required\n"
+ "- (void)required;\n"
+ "@end\n");
}
TEST_F(FormatTest, ObjCAt) {