[PATCH] D157350: [clang][ExtractAPI] Add support for C++ variable templates

2023-08-18 Thread Erick Velez via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8d8c8981cac0: [clang][ExtractAPI] Add support for C++ 
variable templates (authored by evelez7).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157350/new/

https://reviews.llvm.org/D157350

Files:
  clang/include/clang/ExtractAPI/API.h
  clang/include/clang/ExtractAPI/DeclarationFragments.h
  clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
  clang/include/clang/ExtractAPI/Serialization/SerializerBase.h
  clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
  clang/lib/ExtractAPI/API.cpp
  clang/lib/ExtractAPI/DeclarationFragments.cpp
  clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
  clang/test/ExtractAPI/global_var_template.cpp
  clang/test/ExtractAPI/global_var_template_partial_spec.cpp
  clang/test/ExtractAPI/global_var_template_spec.cpp

Index: clang/test/ExtractAPI/global_var_template_spec.cpp
===
--- /dev/null
+++ clang/test/ExtractAPI/global_var_template_spec.cpp
@@ -0,0 +1,207 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
+// RUN: %t/reference.output.json.in >> %t/reference.output.json
+// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN:   -x c++-header %t/input.h -o %t/output.json -verify
+
+// Generator version is not consistent across test runs, normalize it.
+// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
+// RUN: %t/output.json >> %t/output-normalized.json
+// RUN: diff %t/reference.output.json %t/output-normalized.json
+
+//--- input.h
+template T Foo = T(3.14);
+
+template<> int Foo;
+/// expected-no-diagnostics
+
+//--- reference.output.json.in
+{
+  "metadata": {
+"formatVersion": {
+  "major": 0,
+  "minor": 5,
+  "patch": 3
+},
+"generator": "?"
+  },
+  "module": {
+"name": "",
+"platform": {
+  "architecture": "arm64",
+  "operatingSystem": {
+"minimumVersion": {
+  "major": 11,
+  "minor": 0,
+  "patch": 0
+},
+"name": "macosx"
+  },
+  "vendor": "apple"
+}
+  },
+  "relationships": [],
+  "symbols": [
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "keyword",
+  "spelling": "typename"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "genericParameter",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": "> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:t0.0",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": ";"
+}
+  ],
+  "identifier": {
+"interfaceLanguage": "c++",
+"precise": "c:@Foo"
+  },
+  "kind": {
+"displayName": "Global Variable Template",
+"identifier": "c++.var"
+  },
+  "location": {
+"position": {
+  "character": 24,
+  "line": 1
+},
+"uri": "file://INPUT_DIR/input.h"
+  },
+  "names": {
+"navigator": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"subHeading": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"title": "Foo"
+  },
+  "pathComponents": [
+"Foo"
+  ],
+  "swiftGenerics": {
+"parameters": [
+  {
+"depth": 0,
+"index": 0,
+"name": "T"
+  }
+]
+  }
+},
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": ">;"
+}
+  ],
+  "identifier": {
+

[PATCH] D157350: [clang][ExtractAPI] Add support for C++ variable templates

2023-08-18 Thread Daniel Grumberg via Phabricator via cfe-commits
dang accepted this revision.
dang added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157350/new/

https://reviews.llvm.org/D157350

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D157350: [clang][ExtractAPI] Add support for C++ variable templates

2023-08-16 Thread Erick Velez via Phabricator via cfe-commits
evelez7 updated this revision to Diff 550950.
evelez7 added a comment.

Forgot Spec instance in SerializerBase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157350/new/

https://reviews.llvm.org/D157350

Files:
  clang/include/clang/ExtractAPI/API.h
  clang/include/clang/ExtractAPI/DeclarationFragments.h
  clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
  clang/include/clang/ExtractAPI/Serialization/SerializerBase.h
  clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
  clang/lib/ExtractAPI/API.cpp
  clang/lib/ExtractAPI/DeclarationFragments.cpp
  clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
  clang/test/ExtractAPI/global_var_template.cpp
  clang/test/ExtractAPI/global_var_template_partial_spec.cpp
  clang/test/ExtractAPI/global_var_template_spec.cpp

Index: clang/test/ExtractAPI/global_var_template_spec.cpp
===
--- /dev/null
+++ clang/test/ExtractAPI/global_var_template_spec.cpp
@@ -0,0 +1,207 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
+// RUN: %t/reference.output.json.in >> %t/reference.output.json
+// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN:   -x c++-header %t/input.h -o %t/output.json -verify
+
+// Generator version is not consistent across test runs, normalize it.
+// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
+// RUN: %t/output.json >> %t/output-normalized.json
+// RUN: diff %t/reference.output.json %t/output-normalized.json
+
+//--- input.h
+template T Foo = T(3.14);
+
+template<> int Foo;
+/// expected-no-diagnostics
+
+//--- reference.output.json.in
+{
+  "metadata": {
+"formatVersion": {
+  "major": 0,
+  "minor": 5,
+  "patch": 3
+},
+"generator": "?"
+  },
+  "module": {
+"name": "",
+"platform": {
+  "architecture": "arm64",
+  "operatingSystem": {
+"minimumVersion": {
+  "major": 11,
+  "minor": 0,
+  "patch": 0
+},
+"name": "macosx"
+  },
+  "vendor": "apple"
+}
+  },
+  "relationships": [],
+  "symbols": [
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "keyword",
+  "spelling": "typename"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "genericParameter",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": "> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:t0.0",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": ";"
+}
+  ],
+  "identifier": {
+"interfaceLanguage": "c++",
+"precise": "c:@Foo"
+  },
+  "kind": {
+"displayName": "Global Variable Template",
+"identifier": "c++.var"
+  },
+  "location": {
+"position": {
+  "character": 24,
+  "line": 1
+},
+"uri": "file://INPUT_DIR/input.h"
+  },
+  "names": {
+"navigator": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"subHeading": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"title": "Foo"
+  },
+  "pathComponents": [
+"Foo"
+  ],
+  "swiftGenerics": {
+"parameters": [
+  {
+"depth": 0,
+"index": 0,
+"name": "T"
+  }
+]
+  }
+},
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": ">;"
+}
+  ],
+  "identifier": {
+"interfaceLanguage": "c++",
+"precise": "c:@Foo>#I"
+  },
+  

