Debian Codegraph @

clang/test/ExtractAPI/class_template_param_inheritance.cpp

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
4 // RUN: %t/reference.output.json.in >> %t/reference.output.json
5 // RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
6 // RUN: -x c++-header %t/input.h -o %t/output.json -verify
7
8 // Generator version is not consistent across test runs, normalize it.
9 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
10 // RUN: %t/output.json >> %t/output-normalized.json
11 // RUN: diff %t/reference.output.json %t/output-normalized.json
12
13 //--- input.h
14 template<typename T> class Foo : public T {};
15
16 /// expected-no-diagnostics
17
18 //--- reference.output.json.in
19 {
20 "metadata": {
21 "formatVersion": {
22 "major": 0,
23 "minor": 5,
24 "patch": 3
25 },
26 "generator": "?"
27 },
28 "module": {
29 "name": "",
30 "platform": {
31 "architecture": "arm64",
32 "operatingSystem": {
33 "minimumVersion": {
34 "major": 11,
35 "minor": 0,
36 "patch": 0
37 },
38 "name": "macosx"
39 },
40 "vendor": "apple"
41 }
42 },
43 "relationships": [
44 {
45 "kind": "inheritsFrom",
46 "source": "c:@ST>1#T@Foo",
47 "target": "c:input.h@9",
48 "targetFallback": "T"
49 }
50 ],
51 "symbols": [
52 {
53 "accessLevel": "public",
54 "declarationFragments": [
55 {
56 "kind": "keyword",
57 "spelling": "template"
58 },
59 {
60 "kind": "text",
61 "spelling": " <"
62 },
63 {
64 "kind": "keyword",
65 "spelling": "typename"
66 },
67 {
68 "kind": "text",
69 "spelling": " "
70 },
71 {
72 "kind": "genericParameter",
73 "spelling": "T"
74 },
75 {
76 "kind": "text",
77 "spelling": "> "
78 },
79 {
80 "kind": "keyword",
81 "spelling": "class"
82 },
83 {
84 "kind": "text",
85 "spelling": " "
86 },
87 {
88 "kind": "identifier",
89 "spelling": "Foo"
90 },
91 {
92 "kind": "text",
93 "spelling": ";"
94 }
95 ],
96 "identifier": {
97 "interfaceLanguage": "c++",
98 "precise": "c:@ST>1#T@Foo"
99 },
100 "kind": {
101 "displayName": "Class",
102 "identifier": "c++.class"
103 },
104 "location": {
105 "position": {
106 "character": 27,
107 "line": 0
108 },
109 "uri": "file://INPUT_DIR/input.h"
110 },
111 "names": {
112 "navigator": [
113 {
114 "kind": "identifier",
115 "spelling": "Foo"
116 }
117 ],
118 "subHeading": [
119 {
120 "kind": "identifier",
121 "spelling": "Foo"
122 }
123 ],
124 "title": "Foo"
125 },
126 "pathComponents": [
127 "Foo"
128 ],
129 "swiftGenerics": {
130 "parameters": [
131 {
132 "depth": 0,
133 "index": 0,
134 "name": "T"
135 }
136 ]
137 }
138 }
139 ]
140 }