[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ExtractAPI / global_var_template.cpp
blob5c9194141332bbb246e8b72a3ba96fe6e58667aa
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> T Foo = T(3.14);
15 /// expected-no-diagnostics
17 //--- reference.output.json.in
19 "metadata": {
20 "formatVersion": {
21 "major": 0,
22 "minor": 5,
23 "patch": 3
25 "generator": "?"
27 "module": {
28 "name": "",
29 "platform": {
30 "architecture": "arm64",
31 "operatingSystem": {
32 "minimumVersion": {
33 "major": 11,
34 "minor": 0,
35 "patch": 0
37 "name": "macosx"
39 "vendor": "apple"
42 "relationships": [],
43 "symbols": [
45 "accessLevel": "public",
46 "declarationFragments": [
48 "kind": "keyword",
49 "spelling": "template"
52 "kind": "text",
53 "spelling": " <"
56 "kind": "keyword",
57 "spelling": "typename"
60 "kind": "text",
61 "spelling": " "
64 "kind": "genericParameter",
65 "spelling": "T"
68 "kind": "text",
69 "spelling": "> "
72 "kind": "typeIdentifier",
73 "preciseIdentifier": "c:t0.0",
74 "spelling": "T"
77 "kind": "text",
78 "spelling": " "
81 "kind": "identifier",
82 "spelling": "Foo"
85 "kind": "text",
86 "spelling": ";"
89 "identifier": {
90 "interfaceLanguage": "c++",
91 "precise": "c:@Foo"
93 "kind": {
94 "displayName": "Global Variable Template",
95 "identifier": "c++.var"
97 "location": {
98 "position": {
99 "character": 23,
100 "line": 0
102 "uri": "file://INPUT_DIR/input.h"
104 "names": {
105 "navigator": [
107 "kind": "identifier",
108 "spelling": "Foo"
111 "subHeading": [
113 "kind": "identifier",
114 "spelling": "Foo"
117 "title": "Foo"
119 "pathComponents": [
120 "Foo"
122 "swiftGenerics": {
123 "parameters": [
125 "depth": 0,
126 "index": 0,
127 "name": "T"