[PATCH] D157350: [clang][ExtractAPI] Add support for C++ variable templates

2023-08-16 Thread Erick Velez via Phabricator via cfe-commits
evelez7 updated this revision to Diff 550944.
evelez7 added a comment.

Update all instances of Spec to Specialization


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157350/new/

https://reviews.llvm.org/D157350

Files:
  clang/include/clang/ExtractAPI/API.h
  clang/include/clang/ExtractAPI/DeclarationFragments.h
  clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
  clang/include/clang/ExtractAPI/Serialization/SerializerBase.h
  clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
  clang/lib/ExtractAPI/API.cpp
  clang/lib/ExtractAPI/DeclarationFragments.cpp
  clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
  clang/test/ExtractAPI/global_var_template.cpp
  clang/test/ExtractAPI/global_var_template_partial_spec.cpp
  clang/test/ExtractAPI/global_var_template_spec.cpp

Index: clang/test/ExtractAPI/global_var_template_spec.cpp
===
--- /dev/null
+++ clang/test/ExtractAPI/global_var_template_spec.cpp
@@ -0,0 +1,207 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
+// RUN: %t/reference.output.json.in >> %t/reference.output.json
+// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN:   -x c++-header %t/input.h -o %t/output.json -verify
+
+// Generator version is not consistent across test runs, normalize it.
+// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
+// RUN: %t/output.json >> %t/output-normalized.json
+// RUN: diff %t/reference.output.json %t/output-normalized.json
+
+//--- input.h
+template T Foo = T(3.14);
+
+template<> int Foo;
+/// expected-no-diagnostics
+
+//--- reference.output.json.in
+{
+  "metadata": {
+"formatVersion": {
+  "major": 0,
+  "minor": 5,
+  "patch": 3
+},
+"generator": "?"
+  },
+  "module": {
+"name": "",
+"platform": {
+  "architecture": "arm64",
+  "operatingSystem": {
+"minimumVersion": {
+  "major": 11,
+  "minor": 0,
+  "patch": 0
+},
+"name": "macosx"
+  },
+  "vendor": "apple"
+}
+  },
+  "relationships": [],
+  "symbols": [
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "keyword",
+  "spelling": "typename"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "genericParameter",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": "> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:t0.0",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": ";"
+}
+  ],
+  "identifier": {
+"interfaceLanguage": "c++",
+"precise": "c:@Foo"
+  },
+  "kind": {
+"displayName": "Global Variable Template",
+"identifier": "c++.var"
+  },
+  "location": {
+"position": {
+  "character": 24,
+  "line": 1
+},
+"uri": "file://INPUT_DIR/input.h"
+  },
+  "names": {
+"navigator": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"subHeading": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"title": "Foo"
+  },
+  "pathComponents": [
+"Foo"
+  ],
+  "swiftGenerics": {
+"parameters": [
+  {
+"depth": 0,
+"index": 0,
+"name": "T"
+  }
+]
+  }
+},
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": ">;"
+}
+  ],
+  "identifier": {
+"interfaceLanguage": "c++",
+"precise": "c:@Foo>#I"
+  },
+ 

