[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / class_template_param_inheritance.cpp
blob53b331e0b460be8fb698a34943c12ded2f4d8c2a
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
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
13 //--- input.h
14 template<typename T> class Foo : public T {};
16 /// expected-no-diagnostics
18 //--- reference.output.json.in
20 "metadata": {
21 "formatVersion": {
22 "major": 0,
23 "minor": 5,
24 "patch": 3
26 "generator": "?"
28 "module": {
29 "name": "",
30 "platform": {
31 "architecture": "arm64",
32 "operatingSystem": {
33 "minimumVersion": {
34 "major": 11,
35 "minor": 0,
36 "patch": 0
38 "name": "macosx"
40 "vendor": "apple"
43 "relationships": [
45 "kind": "inheritsFrom",
46 "source": "c:@ST>1#T@Foo",
47 "target": "",
48 "targetFallback": "T"
51 "symbols": [
53 "accessLevel": "public",
54 "declarationFragments": [
56 "kind": "keyword",
57 "spelling": "template"
60 "kind": "text",
61 "spelling": " <"
64 "kind": "keyword",
65 "spelling": "typename"
68 "kind": "text",
69 "spelling": " "
72 "kind": "genericParameter",
73 "spelling": "T"
76 "kind": "text",
77 "spelling": "> "
80 "kind": "keyword",
81 "spelling": "class"
84 "kind": "text",
85 "spelling": " "
88 "kind": "identifier",
89 "spelling": "Foo"
92 "kind": "text",
93 "spelling": ";"
96 "identifier": {
97 "interfaceLanguage": "c++",
98 "precise": "c:@ST>1#T@Foo"
100 "kind": {
101 "displayName": "Class",
102 "identifier": "c++.class"
104 "location": {
105 "position": {
106 "character": 27,
107 "line": 0
109 "uri": "file://INPUT_DIR/input.h"
111 "names": {
112 "navigator": [
114 "kind": "identifier",
115 "spelling": "Foo"
118 "subHeading": [
120 "kind": "identifier",
121 "spelling": "Foo"
124 "title": "Foo"
126 "pathComponents": [
127 "Foo"
129 "swiftGenerics": {
130 "parameters": [
132 "depth": 0,
133 "index": 0,
134 "name": "T"