361 lines · plain
1// RUN: rm -rf %t2// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \3// RUN: -x objective-c-header -triple arm64-apple-macosx %s -o %t/output.symbols.json -verify4 5@protocol Protocol6@end7 8// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix SUPER9@interface Super <Protocol>10// SUPER: "!testRelLabel": "conformsTo $ c:objc(cs)Super $ c:objc(pl)Protocol"11// SUPER-LABEL: "!testLabel": "c:objc(cs)Super"12// SUPER: "accessLevel": "public",13// SUPER: "declarationFragments": [14// SUPER-NEXT: {15// SUPER-NEXT: "kind": "keyword",16// SUPER-NEXT: "spelling": "@interface"17// SUPER-NEXT: },18// SUPER-NEXT: {19// SUPER-NEXT: "kind": "text",20// SUPER-NEXT: "spelling": " "21// SUPER-NEXT: },22// SUPER-NEXT: {23// SUPER-NEXT: "kind": "identifier",24// SUPER-NEXT: "spelling": "Super"25// SUPER-NEXT: }26// SUPER-NEXT: ],27// SUPER: "kind": {28// SUPER-NEXT: "displayName": "Class",29// SUPER-NEXT: "identifier": "objective-c.class"30// SUPER-NEXT: },31// SUPER: "title": "Super"32// SUPER: "pathComponents": [33// SUPER-NEXT: "Super"34// SUPER-NEXT: ]35 36// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix PROP37@property(readonly, getter=getProperty) unsigned Property;38// PROP: "!testRelLabel": "memberOf $ c:objc(cs)Super(py)Property $ c:objc(cs)Super"39// PROP: "!testLabel": "c:objc(cs)Super(py)Property"40// PROP: "accessLevel": "public",41// PROP: "declarationFragments": [42// PROP-NEXT: {43// PROP-NEXT: "kind": "keyword",44// PROP-NEXT: "spelling": "@property"45// PROP-NEXT: },46// PROP-NEXT: {47// PROP-NEXT: "kind": "text",48// PROP-NEXT: "spelling": " ("49// PROP-NEXT: },50// PROP-NEXT: {51// PROP-NEXT: "kind": "keyword",52// PROP-NEXT: "spelling": "readonly"53// PROP-NEXT: },54// PROP-NEXT: {55// PROP-NEXT: "kind": "text",56// PROP-NEXT: "spelling": ", "57// PROP-NEXT: },58// PROP-NEXT: {59// PROP-NEXT: "kind": "keyword",60// PROP-NEXT: "spelling": "getter"61// PROP-NEXT: },62// PROP-NEXT: {63// PROP-NEXT: "kind": "text",64// PROP-NEXT: "spelling": "="65// PROP-NEXT: },66// PROP-NEXT: {67// PROP-NEXT: "kind": "identifier",68// PROP-NEXT: "spelling": "getProperty"69// PROP-NEXT: },70// PROP-NEXT: {71// PROP-NEXT: "kind": "text",72// PROP-NEXT: "spelling": ") "73// PROP-NEXT: },74// PROP-NEXT: {75// PROP-NEXT: "kind": "typeIdentifier",76// PROP-NEXT: "preciseIdentifier": "c:i",77// PROP-NEXT: "spelling": "unsigned int"78// PROP-NEXT: },79// PROP-NEXT: {80// PROP-NEXT: "kind": "text",81// PROP-NEXT: "spelling": " "82// PROP-NEXT: },83// PROP-NEXT: {84// PROP-NEXT: "kind": "identifier",85// PROP-NEXT: "spelling": "Property"86// PROP-NEXT: },87// PROP-NEXT: {88// PROP-NEXT: "kind": "text",89// PROP-NEXT: "spelling": ";"90// PROP-NEXT: }91// PROP-NEXT: ],92// PROP: "kind": {93// PROP-NEXT: "displayName": "Instance Property",94// PROP-NEXT: "identifier": "objective-c.property"95// PROP-NEXT: },96// PROP: "title": "Property"97// PROP: "pathComponents": [98// PROP-NEXT: "Super",99// PROP-NEXT: "Property"100// PROP-NEXT: ]101 102// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix GET103+ (id)getWithProperty:(unsigned) Property;104// GET: "!testRelLabel": "memberOf $ c:objc(cs)Super(cm)getWithProperty: $ c:objc(cs)Super"105// GET-LABEL: "!testLabel": "c:objc(cs)Super(cm)getWithProperty:"106// GET: "accessLevel": "public",107// GET: "declarationFragments": [108// GET-NEXT: {109// GET-NEXT: "kind": "text",110// GET-NEXT: "spelling": "+ ("111// GET-NEXT: },112// GET-NEXT: {113// GET-NEXT: "kind": "keyword",114// GET-NEXT: "spelling": "id"115// GET-NEXT: },116// GET-NEXT: {117// GET-NEXT: "kind": "text",118// GET-NEXT: "spelling": ") "119// GET-NEXT: },120// GET-NEXT: {121// GET-NEXT: "kind": "identifier",122// GET-NEXT: "spelling": "getWithProperty:"123// GET-NEXT: },124// GET-NEXT: {125// GET-NEXT: "kind": "text",126// GET-NEXT: "spelling": "("127// GET-NEXT: },128// GET-NEXT: {129// GET-NEXT: "kind": "typeIdentifier",130// GET-NEXT: "preciseIdentifier": "c:i",131// GET-NEXT: "spelling": "unsigned int"132// GET-NEXT: },133// GET-NEXT: {134// GET-NEXT: "kind": "text",135// GET-NEXT: "spelling": ") "136// GET-NEXT: },137// GET-NEXT: {138// GET-NEXT: "kind": "internalParam",139// GET-NEXT: "spelling": "Property"140// GET-NEXT: },141// GET-NEXT: {142// GET-NEXT: "kind": "text",143// GET-NEXT: "spelling": ";"144// GET-NEXT: }145// GET-NEXT: ],146// GET: "functionSignature": {147// GET-NEXT: "parameters": [148// GET-NEXT: {149// GET-NEXT: "declarationFragments": [150// GET-NEXT: {151// GET-NEXT: "kind": "text",152// GET-NEXT: "spelling": "("153// GET-NEXT: },154// GET-NEXT: {155// GET-NEXT: "kind": "typeIdentifier",156// GET-NEXT: "preciseIdentifier": "c:i",157// GET-NEXT: "spelling": "unsigned int"158// GET-NEXT: },159// GET-NEXT: {160// GET-NEXT: "kind": "text",161// GET-NEXT: "spelling": ") "162// GET-NEXT: },163// GET-NEXT: {164// GET-NEXT: "kind": "internalParam",165// GET-NEXT: "spelling": "Property"166// GET-NEXT: }167// GET-NEXT: ],168// GET-NEXT: "name": "Property"169// GET-NEXT: }170// GET-NEXT: ],171// GET-NEXT: "returns": [172// GET-NEXT: {173// GET-NEXT: "kind": "keyword",174// GET-NEXT: "spelling": "id"175// GET-NEXT: }176// GET-NEXT: ]177// GET-NEXT: },178// GET: "kind": {179// GET-NEXT: "displayName": "Type Method",180// GET-NEXT: "identifier": "objective-c.type.method"181// GET-NEXT: },182// GET: "title": "getWithProperty:"183// GET: "pathComponents": [184// GET-NEXT: "Super",185// GET-NEXT: "getWithProperty:"186// GET-NEXT: ]187 188// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix SET189- (void)setProperty:(unsigned) Property andOtherThing: (unsigned) Thing;190// SET: "!testRelLabel": "memberOf $ c:objc(cs)Super(im)setProperty:andOtherThing: $ c:objc(cs)Super"191// SET-LABEL: "!testLabel": "c:objc(cs)Super(im)setProperty:andOtherThing:"192// SET: "accessLevel": "public",193// SET: "declarationFragments": [194// SET-NEXT: {195// SET-NEXT: "kind": "text",196// SET-NEXT: "spelling": "- ("197// SET-NEXT: },198// SET-NEXT: {199// SET-NEXT: "kind": "typeIdentifier",200// SET-NEXT: "preciseIdentifier": "c:v",201// SET-NEXT: "spelling": "void"202// SET-NEXT: },203// SET-NEXT: {204// SET-NEXT: "kind": "text",205// SET-NEXT: "spelling": ") "206// SET-NEXT: },207// SET-NEXT: {208// SET-NEXT: "kind": "identifier",209// SET-NEXT: "spelling": "setProperty:"210// SET-NEXT: },211// SET-NEXT: {212// SET-NEXT: "kind": "text",213// SET-NEXT: "spelling": "("214// SET-NEXT: },215// SET-NEXT: {216// SET-NEXT: "kind": "typeIdentifier",217// SET-NEXT: "preciseIdentifier": "c:i",218// SET-NEXT: "spelling": "unsigned int"219// SET-NEXT: },220// SET-NEXT: {221// SET-NEXT: "kind": "text",222// SET-NEXT: "spelling": ") "223// SET-NEXT: },224// SET-NEXT: {225// SET-NEXT: "kind": "internalParam",226// SET-NEXT: "spelling": "Property"227// SET-NEXT: },228// SET-NEXT: {229// SET-NEXT: "kind": "text",230// SET-NEXT: "spelling": " "231// SET-NEXT: },232// SET-NEXT: {233// SET-NEXT: "kind": "identifier",234// SET-NEXT: "spelling": "andOtherThing:"235// SET-NEXT: },236// SET-NEXT: {237// SET-NEXT: "kind": "text",238// SET-NEXT: "spelling": "("239// SET-NEXT: },240// SET-NEXT: {241// SET-NEXT: "kind": "typeIdentifier",242// SET-NEXT: "preciseIdentifier": "c:i",243// SET-NEXT: "spelling": "unsigned int"244// SET-NEXT: },245// SET-NEXT: {246// SET-NEXT: "kind": "text",247// SET-NEXT: "spelling": ") "248// SET-NEXT: },249// SET-NEXT: {250// SET-NEXT: "kind": "internalParam",251// SET-NEXT: "spelling": "Thing"252// SET-NEXT: },253// SET-NEXT: {254// SET-NEXT: "kind": "text",255// SET-NEXT: "spelling": ";"256// SET-NEXT: }257// SET-NEXT: ],258// SET: "functionSignature": {259// SET-NEXT: "parameters": [260// SET-NEXT: {261// SET-NEXT: "declarationFragments": [262// SET-NEXT: {263// SET-NEXT: "kind": "text",264// SET-NEXT: "spelling": "("265// SET-NEXT: },266// SET-NEXT: {267// SET-NEXT: "kind": "typeIdentifier",268// SET-NEXT: "preciseIdentifier": "c:i",269// SET-NEXT: "spelling": "unsigned int"270// SET-NEXT: },271// SET-NEXT: {272// SET-NEXT: "kind": "text",273// SET-NEXT: "spelling": ") "274// SET-NEXT: },275// SET-NEXT: {276// SET-NEXT: "kind": "internalParam",277// SET-NEXT: "spelling": "Property"278// SET-NEXT: }279// SET-NEXT: ],280// SET-NEXT: "name": "Property"281// SET-NEXT: },282// SET-NEXT: {283// SET-NEXT: "declarationFragments": [284// SET-NEXT: {285// SET-NEXT: "kind": "text",286// SET-NEXT: "spelling": "("287// SET-NEXT: },288// SET-NEXT: {289// SET-NEXT: "kind": "typeIdentifier",290// SET-NEXT: "preciseIdentifier": "c:i",291// SET-NEXT: "spelling": "unsigned int"292// SET-NEXT: },293// SET-NEXT: {294// SET-NEXT: "kind": "text",295// SET-NEXT: "spelling": ") "296// SET-NEXT: },297// SET-NEXT: {298// SET-NEXT: "kind": "internalParam",299// SET-NEXT: "spelling": "Thing"300// SET-NEXT: }301// SET-NEXT: ],302// SET-NEXT: "name": "Thing"303// SET-NEXT: }304// SET-NEXT: ],305// SET-NEXT: "returns": [306// SET-NEXT: {307// SET-NEXT: "kind": "typeIdentifier",308// SET-NEXT: "preciseIdentifier": "c:v",309// SET-NEXT: "spelling": "void"310// SET-NEXT: }311// SET-NEXT: ]312// SET-NEXT: },313// SET: "kind": {314// SET-NEXT: "displayName": "Instance Method",315// SET-NEXT: "identifier": "objective-c.method"316// SET-NEXT: },317// SET: "title": "setProperty:andOtherThing:"318@end319 320// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix DERIVED321@interface Derived : Super {322// DERIVED: "!testRelLabel": "inheritsFrom $ c:objc(cs)Derived $ c:objc(cs)Super"323 324// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix IVAR325 char Ivar;326// IVAR: "!testRelLabel": "memberOf $ c:objc(cs)Derived@Ivar $ c:objc(cs)Derived"327// IVAR-LABEL: "!testLabel": "c:objc(cs)Derived@Ivar"328// IVAR: "accessLevel": "public",329// IVAR: "declarationFragments": [330// IVAR-NEXT: {331// IVAR-NEXT: "kind": "typeIdentifier",332// IVAR-NEXT: "preciseIdentifier": "c:C",333// IVAR-NEXT: "spelling": "char"334// IVAR-NEXT: },335// IVAR-NEXT: {336// IVAR-NEXT: "kind": "text",337// IVAR-NEXT: "spelling": " "338// IVAR-NEXT: },339// IVAR-NEXT: {340// IVAR-NEXT: "kind": "identifier",341// IVAR-NEXT: "spelling": "Ivar"342// IVAR-NEXT: },343// IVAR-NEXT: {344// IVAR-NEXT: "kind": "text",345// IVAR-NEXT: "spelling": ";"346// IVAR-NEXT: }347// IVAR-NEXT: ],348// IVAR: "kind": {349// IVAR-NEXT: "displayName": "Instance Variable",350// IVAR-NEXT: "identifier": "objective-c.ivar"351// IVAR-NEXT: },352// IVAR: "title": "Ivar"353// IVAR: "pathComponents": [354// IVAR-NEXT: "Derived",355// IVAR-NEXT: "Ivar"356// IVAR-NEXT: ]357}358@end359 360// expected-no-diagnostics361