reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/unittests/Format/FormatTestObjC.cpp
  188   verifyFormat("@try {\n"
  195   verifyFormat("DEBUG({\n"
  203   verifyFormat("@autoreleasepool {\n"
  211   verifyFormat("@autoreleasepool\n"
  223   verifyFormat("int aaaaaaaaaaaaaaaa(\n"
  226   verifyFormat("int aaaaaaaaaaaaaaaa(\n"
  233   verifyFormat("@synchronized(self) {\n"
  241   verifyFormat("@synchronized(self)\n"
  252   verifyFormat("@interface Foo : NSObject <NSSomeDelegate> {\n"
  265   verifyFormat("@interface /* wait for it */ Foo\n"
  271   verifyFormat("@interface Foo\n"
  276   verifyFormat("@interface Foo : Bar\n"
  281   verifyFormat("FOUNDATION_EXPORT NS_AVAILABLE_IOS(10.0) @interface Foo : Bar\n"
  286   verifyFormat("@interface Foo : /**/ Bar /**/ <Baz, /**/ Quux>\n"
  290   verifyFormat("@interface Foo (HackStuff)\n"
  294   verifyFormat("@interface Foo ()\n"
  298   verifyFormat("@interface Foo (HackStuff) <MyProtocol>\n"
  302   verifyFormat("@interface Foo {\n"
  308   verifyFormat("@interface Foo : Bar {\n"
  314   verifyFormat("@interface Foo : Bar <Baz, Quux> {\n"
  320   verifyFormat("@interface Foo<Baz : Blech> : Bar <Baz, Quux> {\n"
  326   verifyFormat("@interface Foo<Bar : Baz <Blech>> : Xyzzy <Corge> {\n"
  332   verifyFormat("@interface Foo (HackStuff) {\n"
  338   verifyFormat("@interface Foo () {\n"
  344   verifyFormat("@interface Foo (HackStuff) <MyProtocol> {\n"
  349   verifyFormat("@interface Foo\n"
  358   verifyFormat("@interface ccccccccccccc () <\n"
  362   verifyFormat("@interface ccccccccccccc (ccccccccccc) <\n"
  366   verifyFormat("@interface ddddddddddddd () <\n"
  375   verifyFormat("@interface eeeeeeeeeeeee () <\n"
  382   verifyFormat("@interface fffffffffffff () <\n"
  388   verifyFormat("@interface Foo : NSObject <NSSomeDelegate> {\n"
  400   verifyFormat("@interface Foo : Bar <Baz, Quux>\n"
  403   verifyFormat("@interface Foo (HackStuff) <MyProtocol>\n"
  408   verifyFormat("void eeeeeeee(int eeeee, int eeeee,\n"
  411   verifyFormat("@interface fffffffffffff () <\n"
  420   verifyFormat("@implementation Foo : NSObject {\n"
  433   verifyFormat("@implementation Foo\n"
  447   verifyFormat("@implementation Foo\n"
  461   verifyFormat("@implementation Foo {\n"
  467   verifyFormat("@implementation Foo : Bar {\n"
  473   verifyFormat("@implementation Foo (HackStuff)\n"
  476   verifyFormat("@implementation ObjcClass\n"
  482   verifyFormat("@implementation Foo : NSObject {\n"
  497   verifyFormat("@protocol Foo\n"
  502   verifyFormat("@protocol MyProtocol <NSObject>\n"
  506   verifyFormat("@protocol Foo;\n"
  509   verifyFormat("@protocol Foo\n"
  514   verifyFormat("FOUNDATION_EXPORT NS_AVAILABLE_IOS(10.0) @protocol Foo\n"
  518   verifyFormat("@protocol myProtocol\n"
  528   verifyFormat("@property(nonatomic, assign, readonly)\n"
  533   verifyFormat("@implementation PR18406\n"
  538   verifyFormat("@protocol MyProtocol <NSObject>\n"
  544   verifyFormat("- (void)doSomethingWith:(GTMFoo *)theFoo\n"
  548   verifyFormat("- (void)shortf:(GTMFoo *)theFoo\n"
  553   verifyFormat("- (void)shortf:(GTMFoo *)theFoo\n"
  558   verifyFormat("+ (instancetype)new;\n");
  560   verifyFormat("- (instancetype)initXxxxxx:(id<x>)x\n"
  563   verifyFormat("- (void)drawRectOn:(id)surface\n"
  568   verifyFormat("- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
  570   verifyFormat("- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
  572   verifyFormat("- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
  575   verifyFormat("- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
  578   verifyFormat("- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
  586   verifyFormat("- (void)shortf:(GTMFoo *)theFoo\n"
  591   verifyFormat("- (void)shortf:(GTMFoo *)theFoo\n"
  597   verifyFormat("- (void)drawRectOn:(id)surface\n"
  604   verifyFormat("- (void)drawRectOn:(id)surface ofSize:(aaa)height:(bbb)width;");
  610   verifyFormat("@implementation Foo\n"
  618   verifyFormat("[foo bar:baz];");
  619   verifyFormat("[foo bar]->baz;");
  620   verifyFormat("return [foo bar:baz];");
  621   verifyFormat("return (a)[foo bar:baz];");
  622   verifyFormat("f([foo bar:baz]);");
  623   verifyFormat("f(2, [foo bar:baz]);");
  624   verifyFormat("f(2, a ? b : c);");
  625   verifyFormat("[[self initWithInt:4] bar:[baz quux:arrrr]];");
  628   verifyFormat("int a = +[foo bar:baz];");
  629   verifyFormat("int a = -[foo bar:baz];");
  630   verifyFormat("int a = ![foo bar:baz];");
  631   verifyFormat("int a = ~[foo bar:baz];");
  632   verifyFormat("int a = ++[foo bar:baz];");
  633   verifyFormat("int a = --[foo bar:baz];");
  634   verifyFormat("int a = sizeof [foo bar:baz];");
  635   verifyFormat("int a = alignof [foo bar:baz];");
  636   verifyFormat("int a = &[foo bar:baz];");
  637   verifyFormat("int a = *[foo bar:baz];");
  642   verifyFormat("return (MyType *)[self.tableView cellForRowAtIndexPath:cell];");
  645   verifyFormat("[foo bar:baz], [foo bar:baz];");
  646   verifyFormat("[foo bar:baz] = [foo bar:baz];");
  647   verifyFormat("[foo bar:baz] *= [foo bar:baz];");
  648   verifyFormat("[foo bar:baz] /= [foo bar:baz];");
  649   verifyFormat("[foo bar:baz] %= [foo bar:baz];");
  650   verifyFormat("[foo bar:baz] += [foo bar:baz];");
  651   verifyFormat("[foo bar:baz] -= [foo bar:baz];");
  652   verifyFormat("[foo bar:baz] <<= [foo bar:baz];");
  653   verifyFormat("[foo bar:baz] >>= [foo bar:baz];");
  654   verifyFormat("[foo bar:baz] &= [foo bar:baz];");
  655   verifyFormat("[foo bar:baz] ^= [foo bar:baz];");
  656   verifyFormat("[foo bar:baz] |= [foo bar:baz];");
  657   verifyFormat("[foo bar:baz] ? [foo bar:baz] : [foo bar:baz];");
  658   verifyFormat("[foo bar:baz] || [foo bar:baz];");
  659   verifyFormat("[foo bar:baz] && [foo bar:baz];");
  660   verifyFormat("[foo bar:baz] | [foo bar:baz];");
  661   verifyFormat("[foo bar:baz] ^ [foo bar:baz];");
  662   verifyFormat("[foo bar:baz] & [foo bar:baz];");
  663   verifyFormat("[foo bar:baz] == [foo bar:baz];");
  664   verifyFormat("[foo bar:baz] != [foo bar:baz];");
  665   verifyFormat("[foo bar:baz] >= [foo bar:baz];");
  666   verifyFormat("[foo bar:baz] <= [foo bar:baz];");
  667   verifyFormat("[foo bar:baz] > [foo bar:baz];");
  668   verifyFormat("[foo bar:baz] < [foo bar:baz];");
  669   verifyFormat("[foo bar:baz] >> [foo bar:baz];");
  670   verifyFormat("[foo bar:baz] << [foo bar:baz];");
  671   verifyFormat("[foo bar:baz] - [foo bar:baz];");
  672   verifyFormat("[foo bar:baz] + [foo bar:baz];");
  673   verifyFormat("[foo bar:baz] * [foo bar:baz];");
  674   verifyFormat("[foo bar:baz] / [foo bar:baz];");
  675   verifyFormat("[foo bar:baz] % [foo bar:baz];");
  678   verifyFormat("return in[42];");
  679   verifyFormat("for (auto v : in[1]) {\n}");
  680   verifyFormat("for (int i = 0; i < in[a]; ++i) {\n}");
  681   verifyFormat("for (int i = 0; in[a] < i; ++i) {\n}");
  682   verifyFormat("for (int i = 0; i < n; ++i, ++in[a]) {\n}");
  683   verifyFormat("for (int i = 0; i < n; ++i, in[a]++) {\n}");
  684   verifyFormat("for (int i = 0; i < f(in[a]); ++i, in[a]++) {\n}");
  685   verifyFormat("for (id foo in [self getStuffFor:bla]) {\n"
  687   verifyFormat("[self aaaaa:MACRO(a, b:, c:)];");
  688   verifyFormat("[self aaaaa:MACRO(a, b:c:, d:e:)];");
  689   verifyFormat("[self aaaaa:MACRO(a, b:c:d:, e:f:g:)];");
  690   verifyFormat("int XYMyFoo(int a, int b) NS_SWIFT_NAME(foo(self:scale:));");
  691   verifyFormat("[self aaaaa:(1 + 2) bbbbb:3];");
  692   verifyFormat("[self aaaaa:(Type)a bbbbb:3];");
  694   verifyFormat("[self stuffWithInt:(4 + 2) float:4.5];");
  695   verifyFormat("[self stuffWithInt:a ? b : c float:4.5];");
  696   verifyFormat("[self stuffWithInt:a ? [self foo:bar] : c];");
  697   verifyFormat("[self stuffWithInt:a ? (e ? f : g) : c];");
  698   verifyFormat("[cond ? obj1 : obj2 methodWithParam:param]");
  699   verifyFormat("[button setAction:@selector(zoomOut:)];");
  700   verifyFormat("[color getRed:&r green:&g blue:&b alpha:&a];");
  702   verifyFormat("arr[[self indexForFoo:a]];");
  703   verifyFormat("throw [self errorFor:a];");
  704   verifyFormat("@throw [self errorFor:a];");
  706   verifyFormat("[(id)foo bar:(id)baz quux:(id)snorf];");
  707   verifyFormat("[(id)foo bar:(id) ? baz : quux];");
  708   verifyFormat("4 > 4 ? (id)a : (id)baz;");
  716   verifyFormat("bool a = ([object a:42] == 0 ||\n"
  719   verifyFormat("bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa ||\n"
  724   verifyFormat(
  731   verifyFormat(
  735   verifyFormat("[myObj short:arg1 // Force line break\n"
  739   verifyFormat(
  748   verifyFormat("[contentsContainer replaceSubview:[subviews objectAtIndex:0]\n"
  751   verifyFormat(
  755   verifyFormat(
  759   verifyFormat("[defaultCenter addObserver:self\n"
  763   verifyFormat("[image_rep drawInRect:drawRect\n"
  769   verifyFormat("[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
  771   verifyFormat("[aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa)\n"
  773   verifyFormat("[aaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa]\n"
  776   verifyFormat(
  780   verifyFormat("[self aaaaaa:bbbbbbbbbbbbb\n"
  784   verifyFormat("[self param:function( //\n"
  786   verifyFormat(
  792   verifyFormat(
  794   verifyFormat(
  799   verifyFormat("[self // break\n"
  804   verifyFormat("[I drawRectOn:surface ofSize:aa:bbb atOrigin:cc:dd];");
  805   verifyFormat("[I drawRectOn:surface //\n"
  810   verifyFormat("[object justBlock:^{\n"
  813   verifyFormat("[object\n"
  819   verifyFormat("[object\n"
  826   verifyFormat("[object\n"
  833   verifyFormat("[object\n"
  843   verifyFormat("[((Foo *)foo) bar];");
  844   verifyFormat("[((Foo *)foo) bar:1 blech:2];");
  847   verifyFormat("aaaaa = [a aa:aa\n"
  849   verifyFormat("aaaaaa = [aa aa:aa\n"
  854   verifyFormat("[[object block:^{\n"
  858   verifyFormat("[[object block:^{\n"
  862   verifyFormat("[[object block:^{\n"
  868   verifyFormat("[[obj a:42\n"
  875   verifyFormat("[[obj a:42] a:42\n"
  877   verifyFormat("[[obj a:42] a:42\n"
  880   verifyFormat("[[obj aaaaaa:42\n"
  887   verifyFormat("fooooooo =\n"
  890   verifyFormat("[[[obj foo] bar] aa:42\n"
  896   verifyFormat("if (a012345678901234567890123 &&\n"
  899   verifyFormat("if (a012345678901234567890123 &&\n"
  902   verifyFormat("if (a012345678901234567890123 &&\n"
  907   verifyFormat(
  918   verifyFormat("[call aaaaaaaa.aaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa\n"
  921   verifyFormat(
  928   verifyFormat(
  943   verifyFormat("[self performSelectorOnMainThread:@selector(loadAccessories)\n"
  946   verifyFormat("[self performSelector:@selector(loadAccessories)\n"
  949   verifyFormat("[aaaaaaaaaaaaaaaaaaaaaaaaa\n"
  953   verifyFormat("[self // force wrapping\n"
  960   verifyFormat("@autoreleasepool");
  961   verifyFormat("@catch");
  962   verifyFormat("@class");
  963   verifyFormat("@compatibility_alias");
  964   verifyFormat("@defs");
  965   verifyFormat("@dynamic");
  966   verifyFormat("@encode");
  967   verifyFormat("@end");
  968   verifyFormat("@finally");
  969   verifyFormat("@implementation");
  970   verifyFormat("@import");
  971   verifyFormat("@interface");
  972   verifyFormat("@optional");
  973   verifyFormat("@package");
  974   verifyFormat("@private");
  975   verifyFormat("@property");
  976   verifyFormat("@protected");
  977   verifyFormat("@protocol");
  978   verifyFormat("@public");
  979   verifyFormat("@required");
  980   verifyFormat("@selector");
  981   verifyFormat("@synchronized");
  982   verifyFormat("@synthesize");
  983   verifyFormat("@throw");
  984   verifyFormat("@try");
  990   verifyFormat("@ /*foo*/ interface");
  994   verifyFormat("void DoStuffWithBlockType(int (^)(char));");
  995   verifyFormat("int (^foo)(char, float);");
  996   verifyFormat("int (^foo[10])(char, float);");
  997   verifyFormat("int (^foo[kNumEntries])(char, float);");
  998   verifyFormat("int (^foo[kNumEntries + 10])(char, float);");
  999   verifyFormat("int (^foo[(kNumEntries + 10)])(char, float);");
 1003   verifyFormat("@autoreleasepool {\n"
 1006   verifyFormat("@class Foo, Bar;");
 1007   verifyFormat("@compatibility_alias AliasName ExistingClass;");
 1008   verifyFormat("@dynamic textColor;");
 1009   verifyFormat("char *buf1 = @encode(int *);");
 1010   verifyFormat("char *buf1 = @encode(typeof(4 * 5));");
 1011   verifyFormat("char *buf1 = @encode(int **);");
 1012   verifyFormat("Protocol *proto = @protocol(p1);");
 1013   verifyFormat("SEL s = @selector(foo:);");
 1014   verifyFormat("@synchronized(self) {\n"
 1018   verifyFormat("@import foo.bar;\n"
 1021   verifyFormat("@synthesize dropArrowPosition = dropArrowPosition_;");
 1023   verifyFormat("@property(assign, nonatomic) CGFloat hoverAlpha;");
 1024   verifyFormat("@property(assign, getter=isEditable) BOOL editable;");
 1027   verifyFormat("@interface Foo\n"
 1035   verifyFormat("@property (assign, getter=isEditable) BOOL editable;");
 1036   verifyFormat("@property BOOL editable;");
 1039   verifyFormat("@property (assign, getter=isEditable) BOOL editable;");
 1040   verifyFormat("@property BOOL editable;");
 1043   verifyFormat("@synthesize dropArrowPosition = dropArrowPosition_;");
 1044   verifyFormat("@property(assign, getter=isEditable) BOOL editable;");
 1048   verifyFormat("- (void)test {\n"
 1053   verifyFormat("- (void)test {\n"
 1058   verifyFormat("for (Foo *x in bar) {\n}");
 1059   verifyFormat("for (Foo *x in [bar baz]) {\n}");
 1060   verifyFormat("for (Foo *x in [bar baz:blech]) {\n}");
 1061   verifyFormat("for (Foo *x in [bar baz:blech, 1, 2, 3, 0]) {\n}");
 1062   verifyFormat("for (Foo *x in [bar baz:^{\n"
 1068   verifyFormat("+ (instancetype)new {\n"
 1071   verifyFormat("+ (instancetype)myNew {\n"
 1074   verifyFormat("SEL NewSelector(void) { return @selector(new); }\n");
 1075   verifyFormat("SEL MacroSelector(void) { return MACRO(new); }\n");
 1076   verifyFormat("+ (instancetype)delete {\n"
 1079   verifyFormat("+ (instancetype)myDelete {\n"
 1082   verifyFormat("SEL DeleteSelector(void) { return @selector(delete); }\n");
 1083   verifyFormat("SEL MacroSelector(void) { return MACRO(delete); }\n");
 1084   verifyFormat("MACRO(new:)\n");
 1085   verifyFormat("MACRO(delete:)\n");
 1086   verifyFormat("foo = @{MACRO(new:) : MACRO(delete:)}\n");
 1087   verifyFormat("@implementation Foo\n"
 1094   verifyFormat("@implementation Foo\n"
 1100   verifyFormat("@implementation Foo\n"
 1106   verifyFormat("@implementation Foo\n"
 1112   verifyFormat("@implementation Foo\n"
 1119   verifyFormat("@interface Foo\n"
 1124   verifyFormat("@interface Foo\n"
 1128   verifyFormat("@interface Foo\n"
 1132   verifyFormat("@interface Foo\n"
 1136   verifyFormat("@interface Foo\n"
 1143   verifyFormat("@\"String\"");
 1144   verifyFormat("@1");
 1145   verifyFormat("@+4.8");
 1146   verifyFormat("@-4");
 1147   verifyFormat("@1LL");
 1148   verifyFormat("@.5");
 1149   verifyFormat("@'c'");
 1150   verifyFormat("@true");
 1152   verifyFormat("NSNumber *smallestInt = @(-INT_MAX - 1);");
 1153   verifyFormat("NSNumber *piOverTwo = @(M_PI / 2);");
 1154   verifyFormat("NSNumber *favoriteColor = @(Green);");
 1155   verifyFormat("NSString *path = @(getenv(\"PATH\"));");
 1157   verifyFormat("[dictionary setObject:@(1) forKey:@\"number\"];");
 1161   verifyFormat("@{");
 1162   verifyFormat("@{}");
 1163   verifyFormat("@{@\"one\" : @1}");
 1164   verifyFormat("return @{@\"one\" : @1;");
 1165   verifyFormat("@{@\"one\" : @1}");
 1167   verifyFormat("@{@\"one\" : @{@2 : @1}}");
 1168   verifyFormat("@{\n"
 1172   verifyFormat("@{1 > 2 ? @\"one\" : @\"two\" : 1 > 2 ? @1 : @2}");
 1175   verifyFormat("NSLog(@\"%@\", @{@1 : @2, @2 : @3}[@1]);");
 1176   verifyFormat(
 1178   verifyFormat(
 1181   verifyFormat("NSDictionary *d = @{\n"
 1186   verifyFormat(
 1191   verifyFormat(
 1198   verifyFormat("NSDictionary *d = {\n"
 1203   verifyFormat("NSMutableDictionary *dictionary =\n"
 1211   verifyFormat(
 1217   verifyFormat("int Foo() {\n"
 1220   verifyFormat("int Foo() {\n"
 1223   verifyFormat("int Foo() {\n"
 1226   verifyFormat("int Foo() {\n"
 1229   verifyFormat("int Foo() {\n"
 1233   verifyFormat("int Foo() {\n"
 1236   verifyFormat("int Foo() {\n"
 1242   verifyFormat(
 1251   verifyFormat("@[]");
 1252   verifyFormat(
 1254   verifyFormat("return @[ @3, @[], @[ @4, @5 ] ];");
 1255   verifyFormat("NSArray *array = @[ [foo description] ];");
 1257   verifyFormat(
 1264   verifyFormat(
 1269   verifyFormat("NSArray *some_variable = @[\n"
 1275   verifyFormat("NSArray *array = @[\n"
 1281   verifyFormat("NSArray *some_variable = [\n"
 1287   verifyFormat(
 1292   verifyFormat("[someFunction someLooooooooooooongParameter:@[\n"
 1296   verifyFormat("int Foo() {\n"
 1299   verifyFormat("int Foo() {\n"
 1303   verifyFormat("int Foo() {\n"
 1306   verifyFormat("int Foo() {\n"
 1313   verifyFormat("NSArray *foo = @[\n"
 1322   verifyFormat("int f(int a) {\n"
 1332   verifyFormat("aaaa = @\"bbbb\"\n"
 1334   verifyFormat("aaaa(@\"bbbb\"\n"
 1336   verifyFormat("aaaa(qqq, @\"bbbb\"\n"
 1338   verifyFormat("[aaaa qqqq:@\"bbbb\"\n"
 1340   verifyFormat("aaaa = [aaaa qqqq:@\"bbbb\"\n"
 1342   verifyFormat("[aaaa qqqq:@\"bbbb\"\n"
 1350   verifyFormat("x = ([a foo:bar] && b->c == 'd');");
 1351   verifyFormat("x = ([a foo:bar] + b->c == 'd');");
 1352   verifyFormat("x = ([a foo:bar] + !b->c == 'd');");
 1353   verifyFormat("x = ([a foo:bar] + ~b->c == 'd');");
 1354   verifyFormat("x = ([a foo:bar] - b->c == 'd');");
 1355   verifyFormat("x = ([a foo:bar] / b->c == 'd');");
 1356   verifyFormat("x = ([a foo:bar] % b->c == 'd');");
 1357   verifyFormat("x = ([a foo:bar] | b->c == 'd');");
 1358   verifyFormat("x = ([a foo:bar] || b->c == 'd');");
 1359   verifyFormat("x = ([a foo:bar] && b->c == 'd');");
 1360   verifyFormat("x = ([a foo:bar] == b->c == 'd');");
 1361   verifyFormat("x = ([a foo:bar] != b->c == 'd');");
 1362   verifyFormat("x = ([a foo:bar] <= b->c == 'd');");
 1363   verifyFormat("x = ([a foo:bar] >= b->c == 'd');");
 1364   verifyFormat("x = ([a foo:bar] << b->c == 'd');");
 1365   verifyFormat("x = ([a foo:bar] ? b->c == 'd' : 'e');");
 1378   verifyFormat("int f() {\n"
 1382   verifyFormat("int f() {\n"
 1386   verifyFormat("int f() {\n"
 1390   verifyFormat("int f() {\n"
 1394   verifyFormat(