[PATCH] D157350: [clang][ExtractAPI] Add support for C++ variable templates

2023-08-15 Thread Erick Velez via Phabricator via cfe-commits
evelez7 updated this revision to Diff 550485.
evelez7 added a comment.

Get rid of unnecessary function for checking if global var


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157350/new/

https://reviews.llvm.org/D157350

Files:
  clang/include/clang/ExtractAPI/API.h
  clang/include/clang/ExtractAPI/DeclarationFragments.h
  clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
  clang/include/clang/ExtractAPI/Serialization/SerializerBase.h
  clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
  clang/lib/ExtractAPI/API.cpp
  clang/lib/ExtractAPI/DeclarationFragments.cpp
  clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
  clang/test/ExtractAPI/global_var_template.cpp
  clang/test/ExtractAPI/global_var_template_partial_spec.cpp
  clang/test/ExtractAPI/global_var_template_spec.cpp

Index: clang/test/ExtractAPI/global_var_template_spec.cpp
===
--- /dev/null
+++ clang/test/ExtractAPI/global_var_template_spec.cpp
@@ -0,0 +1,207 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
+// RUN: %t/reference.output.json.in >> %t/reference.output.json
+// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN:   -x c++-header %t/input.h -o %t/output.json -verify
+
+// Generator version is not consistent across test runs, normalize it.
+// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
+// RUN: %t/output.json >> %t/output-normalized.json
+// RUN: diff %t/reference.output.json %t/output-normalized.json
+
+//--- input.h
+template T Foo = T(3.14);
+
+template<> int Foo;
+/// expected-no-diagnostics
+
+//--- reference.output.json.in
+{
+  "metadata": {
+"formatVersion": {
+  "major": 0,
+  "minor": 5,
+  "patch": 3
+},
+"generator": "?"
+  },
+  "module": {
+"name": "",
+"platform": {
+  "architecture": "arm64",
+  "operatingSystem": {
+"minimumVersion": {
+  "major": 11,
+  "minor": 0,
+  "patch": 0
+},
+"name": "macosx"
+  },
+  "vendor": "apple"
+}
+  },
+  "relationships": [],
+  "symbols": [
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "keyword",
+  "spelling": "typename"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "genericParameter",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": "> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:t0.0",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": ";"
+}
+  ],
+  "identifier": {
+"interfaceLanguage": "c++",
+"precise": "c:@Foo"
+  },
+  "kind": {
+"displayName": "Global Variable Template",
+"identifier": "c++.var"
+  },
+  "location": {
+"position": {
+  "character": 24,
+  "line": 1
+},
+"uri": "file://INPUT_DIR/input.h"
+  },
+  "names": {
+"navigator": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"subHeading": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"title": "Foo"
+  },
+  "pathComponents": [
+"Foo"
+  ],
+  "swiftGenerics": {
+"parameters": [
+  {
+"depth": 0,
+"index": 0,
+"name": "T"
+  }
+]
+  }
+},
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": ">;"
+}
+  ],
+  "identifier": {
+"interfaceLanguage": "c++",
+"precise": "c:@Foo>#I"

[PATCH] D157350: [clang][ExtractAPI] Add support for C++ variable templates

2023-08-07 Thread Erick Velez via Phabricator via cfe-commits
evelez7 created this revision.
evelez7 added a reviewer: dang.
Herald added a reviewer: ributzka.
Herald added a project: All.
evelez7 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Serialize global C++ variable templates and specializations.

Depends on D157076 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157350

Files:
  clang/include/clang/ExtractAPI/API.h
  clang/include/clang/ExtractAPI/DeclarationFragments.h
  clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
  clang/include/clang/ExtractAPI/Serialization/SerializerBase.h
  clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
  clang/lib/ExtractAPI/API.cpp
  clang/lib/ExtractAPI/DeclarationFragments.cpp
  clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
  clang/test/ExtractAPI/global_var_template.cpp
  clang/test/ExtractAPI/global_var_template_partial_spec.cpp
  clang/test/ExtractAPI/global_var_template_spec.cpp

Index: clang/test/ExtractAPI/global_var_template_spec.cpp
===
--- /dev/null
+++ clang/test/ExtractAPI/global_var_template_spec.cpp
@@ -0,0 +1,207 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
+// RUN: %t/reference.output.json.in >> %t/reference.output.json
+// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN:   -x c++-header %t/input.h -o %t/output.json -verify
+
+// Generator version is not consistent across test runs, normalize it.
+// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
+// RUN: %t/output.json >> %t/output-normalized.json
+// RUN: diff %t/reference.output.json %t/output-normalized.json
+
+//--- input.h
+template T Foo = T(3.14);
+
+template<> int Foo;
+/// expected-no-diagnostics
+
+//--- reference.output.json.in
+{
+  "metadata": {
+"formatVersion": {
+  "major": 0,
+  "minor": 5,
+  "patch": 3
+},
+"generator": "?"
+  },
+  "module": {
+"name": "",
+"platform": {
+  "architecture": "arm64",
+  "operatingSystem": {
+"minimumVersion": {
+  "major": 11,
+  "minor": 0,
+  "patch": 0
+},
+"name": "macosx"
+  },
+  "vendor": "apple"
+}
+  },
+  "relationships": [],
+  "symbols": [
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "keyword",
+  "spelling": "typename"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "genericParameter",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": "> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:t0.0",
+  "spelling": "T"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": ";"
+}
+  ],
+  "identifier": {
+"interfaceLanguage": "c++",
+"precise": "c:@Foo"
+  },
+  "kind": {
+"displayName": "Global Variable Template",
+"identifier": "c++.var"
+  },
+  "location": {
+"position": {
+  "character": 24,
+  "line": 1
+},
+"uri": "file://INPUT_DIR/input.h"
+  },
+  "names": {
+"navigator": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"subHeading": [
+  {
+"kind": "identifier",
+"spelling": "Foo"
+  }
+],
+"title": "Foo"
+  },
+  "pathComponents": [
+"Foo"
+  ],
+  "swiftGenerics": {
+"parameters": [
+  {
+"depth": 0,
+"index": 0,
+"name": "T"
+  }
+]
+  }
+},
+{
+  "accessLevel": "public",
+  "declarationFragments": [
+{
+  "kind": "keyword",
+  "spelling": "template"
+},
+{
+  "kind": "text",
+  "spelling": "<> "
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+  "kind": "text",
+  "spelling": " "
+},
+{
+  "kind": "identifier",
+  "spelling": "Foo"
+},
+{
+  "kind": "text",
+  "spelling": "<"
+},
+{
+  "kind": "typeIdentifier",
+  "preciseIdentifier": "c:I",
+  "spelling": "int"
+},
+{
+