aboutsummaryrefslogtreecommitdiff
path: root/clang/test/ExtractAPI/typedef.c
blob: a4c3619bfd210ad71b947b25e5619fa38780ba5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// RUN: rm -rf %t
// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
// RUN:   -triple arm64-apple-macosx -x objective-c-header %s -o %t/output.symbols.json -verify

// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix MYINT
typedef int MyInt;
// MYINT-LABEL: "!testLabel": "c:typedef.c@T@MyInt"
// MYINT: "accessLevel": "public",
// MYINT:      "declarationFragments": [
// MYINT-NEXT:   {
// MYINT-NEXT:     "kind": "keyword",
// MYINT-NEXT:     "spelling": "typedef"
// MYINT-NEXT:   },
// MYINT-NEXT:   {
// MYINT-NEXT:     "kind": "text",
// MYINT-NEXT:     "spelling": " "
// MYINT-NEXT:   },
// MYINT-NEXT:   {
// MYINT-NEXT:     "kind": "typeIdentifier",
// MYINT-NEXT:     "preciseIdentifier": "c:I",
// MYINT-NEXT:     "spelling": "int"
// MYINT-NEXT:   },
// MYINT-NEXT:   {
// MYINT-NEXT:     "kind": "text",
// MYINT-NEXT:     "spelling": " "
// MYINT-NEXT:   },
// MYINT-NEXT:   {
// MYINT-NEXT:     "kind": "identifier",
// MYINT-NEXT:     "spelling": "MyInt"
// MYINT-NEXT:   },
// MYINT-NEXT:   {
// MYINT-NEXT:     "kind": "text",
// MYINT-NEXT:     "spelling": ";"
// MYINT-NEXT:   }
// MYINT-NEXT: ],
// MYINT:      "kind": {
// MYINT-NEXT:   "displayName": "Type Alias",
// MYINT-NEXT:   "identifier": "objective-c.typealias"
// MYINT-NEXT: },
// MYINT: "title": "MyInt"
// MYINT:      "pathComponents": [
// MYINT-NEXT:   "MyInt"
// MYINT-NEXT: ],
// MYINT: "type": "c:I"

// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix BARPTR
typedef struct Bar *BarPtr;
// BARPTR-LABEL: "!testLabel": "c:typedef.c@T@BarPtr"
// BARPTR: "accessLevel": "public",
// BARPTR:      "declarationFragments": [
// BARPTR-NEXT:   {
// BARPTR-NEXT:     "kind": "keyword",
// BARPTR-NEXT:     "spelling": "typedef"
// BARPTR-NEXT:   },
// BARPTR-NEXT:   {
// BARPTR-NEXT:     "kind": "text",
// BARPTR-NEXT:     "spelling": " "
// BARPTR-NEXT:   },
// BARPTR-NEXT:   {
// BARPTR-NEXT:     "kind": "keyword",
// BARPTR-NEXT:     "spelling": "struct"
// BARPTR-NEXT:   },
// BARPTR-NEXT:   {
// BARPTR-NEXT:     "kind": "text",
// BARPTR-NEXT:     "spelling": " "
// BARPTR-NEXT:   },
// BARPTR-NEXT:   {
// BARPTR-NEXT:     "kind": "typeIdentifier",
// BARPTR-NEXT:     "preciseIdentifier": "c:@S@Bar",
// BARPTR-NEXT:     "spelling": "Bar"
// BARPTR-NEXT:   },
// BARPTR-NEXT:   {
// BARPTR-NEXT:     "kind": "text",
// BARPTR-NEXT:     "spelling": " * "
// BARPTR-NEXT:   },
// BARPTR-NEXT:   {
// BARPTR-NEXT:     "kind": "identifier",
// BARPTR-NEXT:     "spelling": "BarPtr"
// BARPTR-NEXT:   },
// BARPTR-NEXT:   {
// BARPTR-NEXT:     "kind": "text",
// BARPTR-NEXT:     "spelling": ";"
// BARPTR-NEXT:   }
// BARPTR-NEXT: ],
// BARPTR: "type": "c:*$@S@Bar"

// RUN: FileCheck %s --input-file %t/output.symbols.json
void foo(BarPtr value);

void baz(BarPtr *value);
// CHECK-NOT: struct Bar *

// expected-no-diagnostics