mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-21 15:15:07 +00:00
Resurrection of ccls
This commit is contained in:
parent
39dfe052f5
commit
b839389f77
28
.gitignore
vendored
28
.gitignore
vendored
@ -1,26 +1,4 @@
|
||||
.cquery_cached_index
|
||||
.DS_Store
|
||||
.lock-waf*
|
||||
.vs
|
||||
.vscode/
|
||||
.vscode/.ropeproject
|
||||
.waf*
|
||||
*.cquery
|
||||
*.sln
|
||||
*.swp
|
||||
*.vcxproj
|
||||
*.vcxproj.filters
|
||||
*.vcxproj.user
|
||||
**/*.pyc
|
||||
.*
|
||||
build
|
||||
cquery_diagnostics.log
|
||||
cquery_log.txt
|
||||
Debug
|
||||
e2e_cache
|
||||
foo
|
||||
libcxx
|
||||
vscode-extension.vsix
|
||||
waf-*
|
||||
waf2*
|
||||
waf3*
|
||||
x64
|
||||
debug
|
||||
release
|
||||
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(cquery LANGUAGES CXX)
|
||||
project(ccls LANGUAGES CXX)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
|
||||
include(DefaultCMakeBuildType)
|
||||
@ -8,11 +8,11 @@ include(DownloadAndExtractLLVM)
|
||||
set(CLANG_VERSION 6.0.0 CACHE STRING "Downloaded Clang version (6.0.0)")
|
||||
option(SYSTEM_CLANG "Use system Clang instead of downloading Clang" OFF)
|
||||
option(ASAN "Compile with address sanitizers" OFF)
|
||||
option(CLANG_CXX "Build with Clang C++ api required by some cquery \
|
||||
option(CLANG_CXX "Build with Clang C++ api required by some ccls \
|
||||
features (warning: not available in LLVM Windows downloads)" OFF)
|
||||
|
||||
# Sources for the executable are specified at end of CMakeLists.txt
|
||||
add_executable(cquery "")
|
||||
add_executable(ccls "")
|
||||
|
||||
### Compile options
|
||||
|
||||
@ -25,16 +25,16 @@ add_executable(cquery "")
|
||||
# release: -O3 -DNDEBUG
|
||||
|
||||
# Enable C++14 (Required)
|
||||
set_property(TARGET cquery PROPERTY CXX_STANDARD 14)
|
||||
set_property(TARGET cquery PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
set_property(TARGET ccls PROPERTY CXX_STANDARD 17)
|
||||
set_property(TARGET ccls PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
# Disable gnu extensions except for Cygwin which needs them to build properly
|
||||
if(NOT CYGWIN)
|
||||
set_property(TARGET cquery PROPERTY CXX_EXTENSIONS OFF)
|
||||
set_property(TARGET ccls PROPERTY CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
|
||||
# Common MSVC/Clang(Windows) options
|
||||
target_compile_options(cquery PRIVATE
|
||||
target_compile_options(ccls PRIVATE
|
||||
/nologo
|
||||
/EHsc
|
||||
/W3 # roughly -Wall
|
||||
@ -49,17 +49,17 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
|
||||
)
|
||||
else()
|
||||
# Common GCC/Clang(Linux) options
|
||||
target_compile_options(cquery PRIVATE
|
||||
target_compile_options(ccls PRIVATE
|
||||
-Wall
|
||||
-Wno-sign-compare
|
||||
)
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||
target_compile_options(cquery PRIVATE -Wno-return-type -Wno-unused-result)
|
||||
target_compile_options(ccls PRIVATE -Wno-return-type -Wno-unused-result)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
|
||||
target_compile_options(cquery PRIVATE
|
||||
target_compile_options(ccls PRIVATE
|
||||
$<$<CONFIG:Debug>:-fno-limit-debug-info>)
|
||||
endif()
|
||||
|
||||
@ -67,13 +67,13 @@ else()
|
||||
# -Wno-comment: include/clang/Format/Format.h error: multi-line comment
|
||||
# -fno-rtti: # Without -fno-rtti, some Clang C++ functions may report
|
||||
# `undefined references to typeinfo`
|
||||
target_compile_options(cquery PRIVATE -Wno-comment -fno-rtti)
|
||||
target_compile_options(ccls PRIVATE -Wno-comment -fno-rtti)
|
||||
endif()
|
||||
|
||||
if(ASAN)
|
||||
target_compile_options(cquery PRIVATE -fsanitize=address,undefined)
|
||||
target_compile_options(ccls PRIVATE -fsanitize=address,undefined)
|
||||
# target_link_libraries also takes linker flags
|
||||
target_link_libraries(cquery PRIVATE -fsanitize=address,undefined)
|
||||
target_link_libraries(ccls PRIVATE -fsanitize=address,undefined)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -89,50 +89,50 @@ endif()
|
||||
|
||||
# See cmake/FindClang.cmake
|
||||
find_package(Clang REQUIRED)
|
||||
target_link_libraries(cquery PRIVATE Clang::Clang)
|
||||
target_link_libraries(ccls PRIVATE Clang::Clang)
|
||||
|
||||
# Enable threading support
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(cquery PRIVATE Threads::Threads)
|
||||
target_link_libraries(ccls PRIVATE Threads::Threads)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
||||
# loguru calls dladdr
|
||||
target_link_libraries(cquery PRIVATE ${CMAKE_DL_LIBS})
|
||||
target_link_libraries(ccls PRIVATE ${CMAKE_DL_LIBS})
|
||||
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD)
|
||||
# loguru::stacktrace_as_stdstring calls backtrace_symbols
|
||||
# sparsepp/spp_memory.h uses libkvm
|
||||
# src/platform_posix.cc uses libthr
|
||||
find_package(Backtrace REQUIRED)
|
||||
target_link_libraries(cquery PRIVATE ${Backtrace_LIBRARIES} kvm thr)
|
||||
target_link_libraries(ccls PRIVATE ${Backtrace_LIBRARIES} kvm thr)
|
||||
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
|
||||
# sparsepp/spp_memory.h uses LibPsapi
|
||||
target_link_libraries(cquery PRIVATE Psapi)
|
||||
target_link_libraries(ccls PRIVATE Psapi)
|
||||
endif()
|
||||
|
||||
if(CLANG_CXX)
|
||||
# Clang C++ api uses ncurses
|
||||
find_package(Curses REQUIRED)
|
||||
target_link_libraries(cquery PRIVATE ${CURSES_LIBRARIES})
|
||||
target_link_libraries(ccls PRIVATE ${CURSES_LIBRARIES})
|
||||
endif()
|
||||
|
||||
### Definitions
|
||||
|
||||
target_compile_definitions(cquery PRIVATE
|
||||
target_compile_definitions(ccls PRIVATE
|
||||
LOGURU_WITH_STREAMS=1
|
||||
LOGURU_FILENAME_WIDTH=18
|
||||
LOGURU_THREADNAME_WIDTH=13
|
||||
DEFAULT_RESOURCE_DIRECTORY="${Clang_RESOURCE_DIR}")
|
||||
|
||||
if(CLANG_CXX)
|
||||
target_compile_definitions(cquery PRIVATE USE_CLANG_CXX=1 LOGURU_RTTI=0)
|
||||
target_compile_definitions(ccls PRIVATE USE_CLANG_CXX=1 LOGURU_RTTI=0)
|
||||
endif()
|
||||
|
||||
### Includes
|
||||
|
||||
target_include_directories(cquery PRIVATE
|
||||
target_include_directories(ccls PRIVATE
|
||||
src
|
||||
third_party
|
||||
third_party/rapidjson/include
|
||||
@ -143,17 +143,17 @@ target_include_directories(cquery PRIVATE
|
||||
|
||||
### Install
|
||||
|
||||
install(TARGETS cquery RUNTIME DESTINATION bin)
|
||||
install(TARGETS ccls RUNTIME DESTINATION bin)
|
||||
|
||||
# We don't need to install libclang on Windows if we are using downloaded LLVM
|
||||
# since libclang is distributed as a static library on Windows
|
||||
if(NOT SYSTEM_CLANG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL Windows)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES Linux|FreeBSD)
|
||||
set_property(TARGET cquery APPEND PROPERTY
|
||||
set_property(TARGET ccls APPEND PROPERTY
|
||||
INSTALL_RPATH $ORIGIN/../lib)
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
|
||||
set_property(TARGET cquery APPEND PROPERTY
|
||||
set_property(TARGET ccls APPEND PROPERTY
|
||||
INSTALL_RPATH @loader_path/../lib)
|
||||
endif()
|
||||
|
||||
@ -164,9 +164,9 @@ endif()
|
||||
|
||||
### Sources
|
||||
|
||||
target_sources(cquery PRIVATE third_party/siphash.cc)
|
||||
target_sources(ccls PRIVATE third_party/siphash.cc)
|
||||
|
||||
target_sources(cquery PRIVATE
|
||||
target_sources(ccls PRIVATE
|
||||
src/cache_manager.cc
|
||||
src/clang_complete.cc
|
||||
src/clang_cursor.cc
|
||||
@ -215,24 +215,23 @@ target_sources(cquery PRIVATE
|
||||
src/work_thread.cc
|
||||
src/working_files.cc)
|
||||
|
||||
target_sources(cquery PRIVATE
|
||||
src/messages/cquery_base.cc
|
||||
src/messages/cquery_call_hierarchy.cc
|
||||
src/messages/cquery_callers.cc
|
||||
src/messages/cquery_derived.cc
|
||||
src/messages/cquery_did_view.cc
|
||||
src/messages/cquery_file_info.cc
|
||||
src/messages/cquery_freshen_index.cc
|
||||
src/messages/cquery_index_file.cc
|
||||
src/messages/cquery_inheritance_hierarchy.cc
|
||||
src/messages/cquery_member_hierarchy.cc
|
||||
src/messages/cquery_random.cc
|
||||
src/messages/cquery_vars.cc
|
||||
src/messages/cquery_wait.cc
|
||||
target_sources(ccls PRIVATE
|
||||
src/messages/ccls_base.cc
|
||||
src/messages/ccls_call_hierarchy.cc
|
||||
src/messages/ccls_callers.cc
|
||||
src/messages/ccls_derived.cc
|
||||
src/messages/ccls_did_view.cc
|
||||
src/messages/ccls_file_info.cc
|
||||
src/messages/ccls_freshen_index.cc
|
||||
src/messages/ccls_index_file.cc
|
||||
src/messages/ccls_inheritance_hierarchy.cc
|
||||
src/messages/ccls_member_hierarchy.cc
|
||||
src/messages/ccls_random.cc
|
||||
src/messages/ccls_vars.cc
|
||||
src/messages/ccls_wait.cc
|
||||
src/messages/exit.cc
|
||||
src/messages/initialize.cc
|
||||
src/messages/shutdown.cc
|
||||
src/messages/text_document_code_action.cc
|
||||
src/messages/text_document_code_lens.cc
|
||||
src/messages/text_document_completion.cc
|
||||
src/messages/text_document_definition.cc
|
||||
@ -252,4 +251,5 @@ target_sources(cquery PRIVATE
|
||||
src/messages/text_document_type_definition.cc
|
||||
src/messages/workspace_did_change_configuration.cc
|
||||
src/messages/workspace_did_change_watched_files.cc
|
||||
src/messages/workspace_symbol.cc)
|
||||
src/messages/workspace_symbol.cc
|
||||
)
|
||||
|
28
README.md
28
README.md
@ -1,16 +1,6 @@
|
||||
[![Join the chat at https://gitter.im/cquery-project/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cquery-project/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
# ccls
|
||||
|
||||
# cquery
|
||||
|
||||
cquery is a highly-scalable, low-latency language server for C/C++/Objective-C. It is tested
|
||||
and designed for large code bases like
|
||||
[Chromium](https://chromium.googlesource.com/chromium/src/). cquery provides
|
||||
accurate and fast semantic analysis without interrupting workflow.
|
||||
|
||||
![Demo](https://ptpb.pw/GlSQ.png?raw=true)
|
||||
|
||||
cquery implements almost the entire language server protocol and provides
|
||||
some extra features to boot:
|
||||
ccls is a fork of cquery, a C/C++/Objective-C language server.
|
||||
|
||||
* code completion (with both signature help and snippets)
|
||||
* finding [definition](src/messages/text_document_definition.cc)/[references](src/messages/text_document_references.cc)
|
||||
@ -26,19 +16,7 @@ some extra features to boot:
|
||||
* auto-implement functions without a definition
|
||||
* semantic highlighting, including support for [rainbow semantic highlighting](https://medium.com/@evnbr/coding-in-color-3a6db2743a1e)
|
||||
|
||||
# >>> [Getting started](https://github.com/jacobdufault/cquery/wiki/Getting-started) (CLICK HERE) <<<
|
||||
|
||||
<a href="https://repology.org/metapackage/cquery">
|
||||
<img src="https://repology.org/badge/vertical-allrepos/cquery.svg" alt="Packaging status" align="right">
|
||||
</a>
|
||||
|
||||
# Limitations
|
||||
|
||||
cquery is able to respond to queries quickly because it caches a huge amount of
|
||||
information. When a request comes in, cquery just looks it up in the cache
|
||||
without running many computations. As a result, there's a large memory overhead.
|
||||
For example, a full index of Chrome will take about 10gb of memory. If you
|
||||
exclude v8, webkit, and third_party, it goes down to about 6.5gb.
|
||||
# >>> [Getting started](https://github.com/MaskRay/ccls/wiki/Getting-started) (CLICK HERE) <<<
|
||||
|
||||
# License
|
||||
|
||||
|
10
index_tests/_empty_test.cc
Normal file
10
index_tests/_empty_test.cc
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
31
index_tests/class_forward_declaration.cc
Normal file
31
index_tests/class_forward_declaration.cc
Normal file
@ -0,0 +1,31 @@
|
||||
class Foo;
|
||||
class Foo;
|
||||
class Foo {};
|
||||
class Foo;
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": ["1:7-1:10|-1|1|1", "2:7-2:10|-1|1|1", "4:7-4:10|-1|1|1"],
|
||||
"spell": "3:7-3:10|-1|1|2",
|
||||
"extent": "3:1-3:13|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
92
index_tests/constructors/constructor.cc
Normal file
92
index_tests/constructors/constructor.cc
Normal file
@ -0,0 +1,92 @@
|
||||
class Foo {
|
||||
public:
|
||||
Foo() {}
|
||||
};
|
||||
|
||||
void foo() {
|
||||
Foo f;
|
||||
Foo* f2 = new Foo();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": ["3:3-3:6|-1|1|4"],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": ["3:3-3:6|0|2|4", "7:3-7:6|-1|1|4", "8:3-8:6|-1|1|4", "8:17-8:20|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 3385168158331140247,
|
||||
"detailed_name": "void Foo::Foo()",
|
||||
"short_name": "Foo",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:3-3:6|0|2|2",
|
||||
"extent": "3:3-3:11|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["7:7-7:8|1|3|288", "8:17-8:20|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "6:6-6:9|-1|1|2",
|
||||
"extent": "6:1-9:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0, 1],
|
||||
"uses": [],
|
||||
"callees": ["7:7-7:8|0|3|288", "7:7-7:8|0|3|288", "8:17-8:20|0|3|32", "8:17-8:20|0|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 18410644574635149442,
|
||||
"detailed_name": "Foo f",
|
||||
"short_name": "f",
|
||||
"declarations": [],
|
||||
"spell": "7:7-7:8|1|3|2",
|
||||
"extent": "7:3-7:8|1|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 11468802633764653592,
|
||||
"detailed_name": "Foo *f2",
|
||||
"short_name": "f2",
|
||||
"hover": "Foo *f2 = new Foo()",
|
||||
"declarations": [],
|
||||
"spell": "8:8-8:10|1|3|2",
|
||||
"extent": "8:3-8:22|1|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
100
index_tests/constructors/destructor.cc
Normal file
100
index_tests/constructors/destructor.cc
Normal file
@ -0,0 +1,100 @@
|
||||
class Foo {
|
||||
public:
|
||||
Foo() {}
|
||||
~Foo() {};
|
||||
};
|
||||
|
||||
void foo() {
|
||||
Foo f;
|
||||
}
|
||||
|
||||
// TODO: Support destructors (notice how the dtor has no usages listed).
|
||||
// - check if variable is a pointer. if so, do *not* insert dtor
|
||||
// - check if variable is normal type. if so, insert dtor
|
||||
// - scan for statements that look like dtors in function def handler
|
||||
// - figure out some way to support w/ unique_ptrs?
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": ["3:3-3:6|-1|1|4", "4:4-4:7|-1|1|4"],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0, 1],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["3:3-3:6|0|2|4", "8:3-8:6|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 3385168158331140247,
|
||||
"detailed_name": "void Foo::Foo()",
|
||||
"short_name": "Foo",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:3-3:6|0|2|2",
|
||||
"extent": "3:3-3:11|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["8:7-8:8|2|3|288"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 7440261702884428359,
|
||||
"detailed_name": "void Foo::~Foo() noexcept",
|
||||
"short_name": "~Foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "4:3-4:7|0|2|2",
|
||||
"extent": "4:3-4:12|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "7:6-7:9|-1|1|2",
|
||||
"extent": "7:1-9:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0],
|
||||
"uses": [],
|
||||
"callees": ["8:7-8:8|0|3|288", "8:7-8:8|0|3|288"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 9954632887635271906,
|
||||
"detailed_name": "Foo f",
|
||||
"short_name": "f",
|
||||
"declarations": [],
|
||||
"spell": "8:7-8:8|2|3|2",
|
||||
"extent": "8:3-8:8|2|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
90
index_tests/constructors/implicit_constructor.cc
Normal file
90
index_tests/constructors/implicit_constructor.cc
Normal file
@ -0,0 +1,90 @@
|
||||
struct Type {
|
||||
Type() {}
|
||||
};
|
||||
|
||||
void Make() {
|
||||
Type foo0;
|
||||
auto foo1 = Type();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 13487927231218873822,
|
||||
"detailed_name": "Type",
|
||||
"short_name": "Type",
|
||||
"kind": 23,
|
||||
"declarations": ["2:3-2:7|-1|1|4"],
|
||||
"spell": "1:8-1:12|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": ["2:3-2:7|0|2|4", "6:3-6:7|-1|1|4", "7:15-7:19|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 10530961286677896857,
|
||||
"detailed_name": "void Type::Type()",
|
||||
"short_name": "Type",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "2:3-2:7|0|2|2",
|
||||
"extent": "2:3-2:12|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["6:8-6:12|1|3|288", "7:15-7:19|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 3957104924306079513,
|
||||
"detailed_name": "void Make()",
|
||||
"short_name": "Make",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:6-5:10|-1|1|2",
|
||||
"extent": "5:1-8:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0, 1],
|
||||
"uses": [],
|
||||
"callees": ["6:8-6:12|0|3|288", "6:8-6:12|0|3|288", "7:15-7:19|0|3|32", "7:15-7:19|0|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 17348451315735351657,
|
||||
"detailed_name": "Type foo0",
|
||||
"short_name": "foo0",
|
||||
"declarations": [],
|
||||
"spell": "6:8-6:12|1|3|2",
|
||||
"extent": "6:3-6:12|1|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 3757978174345638825,
|
||||
"detailed_name": "Type foo1",
|
||||
"short_name": "foo1",
|
||||
"declarations": [],
|
||||
"spell": "7:8-7:12|1|3|2",
|
||||
"extent": "7:3-7:21|1|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
51
index_tests/constructors/invalid_reference.cc
Normal file
51
index_tests/constructors/invalid_reference.cc
Normal file
@ -0,0 +1,51 @@
|
||||
struct Foo {};
|
||||
|
||||
template<class T>
|
||||
Foo::Foo() {}
|
||||
|
||||
/*
|
||||
EXTRA_FLAGS:
|
||||
-fms-compatibility
|
||||
-fdelayed-template-parsing
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": ["4:6-4:9|-1|1|4"],
|
||||
"spell": "1:8-1:11|-1|1|2",
|
||||
"extent": "1:1-1:14|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["4:6-4:9|-1|1|4", "4:1-4:4|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 17319723337446061757,
|
||||
"detailed_name": "void Foo::Foo()",
|
||||
"short_name": "Foo",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "4:6-4:9|0|2|2",
|
||||
"extent": "4:1-4:11|-1|1|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
353
index_tests/constructors/make_functions.cc
Normal file
353
index_tests/constructors/make_functions.cc
Normal file
@ -0,0 +1,353 @@
|
||||
#include "make_functions.h"
|
||||
|
||||
template <typename T, typename... Args>
|
||||
T* MakeUnique(Args&&... args) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
T* maKE_NoRefs(Args... args) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void caller22() {
|
||||
MakeUnique<Foobar>();
|
||||
MakeUnique<Foobar>(1);
|
||||
MakeUnique<Foobar>(1, new Bar(), nullptr);
|
||||
maKE_NoRefs<Foobar>(1, new Bar(), nullptr);
|
||||
}
|
||||
|
||||
// TODO: Eliminate the extra entries in the "types" array here. They come from
|
||||
// the template function definitions.
|
||||
|
||||
// Foobar is defined in a separate file to ensure that we can attribute
|
||||
// MakeUnique calls across translation units.
|
||||
|
||||
/*
|
||||
OUTPUT: make_functions.h
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 12993848456528750350,
|
||||
"detailed_name": "Bar",
|
||||
"short_name": "Bar",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "1:8-1:11|-1|1|2",
|
||||
"extent": "1:1-1:14|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:17-7:20|-1|1|4", "8:15-8:18|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 14935975554338052500,
|
||||
"detailed_name": "Foobar",
|
||||
"short_name": "Foobar",
|
||||
"kind": 5,
|
||||
"declarations": ["5:3-5:9|-1|1|4", "6:3-6:9|-1|1|4", "7:3-7:9|-1|1|4", "8:3-8:9|-1|1|4"],
|
||||
"spell": "3:7-3:13|-1|1|2",
|
||||
"extent": "3:1-9:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0, 1, 2, 3],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:3-5:9|1|2|4", "6:3-6:9|1|2|4", "7:3-7:9|1|2|4", "8:3-8:9|1|2|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 13131778807733950299,
|
||||
"detailed_name": "void Foobar::Foobar()",
|
||||
"short_name": "Foobar",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:3-5:9|1|2|2",
|
||||
"extent": "5:3-5:14|1|2|0",
|
||||
"declaring_type": 1,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13028995015627606181,
|
||||
"detailed_name": "void Foobar::Foobar(int)",
|
||||
"short_name": "Foobar",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "6:3-6:9|1|2|2",
|
||||
"extent": "6:3-6:17|1|2|0",
|
||||
"declaring_type": 1,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 3765833212244435302,
|
||||
"detailed_name": "void Foobar::Foobar(int &&, Bar *, bool *)",
|
||||
"short_name": "Foobar",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "7:3-7:9|1|2|2",
|
||||
"extent": "7:3-7:32|1|2|0",
|
||||
"declaring_type": 1,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 17321436359755983845,
|
||||
"detailed_name": "void Foobar::Foobar(int, Bar *, bool *)",
|
||||
"short_name": "Foobar",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "8:3-8:9|1|2|2",
|
||||
"extent": "8:3-8:30|1|2|0",
|
||||
"declaring_type": 1,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
OUTPUT: make_functions.cc
|
||||
{
|
||||
"includes": [{
|
||||
"line": 0,
|
||||
"resolved_path": "&make_functions.h"
|
||||
}],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 7902098450755788854,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "3:20-3:21|0|3|2",
|
||||
"extent": "3:11-3:21|0|3|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["4:1-4:2|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12533159752419999454,
|
||||
"detailed_name": "Args",
|
||||
"short_name": "Args",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "3:35-3:39|0|3|2",
|
||||
"extent": "3:23-3:39|0|3|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["4:15-4:19|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 18441628706991062891,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "8:20-8:21|1|3|2",
|
||||
"extent": "8:11-8:21|1|3|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["9:1-9:2|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 9441341235704820385,
|
||||
"detailed_name": "Args",
|
||||
"short_name": "Args",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "8:35-8:39|1|3|2",
|
||||
"extent": "8:23-8:39|1|3|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["9:16-9:20|-1|1|4"]
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 14935975554338052500,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["14:14-14:20|-1|1|4", "15:14-15:20|-1|1|4", "16:14-16:20|-1|1|4", "17:15-17:21|-1|1|4"]
|
||||
}, {
|
||||
"id": 5,
|
||||
"usr": 12993848456528750350,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["16:29-16:32|-1|1|4", "17:30-17:33|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 15793662558620604611,
|
||||
"detailed_name": "T *MakeUnique(Args &&... args)",
|
||||
"short_name": "MakeUnique",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "4:4-4:14|-1|1|2",
|
||||
"extent": "4:1-6:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0],
|
||||
"uses": ["14:3-14:13|2|3|32", "15:3-15:13|2|3|32", "16:3-16:13|2|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 2532818908869373467,
|
||||
"detailed_name": "T *maKE_NoRefs(Args... args)",
|
||||
"short_name": "maKE_NoRefs",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "9:4-9:15|-1|1|2",
|
||||
"extent": "9:1-11:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [1],
|
||||
"uses": ["17:3-17:14|2|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 2816883305867289955,
|
||||
"detailed_name": "void caller22()",
|
||||
"short_name": "caller22",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "13:6-13:14|-1|1|2",
|
||||
"extent": "13:1-18:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["14:3-14:13|0|3|32", "15:3-15:13|0|3|32", "16:3-16:13|0|3|32", "17:3-17:14|1|3|32"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 13131778807733950299,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["14:3-14:13|-1|1|288"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 13028995015627606181,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["15:3-15:13|-1|1|288"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 5,
|
||||
"usr": 3765833212244435302,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["16:3-16:13|-1|1|288"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 6,
|
||||
"usr": 17321436359755983845,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["17:3-17:14|-1|1|288"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 15288691366352169805,
|
||||
"detailed_name": "Args &&... args",
|
||||
"short_name": "args",
|
||||
"declarations": [],
|
||||
"spell": "4:25-4:29|0|3|2",
|
||||
"extent": "4:15-4:29|0|3|0",
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12338908251430965107,
|
||||
"detailed_name": "Args... args",
|
||||
"short_name": "args",
|
||||
"declarations": [],
|
||||
"spell": "9:24-9:28|1|3|2",
|
||||
"extent": "9:16-9:28|1|3|0",
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
10
index_tests/constructors/make_functions.h
Normal file
10
index_tests/constructors/make_functions.h
Normal file
@ -0,0 +1,10 @@
|
||||
struct Bar {};
|
||||
|
||||
class Foobar {
|
||||
public:
|
||||
Foobar() {}
|
||||
Foobar(int) {}
|
||||
Foobar(int&&, Bar*, bool*) {}
|
||||
Foobar(int, Bar*, bool*) {}
|
||||
};
|
||||
|
33
index_tests/declaration_vs_definition/class.cc
Normal file
33
index_tests/declaration_vs_definition/class.cc
Normal file
@ -0,0 +1,33 @@
|
||||
class Foo;
|
||||
class Foo;
|
||||
class Foo {};
|
||||
class Foo;
|
||||
|
||||
/*
|
||||
// NOTE: Separate decl/definition are not supported for classes. See source
|
||||
// for comments.
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": ["1:7-1:10|-1|1|1", "2:7-2:10|-1|1|1", "4:7-4:10|-1|1|1"],
|
||||
"spell": "3:7-3:10|-1|1|2",
|
||||
"extent": "3:1-3:13|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
56
index_tests/declaration_vs_definition/class_member.cc
Normal file
56
index_tests/declaration_vs_definition/class_member.cc
Normal file
@ -0,0 +1,56 @@
|
||||
class Foo {
|
||||
int foo;
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 9736582033442720743,
|
||||
"detailed_name": "int Foo::foo",
|
||||
"short_name": "foo",
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:10|0|2|2",
|
||||
"extent": "2:3-2:10|0|2|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
58
index_tests/declaration_vs_definition/class_member_static.cc
Normal file
58
index_tests/declaration_vs_definition/class_member_static.cc
Normal file
@ -0,0 +1,58 @@
|
||||
class Foo {
|
||||
static int foo;
|
||||
};
|
||||
|
||||
int Foo::foo;
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0],
|
||||
"instances": [],
|
||||
"uses": ["5:5-5:8|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 8942920329766232482,
|
||||
"detailed_name": "int Foo::foo",
|
||||
"short_name": "foo",
|
||||
"declarations": ["2:14-2:17|0|2|1"],
|
||||
"spell": "5:10-5:13|0|2|2",
|
||||
"extent": "5:1-5:13|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
40
index_tests/declaration_vs_definition/func.cc
Normal file
40
index_tests/declaration_vs_definition/func.cc
Normal file
@ -0,0 +1,40 @@
|
||||
void foo();
|
||||
void foo();
|
||||
void foo() {}
|
||||
void foo();
|
||||
|
||||
/*
|
||||
// Note: we always use the latest seen ("most local") definition/declaration.
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "1:6-1:9|-1|1|1",
|
||||
"param_spellings": []
|
||||
}, {
|
||||
"spell": "2:6-2:9|-1|1|1",
|
||||
"param_spellings": []
|
||||
}, {
|
||||
"spell": "4:6-4:9|-1|1|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "3:6-3:9|-1|1|2",
|
||||
"extent": "3:1-3:14|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
@ -0,0 +1,78 @@
|
||||
int foo(int, int);
|
||||
int foo(int aa,
|
||||
int bb);
|
||||
int foo(int aaa, int bbb);
|
||||
int foo(int a, int b) { return 0; }
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 2747674671862363334,
|
||||
"detailed_name": "int foo(int a, int b)",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "1:5-1:8|-1|1|1",
|
||||
"param_spellings": ["1:12-1:12", "1:17-1:17"]
|
||||
}, {
|
||||
"spell": "2:5-2:8|-1|1|1",
|
||||
"param_spellings": ["2:13-2:15", "3:13-3:15"]
|
||||
}, {
|
||||
"spell": "4:5-4:8|-1|1|1",
|
||||
"param_spellings": ["4:13-4:16", "4:22-4:25"]
|
||||
}],
|
||||
"spell": "5:5-5:8|-1|1|2",
|
||||
"extent": "5:1-5:36|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0, 1],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 10480417713467708012,
|
||||
"detailed_name": "int a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "5:13-5:14|0|3|2",
|
||||
"extent": "5:9-5:14|0|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 18099600680625658464,
|
||||
"detailed_name": "int b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "5:20-5:21|0|3|2",
|
||||
"extent": "5:16-5:21|0|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
87
index_tests/declaration_vs_definition/method.cc
Normal file
87
index_tests/declaration_vs_definition/method.cc
Normal file
@ -0,0 +1,87 @@
|
||||
class Foo {
|
||||
void declonly();
|
||||
virtual void purevirtual() = 0;
|
||||
void def();
|
||||
};
|
||||
|
||||
void Foo::def() {}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0, 1, 2],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:6-7:9|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 4012226004228259562,
|
||||
"detailed_name": "void Foo::declonly()",
|
||||
"short_name": "declonly",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:8-2:16|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 10939323144126021546,
|
||||
"detailed_name": "void Foo::purevirtual()",
|
||||
"short_name": "purevirtual",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "3:16-3:27|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 15416083548883122431,
|
||||
"detailed_name": "void Foo::def()",
|
||||
"short_name": "def",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "4:8-4:11|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "7:11-7:14|0|2|2",
|
||||
"extent": "7:1-7:19|-1|1|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
90
index_tests/enums/enum_class_decl.cc
Normal file
90
index_tests/enums/enum_class_decl.cc
Normal file
@ -0,0 +1,90 @@
|
||||
typedef unsigned char uint8_t;
|
||||
enum class Foo : uint8_t {
|
||||
A,
|
||||
B = 20
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 5,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 2010430204259339553,
|
||||
"detailed_name": "uint8_t",
|
||||
"short_name": "uint8_t",
|
||||
"kind": 252,
|
||||
"hover": "typedef unsigned char uint8_t",
|
||||
"declarations": [],
|
||||
"spell": "1:23-1:30|-1|1|2",
|
||||
"extent": "1:1-1:30|-1|1|0",
|
||||
"alias_of": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:23-1:30|-1|1|4", "2:12-2:15|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 16985894625255407295,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "2:12-2:15|-1|1|2",
|
||||
"extent": "2:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 439339022761937396,
|
||||
"detailed_name": "Foo::A",
|
||||
"short_name": "A",
|
||||
"hover": "Foo::A = 0",
|
||||
"declarations": [],
|
||||
"spell": "3:3-3:4|2|2|2",
|
||||
"extent": "3:3-3:4|2|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 15962370213938840720,
|
||||
"detailed_name": "Foo::B",
|
||||
"short_name": "B",
|
||||
"hover": "Foo::B = 20",
|
||||
"declarations": [],
|
||||
"spell": "4:3-4:4|2|2|2",
|
||||
"extent": "4:3-4:9|2|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
57
index_tests/enums/enum_decl.cc
Normal file
57
index_tests/enums/enum_decl.cc
Normal file
@ -0,0 +1,57 @@
|
||||
enum Foo {
|
||||
A,
|
||||
B = 20
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 16985894625255407295,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:9|-1|1|2",
|
||||
"extent": "1:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 439339022761937396,
|
||||
"detailed_name": "Foo::A",
|
||||
"short_name": "A",
|
||||
"hover": "Foo::A = 0",
|
||||
"declarations": [],
|
||||
"spell": "2:3-2:4|0|2|2",
|
||||
"extent": "2:3-2:4|0|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 15962370213938840720,
|
||||
"detailed_name": "Foo::B",
|
||||
"short_name": "B",
|
||||
"hover": "Foo::B = 20",
|
||||
"declarations": [],
|
||||
"spell": "3:3-3:4|0|2|2",
|
||||
"extent": "3:3-3:9|0|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
138
index_tests/enums/enum_inherit.cc
Normal file
138
index_tests/enums/enum_inherit.cc
Normal file
@ -0,0 +1,138 @@
|
||||
enum Foo : int {
|
||||
A,
|
||||
B = 20
|
||||
};
|
||||
|
||||
typedef int int32_t;
|
||||
|
||||
enum class E : int32_t {
|
||||
E0,
|
||||
E20 = 20
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 16985894625255407295,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:9|-1|1|2",
|
||||
"extent": "1:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 14939241684006947339,
|
||||
"detailed_name": "int32_t",
|
||||
"short_name": "int32_t",
|
||||
"kind": 252,
|
||||
"hover": "typedef int int32_t",
|
||||
"declarations": [],
|
||||
"spell": "6:13-6:20|-1|1|2",
|
||||
"extent": "6:1-6:20|-1|1|0",
|
||||
"alias_of": 1,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["6:13-6:20|-1|1|4", "8:12-8:13|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 2986879766914123941,
|
||||
"detailed_name": "E",
|
||||
"short_name": "E",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "8:12-8:13|-1|1|2",
|
||||
"extent": "8:1-11:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 439339022761937396,
|
||||
"detailed_name": "Foo::A",
|
||||
"short_name": "A",
|
||||
"hover": "Foo::A = 0",
|
||||
"declarations": [],
|
||||
"spell": "2:3-2:4|0|2|2",
|
||||
"extent": "2:3-2:4|0|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 15962370213938840720,
|
||||
"detailed_name": "Foo::B",
|
||||
"short_name": "B",
|
||||
"hover": "Foo::B = 20",
|
||||
"declarations": [],
|
||||
"spell": "3:3-3:4|0|2|2",
|
||||
"extent": "3:3-3:9|0|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 16614320383091394267,
|
||||
"detailed_name": "E::E0",
|
||||
"short_name": "E0",
|
||||
"hover": "E::E0 = 0",
|
||||
"declarations": [],
|
||||
"spell": "9:3-9:5|3|2|2",
|
||||
"extent": "9:3-9:5|3|2|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 16847439761518576294,
|
||||
"detailed_name": "E::E20",
|
||||
"short_name": "E20",
|
||||
"hover": "E::E20 = 20",
|
||||
"declarations": [],
|
||||
"spell": "10:3-10:6|3|2|2",
|
||||
"extent": "10:3-10:11|3|2|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
72
index_tests/enums/enum_usage.cc
Normal file
72
index_tests/enums/enum_usage.cc
Normal file
@ -0,0 +1,72 @@
|
||||
enum class Foo {
|
||||
A,
|
||||
B = 20
|
||||
};
|
||||
|
||||
Foo x = Foo::A;
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 16985894625255407295,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "1:12-1:15|-1|1|2",
|
||||
"extent": "1:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [2],
|
||||
"uses": ["6:1-6:4|-1|1|4", "6:9-6:12|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 439339022761937396,
|
||||
"detailed_name": "Foo::A",
|
||||
"short_name": "A",
|
||||
"hover": "Foo::A = 0",
|
||||
"declarations": [],
|
||||
"spell": "2:3-2:4|0|2|2",
|
||||
"extent": "2:3-2:4|0|2|0",
|
||||
"type": 0,
|
||||
"uses": ["6:14-6:15|-1|1|4"],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 15962370213938840720,
|
||||
"detailed_name": "Foo::B",
|
||||
"short_name": "B",
|
||||
"hover": "Foo::B = 20",
|
||||
"declarations": [],
|
||||
"spell": "3:3-3:4|0|2|2",
|
||||
"extent": "3:3-3:9|0|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 10677751717622394455,
|
||||
"detailed_name": "Foo x",
|
||||
"short_name": "x",
|
||||
"hover": "Foo x = Foo::A",
|
||||
"declarations": [],
|
||||
"spell": "6:5-6:6|-1|1|2",
|
||||
"extent": "6:1-6:15|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
108
index_tests/foobar.cc
Normal file
108
index_tests/foobar.cc
Normal file
@ -0,0 +1,108 @@
|
||||
enum A {};
|
||||
enum B {};
|
||||
|
||||
template<typename T>
|
||||
struct Foo {
|
||||
struct Inner {};
|
||||
};
|
||||
|
||||
Foo<A>::Inner a;
|
||||
Foo<B> b;
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 6697181287623958829,
|
||||
"detailed_name": "A",
|
||||
"short_name": "A",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:7|-1|1|2",
|
||||
"extent": "1:1-1:10|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["9:5-9:6|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13892793056005362145,
|
||||
"detailed_name": "B",
|
||||
"short_name": "B",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "2:6-2:7|-1|1|2",
|
||||
"extent": "2:1-2:10|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["10:5-10:6|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 10528472276654770367,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "5:8-5:11|-1|1|2",
|
||||
"extent": "5:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1],
|
||||
"uses": ["9:1-9:4|-1|1|4", "10:1-10:4|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 13938528237873543349,
|
||||
"detailed_name": "Foo::Inner",
|
||||
"short_name": "Inner",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "6:10-6:15|2|2|2",
|
||||
"extent": "6:3-6:18|2|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["9:9-9:14|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 16721564935990383768,
|
||||
"detailed_name": "Foo<A>::Inner a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "9:15-9:16|-1|1|2",
|
||||
"extent": "9:1-9:16|-1|1|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12028309045033782423,
|
||||
"detailed_name": "Foo<B> b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "10:8-10:9|-1|1|2",
|
||||
"extent": "10:1-10:9|-1|1|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
28
index_tests/function_declaration.cc
Normal file
28
index_tests/function_declaration.cc
Normal file
@ -0,0 +1,28 @@
|
||||
void foo(int a, int b);
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 2747674671862363334,
|
||||
"detailed_name": "void foo(int a, int b)",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "1:6-1:9|-1|1|1",
|
||||
"param_spellings": ["1:14-1:15", "1:21-1:22"]
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
32
index_tests/function_declaration_definition.cc
Normal file
32
index_tests/function_declaration_definition.cc
Normal file
@ -0,0 +1,32 @@
|
||||
void foo();
|
||||
|
||||
void foo() {}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "1:6-1:9|-1|1|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "3:6-3:9|-1|1|2",
|
||||
"extent": "3:1-3:14|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
27
index_tests/function_definition.cc
Normal file
27
index_tests/function_definition.cc
Normal file
@ -0,0 +1,27 @@
|
||||
void foo() {}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:9|-1|1|2",
|
||||
"extent": "1:1-1:14|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
45
index_tests/inheritance/class_inherit.cc
Normal file
45
index_tests/inheritance/class_inherit.cc
Normal file
@ -0,0 +1,45 @@
|
||||
class Parent {};
|
||||
class Derived : public Parent {};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 3866412049634585509,
|
||||
"detailed_name": "Parent",
|
||||
"short_name": "Parent",
|
||||
"kind": 5,
|
||||
"declarations": ["2:24-2:30|-1|1|4"],
|
||||
"spell": "1:7-1:13|-1|1|2",
|
||||
"extent": "1:1-1:16|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [1],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["2:24-2:30|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 10963370434658308541,
|
||||
"detailed_name": "Derived",
|
||||
"short_name": "Derived",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:14|-1|1|2",
|
||||
"extent": "2:1-2:33|-1|1|0",
|
||||
"bases": [0],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
146
index_tests/inheritance/class_inherit_templated_parent.cc
Normal file
146
index_tests/inheritance/class_inherit_templated_parent.cc
Normal file
@ -0,0 +1,146 @@
|
||||
template<unsigned int C>
|
||||
class Base1 {};
|
||||
|
||||
template<typename C>
|
||||
class Base2 {};
|
||||
|
||||
template<unsigned int T>
|
||||
class Derived1 : Base1<T> {};
|
||||
|
||||
template<typename T>
|
||||
class Derived2 : Base2<T> {};
|
||||
|
||||
class Derived : Base1<3>, Base2<Derived>, Derived1<4>, Derived2<Derived> {};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11930058224338108382,
|
||||
"detailed_name": "Base1",
|
||||
"short_name": "Base1",
|
||||
"kind": 5,
|
||||
"declarations": ["8:18-8:23|-1|1|4", "13:17-13:22|-1|1|4"],
|
||||
"spell": "2:7-2:12|-1|1|2",
|
||||
"extent": "2:1-2:15|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [2, 6],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["8:18-8:23|-1|1|4", "13:17-13:22|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 11118288764693061434,
|
||||
"detailed_name": "Base2",
|
||||
"short_name": "Base2",
|
||||
"kind": 5,
|
||||
"declarations": ["11:18-11:23|-1|1|4", "13:27-13:32|-1|1|4"],
|
||||
"spell": "5:7-5:12|-1|1|2",
|
||||
"extent": "5:1-5:15|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [4, 6],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["11:18-11:23|-1|1|4", "13:27-13:32|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 5863733211528032190,
|
||||
"detailed_name": "Derived1",
|
||||
"short_name": "Derived1",
|
||||
"kind": 5,
|
||||
"declarations": ["13:43-13:51|-1|1|4"],
|
||||
"spell": "8:7-8:15|-1|1|2",
|
||||
"extent": "8:1-8:29|-1|1|0",
|
||||
"bases": [0],
|
||||
"derived": [6],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["13:43-13:51|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 9,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 10651399730831737929,
|
||||
"detailed_name": "Derived2",
|
||||
"short_name": "Derived2",
|
||||
"kind": 5,
|
||||
"declarations": ["13:56-13:64|-1|1|4"],
|
||||
"spell": "11:7-11:15|-1|1|2",
|
||||
"extent": "11:1-11:29|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [6],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["13:56-13:64|-1|1|4"]
|
||||
}, {
|
||||
"id": 5,
|
||||
"usr": 780719166805015998,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "10:19-10:20|-1|1|2",
|
||||
"extent": "10:10-10:20|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["11:24-11:25|-1|1|4"]
|
||||
}, {
|
||||
"id": 6,
|
||||
"usr": 10963370434658308541,
|
||||
"detailed_name": "Derived",
|
||||
"short_name": "Derived",
|
||||
"kind": 5,
|
||||
"declarations": ["13:33-13:40|-1|1|4", "13:65-13:72|-1|1|4"],
|
||||
"spell": "13:7-13:14|-1|1|2",
|
||||
"extent": "13:1-13:76|-1|1|0",
|
||||
"bases": [0, 1, 2, 4],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["13:33-13:40|-1|1|4", "13:65-13:72|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 3880651725784125791,
|
||||
"detailed_name": "unsigned int T",
|
||||
"short_name": "T",
|
||||
"declarations": [],
|
||||
"spell": "7:23-7:24|-1|1|2",
|
||||
"extent": "7:10-7:24|-1|1|0",
|
||||
"type": 3,
|
||||
"uses": ["8:24-8:25|-1|1|4"],
|
||||
"kind": 26,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
79
index_tests/inheritance/class_multiple_inherit.cc
Normal file
79
index_tests/inheritance/class_multiple_inherit.cc
Normal file
@ -0,0 +1,79 @@
|
||||
class Root {};
|
||||
class MiddleA : public Root {};
|
||||
class MiddleB : public Root {};
|
||||
class Derived : public MiddleA, public MiddleB {};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 3897841498936210886,
|
||||
"detailed_name": "Root",
|
||||
"short_name": "Root",
|
||||
"kind": 5,
|
||||
"declarations": ["2:24-2:28|-1|1|4", "3:24-3:28|-1|1|4"],
|
||||
"spell": "1:7-1:11|-1|1|2",
|
||||
"extent": "1:1-1:14|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [1, 2],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["2:24-2:28|-1|1|4", "3:24-3:28|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 11863524815063131483,
|
||||
"detailed_name": "MiddleA",
|
||||
"short_name": "MiddleA",
|
||||
"kind": 5,
|
||||
"declarations": ["4:24-4:31|-1|1|4"],
|
||||
"spell": "2:7-2:14|-1|1|2",
|
||||
"extent": "2:1-2:31|-1|1|0",
|
||||
"bases": [0],
|
||||
"derived": [3],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["4:24-4:31|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 14022569716337624303,
|
||||
"detailed_name": "MiddleB",
|
||||
"short_name": "MiddleB",
|
||||
"kind": 5,
|
||||
"declarations": ["4:40-4:47|-1|1|4"],
|
||||
"spell": "3:7-3:14|-1|1|2",
|
||||
"extent": "3:1-3:31|-1|1|0",
|
||||
"bases": [0],
|
||||
"derived": [3],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["4:40-4:47|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 10963370434658308541,
|
||||
"detailed_name": "Derived",
|
||||
"short_name": "Derived",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "4:7-4:14|-1|1|2",
|
||||
"extent": "4:1-4:50|-1|1|0",
|
||||
"bases": [1, 2],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
82
index_tests/inheritance/function_override.cc
Normal file
82
index_tests/inheritance/function_override.cc
Normal file
@ -0,0 +1,82 @@
|
||||
class Root {
|
||||
virtual void foo();
|
||||
};
|
||||
class Derived : public Root {
|
||||
void foo() override {}
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 3897841498936210886,
|
||||
"detailed_name": "Root",
|
||||
"short_name": "Root",
|
||||
"kind": 5,
|
||||
"declarations": ["4:24-4:28|-1|1|4"],
|
||||
"spell": "1:7-1:11|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [1],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["4:24-4:28|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 10963370434658308541,
|
||||
"detailed_name": "Derived",
|
||||
"short_name": "Derived",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "4:7-4:14|-1|1|2",
|
||||
"extent": "4:1-6:2|-1|1|0",
|
||||
"bases": [0],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [1],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 9948027785633571339,
|
||||
"detailed_name": "void Root::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:16-2:19|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [1],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 6666242542855173890,
|
||||
"detailed_name": "void Derived::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:8-5:11|1|2|2",
|
||||
"extent": "5:3-5:25|1|2|0",
|
||||
"declaring_type": 1,
|
||||
"bases": [0],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
47
index_tests/inheritance/interface_pure_virtual.cc
Normal file
47
index_tests/inheritance/interface_pure_virtual.cc
Normal file
@ -0,0 +1,47 @@
|
||||
class IFoo {
|
||||
virtual void foo() = 0;
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 9949214233977131946,
|
||||
"detailed_name": "IFoo",
|
||||
"short_name": "IFoo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:11|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 3277829753446788562,
|
||||
"detailed_name": "void IFoo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:16-2:19|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
116
index_tests/inheritance/multiple_base_functions.cc
Normal file
116
index_tests/inheritance/multiple_base_functions.cc
Normal file
@ -0,0 +1,116 @@
|
||||
struct Base0 {
|
||||
virtual ~Base0() { }
|
||||
};
|
||||
struct Base1 {
|
||||
virtual ~Base1() { }
|
||||
};
|
||||
struct Derived : Base0, Base1 {
|
||||
~Derived() override { }
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11628904180681204356,
|
||||
"detailed_name": "Base0",
|
||||
"short_name": "Base0",
|
||||
"kind": 23,
|
||||
"declarations": ["2:12-2:17|-1|1|4", "7:18-7:23|-1|1|4"],
|
||||
"spell": "1:8-1:13|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [2],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:18-7:23|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 15826803741381445676,
|
||||
"detailed_name": "Base1",
|
||||
"short_name": "Base1",
|
||||
"kind": 23,
|
||||
"declarations": ["5:12-5:17|-1|1|4", "7:25-7:30|-1|1|4"],
|
||||
"spell": "4:8-4:13|-1|1|2",
|
||||
"extent": "4:1-6:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [2],
|
||||
"types": [],
|
||||
"funcs": [1],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:25-7:30|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 10963370434658308541,
|
||||
"detailed_name": "Derived",
|
||||
"short_name": "Derived",
|
||||
"kind": 23,
|
||||
"declarations": ["8:4-8:11|-1|1|4"],
|
||||
"spell": "7:8-7:15|-1|1|2",
|
||||
"extent": "7:1-9:2|-1|1|0",
|
||||
"bases": [0, 1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [2],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 16347272523198263017,
|
||||
"detailed_name": "void Base0::~Base0() noexcept",
|
||||
"short_name": "~Base0",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "2:11-2:17|0|2|2",
|
||||
"extent": "2:3-2:23|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [2],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 8401779086123965305,
|
||||
"detailed_name": "void Base1::~Base1() noexcept",
|
||||
"short_name": "~Base1",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:11-5:17|1|2|2",
|
||||
"extent": "5:3-5:23|1|2|0",
|
||||
"declaring_type": 1,
|
||||
"bases": [],
|
||||
"derived": [2],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 13164726294460837993,
|
||||
"detailed_name": "void Derived::~Derived() noexcept",
|
||||
"short_name": "~Derived",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "8:3-8:11|2|2|2",
|
||||
"extent": "8:3-8:26|2|2|0",
|
||||
"declaring_type": 2,
|
||||
"bases": [0, 1],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
115
index_tests/lambdas/lambda.cc
Normal file
115
index_tests/lambdas/lambda.cc
Normal file
@ -0,0 +1,115 @@
|
||||
void foo() {
|
||||
int x;
|
||||
|
||||
auto dosomething = [&x](int y) {
|
||||
++x;
|
||||
++y;
|
||||
};
|
||||
|
||||
dosomething(1);
|
||||
dosomething(1);
|
||||
dosomething(1);
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 2],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 1287417953265234030,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:9|-1|1|2",
|
||||
"extent": "1:1-12:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0, 1],
|
||||
"uses": [],
|
||||
"callees": ["9:14-9:15|1|3|32", "10:14-10:15|1|3|32", "11:14-11:15|1|3|32"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 1328781044864682611,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["9:14-9:15|0|3|32", "10:14-10:15|0|3|32", "11:14-11:15|0|3|32"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 17270098654620601683,
|
||||
"detailed_name": "int x",
|
||||
"short_name": "x",
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:8|0|3|2",
|
||||
"extent": "2:3-2:8|0|3|0",
|
||||
"type": 0,
|
||||
"uses": ["5:7-5:8|-1|1|4", "4:24-4:25|0|3|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 16806544259835773270,
|
||||
"detailed_name": "lambda dosomething",
|
||||
"short_name": "dosomething",
|
||||
"declarations": [],
|
||||
"spell": "4:8-4:19|0|3|2",
|
||||
"extent": "4:3-7:4|0|3|0",
|
||||
"type": 1,
|
||||
"uses": ["9:3-9:14|0|3|4", "10:3-10:14|0|3|4", "11:3-11:14|0|3|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 2034725908368218782,
|
||||
"detailed_name": "int y",
|
||||
"short_name": "y",
|
||||
"declarations": [],
|
||||
"spell": "4:31-4:32|0|3|2",
|
||||
"extent": "4:27-4:32|0|3|0",
|
||||
"type": 0,
|
||||
"uses": ["6:7-6:8|0|3|4"],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
95
index_tests/macros/complex.cc
Normal file
95
index_tests/macros/complex.cc
Normal file
@ -0,0 +1,95 @@
|
||||
#define FOO(aaa, bbb) \
|
||||
int a();\
|
||||
int a() { return aaa + bbb; }
|
||||
|
||||
|
||||
int make1() {
|
||||
return 3;
|
||||
}
|
||||
const int make2 = 5;
|
||||
|
||||
|
||||
FOO(make1(), make2);
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 14400399977994209582,
|
||||
"detailed_name": "int make1()",
|
||||
"short_name": "make1",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "6:5-6:10|-1|1|2",
|
||||
"extent": "6:1-8:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["12:5-12:10|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 9720930732776154610,
|
||||
"detailed_name": "int a()",
|
||||
"short_name": "a",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "12:1-12:20|-1|1|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "12:1-12:20|-1|1|2",
|
||||
"extent": "12:1-12:20|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["12:5-12:10|0|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 2878407290385495202,
|
||||
"detailed_name": "const int make2",
|
||||
"short_name": "make2",
|
||||
"hover": "const int make2 = 5",
|
||||
"declarations": [],
|
||||
"spell": "9:11-9:16|-1|1|2",
|
||||
"extent": "9:1-9:20|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": ["12:14-12:19|1|3|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 4261071340275951718,
|
||||
"detailed_name": "FOO",
|
||||
"short_name": "FOO",
|
||||
"hover": "#define FOO(aaa, bbb)\n int a();\n int a() { return aaa + bbb; }",
|
||||
"declarations": [],
|
||||
"spell": "1:9-1:12|-1|1|2",
|
||||
"extent": "1:9-3:32|-1|1|0",
|
||||
"uses": ["12:1-12:4|-1|1|4"],
|
||||
"kind": 255,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
102
index_tests/macros/foo.cc
Normal file
102
index_tests/macros/foo.cc
Normal file
@ -0,0 +1,102 @@
|
||||
#define A 5
|
||||
#define DISALLOW(type) type(type&&) = delete;
|
||||
|
||||
struct Foo {
|
||||
DISALLOW(Foo);
|
||||
};
|
||||
|
||||
int x = A;
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": ["5:12-5:15|-1|1|4"],
|
||||
"spell": "4:8-4:11|-1|1|2",
|
||||
"extent": "4:1-6:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:12-5:15|0|2|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 13788753348312146871,
|
||||
"detailed_name": "void Foo::Foo(Foo &&)",
|
||||
"short_name": "Foo",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:12-5:15|0|2|2",
|
||||
"extent": "5:12-5:16|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 10677751717622394455,
|
||||
"detailed_name": "int x",
|
||||
"short_name": "x",
|
||||
"hover": "int x = A",
|
||||
"declarations": [],
|
||||
"spell": "8:5-8:6|-1|1|2",
|
||||
"extent": "8:1-8:10|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 7651988378939587454,
|
||||
"detailed_name": "A",
|
||||
"short_name": "A",
|
||||
"hover": "#define A 5",
|
||||
"declarations": [],
|
||||
"spell": "1:9-1:10|-1|1|2",
|
||||
"extent": "1:9-1:12|-1|1|0",
|
||||
"uses": ["8:9-8:10|-1|1|4"],
|
||||
"kind": 255,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 14946041066794678724,
|
||||
"detailed_name": "DISALLOW",
|
||||
"short_name": "DISALLOW",
|
||||
"hover": "#define DISALLOW(type) type(type&&) = delete;",
|
||||
"declarations": [],
|
||||
"spell": "2:9-2:17|-1|1|2",
|
||||
"extent": "2:9-2:46|-1|1|0",
|
||||
"uses": ["5:3-5:11|-1|1|4"],
|
||||
"kind": 255,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
51
index_tests/method_declaration.cc
Normal file
51
index_tests/method_declaration.cc
Normal file
@ -0,0 +1,51 @@
|
||||
class Foo {
|
||||
void foo();
|
||||
};
|
||||
|
||||
/*
|
||||
// NOTE: Lack of declaring_type in functions and funcs in Foo is okay, because
|
||||
// those are processed when we find the definition for Foo::foo. Pure
|
||||
// virtuals are treated specially and get added to the type immediately.
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 17922201480358737771,
|
||||
"detailed_name": "void Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:8-2:11|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
51
index_tests/method_definition.cc
Normal file
51
index_tests/method_definition.cc
Normal file
@ -0,0 +1,51 @@
|
||||
class Foo {
|
||||
void foo() const;
|
||||
};
|
||||
|
||||
void Foo::foo() const {}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:6-5:9|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 6446764306530590711,
|
||||
"detailed_name": "void Foo::foo() const",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:8-2:11|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "5:11-5:14|0|2|2",
|
||||
"extent": "5:1-5:25|-1|1|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
46
index_tests/method_inline_declaration.cc
Normal file
46
index_tests/method_inline_declaration.cc
Normal file
@ -0,0 +1,46 @@
|
||||
class Foo {
|
||||
void foo() {}
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 17922201480358737771,
|
||||
"detailed_name": "void Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:11|0|2|2",
|
||||
"extent": "2:3-2:16|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
97
index_tests/multi_file/funky_enum.cc
Normal file
97
index_tests/multi_file/funky_enum.cc
Normal file
@ -0,0 +1,97 @@
|
||||
enum Foo {
|
||||
#include "funky_enum.h"
|
||||
};
|
||||
|
||||
/*
|
||||
// TODO: In the future try to have better support for types defined across
|
||||
// multiple files.
|
||||
|
||||
OUTPUT: funky_enum.h
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 16985894625255407295,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 439339022761937396,
|
||||
"detailed_name": "Foo::A",
|
||||
"short_name": "A",
|
||||
"hover": "Foo::A = 0",
|
||||
"declarations": [],
|
||||
"spell": "4:1-4:2|0|2|2",
|
||||
"extent": "4:1-4:2|0|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 15962370213938840720,
|
||||
"detailed_name": "Foo::B",
|
||||
"short_name": "B",
|
||||
"hover": "Foo::B = 1",
|
||||
"declarations": [],
|
||||
"spell": "5:1-5:2|0|2|2",
|
||||
"extent": "5:1-5:2|0|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 8524995777615948802,
|
||||
"detailed_name": "Foo::C",
|
||||
"short_name": "C",
|
||||
"hover": "Foo::C = 2",
|
||||
"declarations": [],
|
||||
"spell": "6:1-6:2|0|2|2",
|
||||
"extent": "6:1-6:2|0|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
OUTPUT: funky_enum.cc
|
||||
{
|
||||
"includes": [{
|
||||
"line": 1,
|
||||
"resolved_path": "&funky_enum.h"
|
||||
}],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 16985894625255407295,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:9|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
6
index_tests/multi_file/funky_enum.h
Normal file
6
index_tests/multi_file/funky_enum.h
Normal file
@ -0,0 +1,6 @@
|
||||
// This file cannot be built directory. It is included in an enum definition of
|
||||
// another file.
|
||||
|
||||
A,
|
||||
B,
|
||||
C
|
18
index_tests/multi_file/header.h
Normal file
18
index_tests/multi_file/header.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
struct Base {};
|
||||
|
||||
struct SameFileDerived : Base {};
|
||||
|
||||
using Foo0 = SameFileDerived;
|
||||
|
||||
template <typename T>
|
||||
void Foo1() {}
|
||||
|
||||
template <typename T>
|
||||
struct Foo2 {};
|
||||
|
||||
enum Foo3 { A, B, C };
|
||||
|
||||
int Foo4;
|
||||
static int Foo5;
|
229
index_tests/multi_file/impl.cc
Normal file
229
index_tests/multi_file/impl.cc
Normal file
@ -0,0 +1,229 @@
|
||||
#include "header.h"
|
||||
|
||||
void Impl() {
|
||||
Foo1<int>();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT: header.h
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 8420119006782424779,
|
||||
"detailed_name": "Base",
|
||||
"short_name": "Base",
|
||||
"kind": 23,
|
||||
"declarations": ["5:26-5:30|-1|1|4"],
|
||||
"spell": "3:8-3:12|-1|1|2",
|
||||
"extent": "3:1-3:15|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [1],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:26-5:30|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 16750616846959666305,
|
||||
"detailed_name": "SameFileDerived",
|
||||
"short_name": "SameFileDerived",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "5:8-5:23|-1|1|2",
|
||||
"extent": "5:1-5:33|-1|1|0",
|
||||
"bases": [0],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:14-7:29|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 619345544228965342,
|
||||
"detailed_name": "Foo0",
|
||||
"short_name": "Foo0",
|
||||
"kind": 252,
|
||||
"hover": "using Foo0 = SameFileDerived",
|
||||
"declarations": [],
|
||||
"spell": "7:7-7:11|-1|1|2",
|
||||
"extent": "7:1-7:29|-1|1|0",
|
||||
"alias_of": 1,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:7-7:11|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 529393482671181129,
|
||||
"detailed_name": "Foo2",
|
||||
"short_name": "Foo2",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "13:8-13:12|-1|1|2",
|
||||
"extent": "13:1-13:15|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 4481210672785600703,
|
||||
"detailed_name": "Foo3",
|
||||
"short_name": "Foo3",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "15:6-15:10|-1|1|2",
|
||||
"extent": "15:1-15:22|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 5,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [3, 4],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 11650481237659640387,
|
||||
"detailed_name": "void Foo1()",
|
||||
"short_name": "Foo1",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "10:6-10:10|-1|1|2",
|
||||
"extent": "10:1-10:15|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 6141718166919284735,
|
||||
"detailed_name": "Foo3::A",
|
||||
"short_name": "A",
|
||||
"hover": "Foo3::A = 0",
|
||||
"declarations": [],
|
||||
"spell": "15:13-15:14|4|2|2",
|
||||
"extent": "15:13-15:14|4|2|0",
|
||||
"type": 4,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17716334512218775320,
|
||||
"detailed_name": "Foo3::B",
|
||||
"short_name": "B",
|
||||
"hover": "Foo3::B = 1",
|
||||
"declarations": [],
|
||||
"spell": "15:16-15:17|4|2|2",
|
||||
"extent": "15:16-15:17|4|2|0",
|
||||
"type": 4,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 7285646116511901840,
|
||||
"detailed_name": "Foo3::C",
|
||||
"short_name": "C",
|
||||
"hover": "Foo3::C = 2",
|
||||
"declarations": [],
|
||||
"spell": "15:19-15:20|4|2|2",
|
||||
"extent": "15:19-15:20|4|2|0",
|
||||
"type": 4,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 2638219001294786365,
|
||||
"detailed_name": "int Foo4",
|
||||
"short_name": "Foo4",
|
||||
"declarations": [],
|
||||
"spell": "17:5-17:9|-1|1|2",
|
||||
"extent": "17:1-17:9|-1|1|0",
|
||||
"type": 5,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 8395885290297540138,
|
||||
"detailed_name": "int Foo5",
|
||||
"short_name": "Foo5",
|
||||
"declarations": [],
|
||||
"spell": "18:12-18:16|-1|1|2",
|
||||
"extent": "18:1-18:16|-1|1|0",
|
||||
"type": 5,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 3
|
||||
}]
|
||||
}
|
||||
OUTPUT: impl.cc
|
||||
{
|
||||
"includes": [{
|
||||
"line": 0,
|
||||
"resolved_path": "&header.h"
|
||||
}],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 5817708529036841195,
|
||||
"detailed_name": "void Impl()",
|
||||
"short_name": "Impl",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:6-3:10|-1|1|2",
|
||||
"extent": "3:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["4:3-4:7|1|3|32"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 11650481237659640387,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["4:3-4:7|0|3|32"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
3
index_tests/multi_file/simple_header.h
Normal file
3
index_tests/multi_file/simple_header.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void header();
|
71
index_tests/multi_file/simple_impl.cc
Normal file
71
index_tests/multi_file/simple_impl.cc
Normal file
@ -0,0 +1,71 @@
|
||||
#include "simple_header.h"
|
||||
|
||||
void impl() {
|
||||
header();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT: simple_header.h
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 16236105532929924676,
|
||||
"detailed_name": "void header()",
|
||||
"short_name": "header",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "3:6-3:12|-1|1|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
OUTPUT: simple_impl.cc
|
||||
{
|
||||
"includes": [{
|
||||
"line": 0,
|
||||
"resolved_path": "&simple_header.h"
|
||||
}],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 3373269392705484958,
|
||||
"detailed_name": "void impl()",
|
||||
"short_name": "impl",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:6-3:10|-1|1|2",
|
||||
"extent": "3:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["4:3-4:9|1|3|32"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 16236105532929924676,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["4:3-4:9|0|3|32"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
88
index_tests/multi_file/static.cc
Normal file
88
index_tests/multi_file/static.cc
Normal file
@ -0,0 +1,88 @@
|
||||
#include "static.h"
|
||||
|
||||
void Buffer::CreateSharedBuffer() {}
|
||||
|
||||
/*
|
||||
OUTPUT: static.h
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 9411323049603567600,
|
||||
"detailed_name": "Buffer",
|
||||
"short_name": "Buffer",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "3:8-3:14|-1|1|2",
|
||||
"extent": "3:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 14576076421851654759,
|
||||
"detailed_name": "void Buffer::CreateSharedBuffer()",
|
||||
"short_name": "CreateSharedBuffer",
|
||||
"kind": 254,
|
||||
"storage": 3,
|
||||
"declarations": [{
|
||||
"spell": "4:15-4:33|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
OUTPUT: static.cc
|
||||
{
|
||||
"includes": [{
|
||||
"line": 0,
|
||||
"resolved_path": "&static.h"
|
||||
}],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 9411323049603567600,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["3:6-3:12|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 14576076421851654759,
|
||||
"detailed_name": "void Buffer::CreateSharedBuffer()",
|
||||
"short_name": "CreateSharedBuffer",
|
||||
"kind": 254,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:14-3:32|0|2|2",
|
||||
"extent": "3:1-3:37|-1|1|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
5
index_tests/multi_file/static.h
Normal file
5
index_tests/multi_file/static.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
struct Buffer {
|
||||
static void CreateSharedBuffer();
|
||||
};
|
45
index_tests/namespaces/anonymous_function.cc
Normal file
45
index_tests/namespaces/anonymous_function.cc
Normal file
@ -0,0 +1,45 @@
|
||||
namespace {
|
||||
void foo();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 7144845543074395457,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 5010253035933134245,
|
||||
"detailed_name": "void (anon)::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:6-2:9|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
61
index_tests/namespaces/function_declaration.cc
Normal file
61
index_tests/namespaces/function_declaration.cc
Normal file
@ -0,0 +1,61 @@
|
||||
namespace hello {
|
||||
void foo(int a, int b);
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 2029211996748007610,
|
||||
"detailed_name": "hello",
|
||||
"short_name": "hello",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:16|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:16|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 18343102288837190527,
|
||||
"detailed_name": "void hello::foo(int a, int b)",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:6-2:9|0|2|1",
|
||||
"param_spellings": ["2:14-2:15", "2:21-2:22"]
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
60
index_tests/namespaces/function_definition.cc
Normal file
60
index_tests/namespaces/function_definition.cc
Normal file
@ -0,0 +1,60 @@
|
||||
namespace hello {
|
||||
void foo() {}
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 2029211996748007610,
|
||||
"detailed_name": "hello",
|
||||
"short_name": "hello",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:16|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:16|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 243328841292951622,
|
||||
"detailed_name": "void hello::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "2:6-2:9|0|2|2",
|
||||
"extent": "2:1-2:14|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
79
index_tests/namespaces/method_declaration.cc
Normal file
79
index_tests/namespaces/method_declaration.cc
Normal file
@ -0,0 +1,79 @@
|
||||
namespace hello {
|
||||
class Foo {
|
||||
void foo();
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 2029211996748007610,
|
||||
"detailed_name": "hello",
|
||||
"short_name": "hello",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:16|-1|1|2",
|
||||
"extent": "1:1-5:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:16|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 4508214972876735896,
|
||||
"detailed_name": "hello::Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:10|0|2|2",
|
||||
"extent": "2:1-4:2|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 10487325150128053272,
|
||||
"detailed_name": "void hello::Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "3:8-3:11|2|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 2,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
83
index_tests/namespaces/method_definition.cc
Normal file
83
index_tests/namespaces/method_definition.cc
Normal file
@ -0,0 +1,83 @@
|
||||
namespace hello {
|
||||
class Foo {
|
||||
void foo();
|
||||
};
|
||||
|
||||
void Foo::foo() {}
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 2029211996748007610,
|
||||
"detailed_name": "hello",
|
||||
"short_name": "hello",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:16|-1|1|2",
|
||||
"extent": "1:1-7:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:16|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 4508214972876735896,
|
||||
"detailed_name": "hello::Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:10|0|2|2",
|
||||
"extent": "2:1-4:2|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["6:6-6:9|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 10487325150128053272,
|
||||
"detailed_name": "void hello::Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "3:8-3:11|2|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "6:11-6:14|2|2|2",
|
||||
"extent": "6:1-6:19|0|2|0",
|
||||
"declaring_type": 2,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
78
index_tests/namespaces/method_inline_declaration.cc
Normal file
78
index_tests/namespaces/method_inline_declaration.cc
Normal file
@ -0,0 +1,78 @@
|
||||
namespace hello {
|
||||
class Foo {
|
||||
void foo() {}
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 2029211996748007610,
|
||||
"detailed_name": "hello",
|
||||
"short_name": "hello",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:16|-1|1|2",
|
||||
"extent": "1:1-5:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:16|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 4508214972876735896,
|
||||
"detailed_name": "hello::Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:10|0|2|2",
|
||||
"extent": "2:1-4:2|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 10487325150128053272,
|
||||
"detailed_name": "void hello::Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:8-3:11|2|2|2",
|
||||
"extent": "3:3-3:16|2|2|0",
|
||||
"declaring_type": 2,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
171
index_tests/namespaces/namespace_alias.cc
Normal file
171
index_tests/namespaces/namespace_alias.cc
Normal file
@ -0,0 +1,171 @@
|
||||
namespace foo {
|
||||
namespace bar {
|
||||
namespace baz {
|
||||
int qux = 42;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace fbz = foo::bar::baz;
|
||||
|
||||
void func() {
|
||||
int a = foo::bar::baz::qux;
|
||||
int b = fbz::qux;
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 926793467007732869,
|
||||
"detailed_name": "foo",
|
||||
"short_name": "foo",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:14|-1|1|2",
|
||||
"extent": "1:1-7:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [2],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:14|-1|1|4", "9:17-9:20|-1|1|4", "12:11-12:14|0|3|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 17805385787823406700,
|
||||
"detailed_name": "foo::bar",
|
||||
"short_name": "bar",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "2:15-2:18|0|2|2",
|
||||
"extent": "2:5-6:6|0|2|0",
|
||||
"bases": [0],
|
||||
"derived": [3],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["2:15-2:18|0|2|4", "9:22-9:25|-1|1|4", "12:16-12:19|0|3|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 14450849931009540802,
|
||||
"detailed_name": "foo::bar::baz",
|
||||
"short_name": "baz",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "3:20-3:23|2|2|2",
|
||||
"extent": "3:10-5:11|2|2|0",
|
||||
"bases": [2],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0],
|
||||
"instances": [],
|
||||
"uses": ["3:20-3:23|2|2|4", "9:27-9:30|-1|1|4", "12:21-12:24|0|3|4"]
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1, 2],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 5,
|
||||
"usr": 11879713791858506216,
|
||||
"detailed_name": "fbz",
|
||||
"short_name": "fbz",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"spell": "9:11-9:14|-1|1|2",
|
||||
"extent": "9:1-9:30|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["13:11-13:14|0|3|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 10818727483146447186,
|
||||
"detailed_name": "void func()",
|
||||
"short_name": "func",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "11:6-11:10|-1|1|2",
|
||||
"extent": "11:1-14:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [1, 2],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 15042442838933090518,
|
||||
"detailed_name": "int foo::bar::baz::qux",
|
||||
"short_name": "qux",
|
||||
"hover": "int foo::bar::baz::qux = 42",
|
||||
"declarations": [],
|
||||
"spell": "4:18-4:21|3|2|2",
|
||||
"extent": "4:14-4:26|3|2|0",
|
||||
"type": 4,
|
||||
"uses": ["12:26-12:29|-1|1|4", "13:16-13:19|-1|1|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 107714981785063096,
|
||||
"detailed_name": "int a",
|
||||
"short_name": "a",
|
||||
"hover": "int a = foo::bar::baz::qux",
|
||||
"declarations": [],
|
||||
"spell": "12:7-12:8|0|3|2",
|
||||
"extent": "12:3-12:29|0|3|0",
|
||||
"type": 4,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 1200087780658383286,
|
||||
"detailed_name": "int b",
|
||||
"short_name": "b",
|
||||
"hover": "int b = fbz::qux",
|
||||
"declarations": [],
|
||||
"spell": "13:7-13:8|0|3|2",
|
||||
"extent": "13:3-13:19|0|3|0",
|
||||
"type": 4,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
123
index_tests/namespaces/namespace_reference.cc
Normal file
123
index_tests/namespaces/namespace_reference.cc
Normal file
@ -0,0 +1,123 @@
|
||||
namespace ns {
|
||||
int Foo;
|
||||
void Accept(int a) {}
|
||||
}
|
||||
|
||||
void Runner() {
|
||||
ns::Accept(ns::Foo);
|
||||
using namespace ns;
|
||||
Accept(Foo);
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11072669167287398027,
|
||||
"detailed_name": "ns",
|
||||
"short_name": "ns",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:13|-1|1|2",
|
||||
"extent": "1:1-4:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [0],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:13|-1|1|4", "7:3-7:5|1|3|4", "7:14-7:16|1|3|4", "8:19-8:21|1|3|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 17328473273923617489,
|
||||
"detailed_name": "void ns::Accept(int a)",
|
||||
"short_name": "Accept",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:8-3:14|0|2|2",
|
||||
"extent": "3:3-3:24|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [1],
|
||||
"uses": ["7:7-7:13|1|3|32", "9:3-9:9|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 631910859630953711,
|
||||
"detailed_name": "void Runner()",
|
||||
"short_name": "Runner",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "6:6-6:12|-1|1|2",
|
||||
"extent": "6:1-10:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["7:7-7:13|0|3|32", "9:3-9:9|0|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 12898699035586282159,
|
||||
"detailed_name": "int ns::Foo",
|
||||
"short_name": "Foo",
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:10|0|2|2",
|
||||
"extent": "2:3-2:10|0|2|0",
|
||||
"type": 2,
|
||||
"uses": ["7:18-7:21|1|3|4", "9:10-9:13|1|3|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 7976909968919750794,
|
||||
"detailed_name": "int a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "3:19-3:20|0|3|2",
|
||||
"extent": "3:15-3:20|0|3|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
184
index_tests/objective-c/class.m
Normal file
184
index_tests/objective-c/class.m
Normal file
@ -0,0 +1,184 @@
|
||||
@interface AClass
|
||||
+ (void)test;
|
||||
- (void)anInstanceMethod;
|
||||
@property (nonatomic) int aProp;
|
||||
@end
|
||||
|
||||
@implementation AClass
|
||||
+ (void)test {}
|
||||
- (void)anInstanceMethod {}
|
||||
@end
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AClass *instance = [AClass init];
|
||||
[instance anInstanceMethod];
|
||||
instance.aProp = 12;
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11832280568361305387,
|
||||
"detailed_name": "AClass",
|
||||
"short_name": "AClass",
|
||||
"kind": 7,
|
||||
"spell": "7:17-7:23|-1|1|2",
|
||||
"extent": "7:1-10:2|-1|1|0",
|
||||
"parents": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [2],
|
||||
"uses": ["14:3-14:9|-1|1|4", "14:23-14:29|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"parents": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 12775970426728664910,
|
||||
"detailed_name": "AClass::test",
|
||||
"short_name": "test",
|
||||
"kind": 17,
|
||||
"storage": 0,
|
||||
"declarations": [{
|
||||
"spelling": "2:11-2:15",
|
||||
"extent": "2:3-2:16",
|
||||
"content": "+ (void)test;",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "8:9-8:13|-1|1|2",
|
||||
"extent": "8:1-8:16|-1|1|0",
|
||||
"base": [],
|
||||
"derived": [],
|
||||
"locals": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 4096877434426330804,
|
||||
"detailed_name": "AClass::anInstanceMethod",
|
||||
"short_name": "anInstanceMethod",
|
||||
"kind": 16,
|
||||
"storage": 0,
|
||||
"declarations": [{
|
||||
"spelling": "3:11-3:27",
|
||||
"extent": "3:3-3:28",
|
||||
"content": "- (void)anInstanceMethod;",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "9:9-9:25|-1|1|2",
|
||||
"extent": "9:1-9:28|-1|1|0",
|
||||
"base": [],
|
||||
"derived": [],
|
||||
"locals": [],
|
||||
"uses": ["15:13-15:29|4|3|64"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 12774569141855220778,
|
||||
"detailed_name": "AClass::aProp",
|
||||
"short_name": "aProp",
|
||||
"kind": 16,
|
||||
"storage": 0,
|
||||
"declarations": [{
|
||||
"spelling": "0:0-0:0",
|
||||
"extent": "4:29-4:34",
|
||||
"content": "aProp",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"extent": "4:29-4:34|-1|1|0",
|
||||
"base": [],
|
||||
"derived": [],
|
||||
"locals": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 17992064398538597892,
|
||||
"detailed_name": "AClass::setAProp:",
|
||||
"short_name": "setAProp:",
|
||||
"kind": 16,
|
||||
"storage": 0,
|
||||
"declarations": [{
|
||||
"spelling": "0:0-0:0",
|
||||
"extent": "4:29-4:34",
|
||||
"content": "aProp",
|
||||
"param_spellings": ["4:29-4:34"]
|
||||
}],
|
||||
"extent": "4:29-4:34|-1|1|0",
|
||||
"base": [],
|
||||
"derived": [],
|
||||
"locals": [],
|
||||
"uses": ["0:0-0:0|4|3|64"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 7033269674615638282,
|
||||
"detailed_name": "int main()",
|
||||
"short_name": "main",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "12:5-12:9|-1|1|2",
|
||||
"extent": "12:1-17:2|-1|1|0",
|
||||
"base": [],
|
||||
"derived": [],
|
||||
"locals": [],
|
||||
"uses": [],
|
||||
"callees": ["15:13-15:29|1|3|64", "0:0-0:0|3|3|64"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 14842397373703114213,
|
||||
"detailed_name": "int AClass::aProp",
|
||||
"short_name": "aProp",
|
||||
"declarations": ["4:29-4:34|-1|1|1"],
|
||||
"type": 1,
|
||||
"uses": ["16:12-16:17|4|3|4"],
|
||||
"kind": 19,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17112602610366149042,
|
||||
"detailed_name": "int AClass::_aProp",
|
||||
"short_name": "_aProp",
|
||||
"declarations": [],
|
||||
"spell": "4:29-4:34|-1|1|2",
|
||||
"extent": "4:29-4:34|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 14,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 6849095699869081177,
|
||||
"detailed_name": "AClass *instance",
|
||||
"short_name": "instance",
|
||||
"hover": "AClass *instance = [AClass init]",
|
||||
"declarations": [],
|
||||
"spell": "14:11-14:19|4|3|2",
|
||||
"extent": "14:3-14:35|4|3|2",
|
||||
"type": 0,
|
||||
"uses": ["15:4-15:12|4|3|4", "16:3-16:11|4|3|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
100
index_tests/operators/operator.cc
Normal file
100
index_tests/operators/operator.cc
Normal file
@ -0,0 +1,100 @@
|
||||
class Foo {
|
||||
void operator()(int) { }
|
||||
void operator()(bool);
|
||||
int operator()(int a, int b);
|
||||
};
|
||||
|
||||
Foo &operator += (const Foo&, const int&);
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0, 1, 2],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:1-7:4|-1|1|4", "7:25-7:28|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 7874436189163837815,
|
||||
"detailed_name": "void Foo::operator()(int)",
|
||||
"short_name": "operator()",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:18|0|2|2",
|
||||
"extent": "2:3-2:27|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 3545323327609582678,
|
||||
"detailed_name": "void Foo::operator()(bool)",
|
||||
"short_name": "operator()",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "3:8-3:18|0|2|1",
|
||||
"param_spellings": ["3:23-3:23"]
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 3986818119971932909,
|
||||
"detailed_name": "int Foo::operator()(int a, int b)",
|
||||
"short_name": "operator()",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "4:7-4:17|0|2|1",
|
||||
"param_spellings": ["4:22-4:23", "4:29-4:30"]
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 8288368475529136092,
|
||||
"detailed_name": "Foo &operator+=(const Foo &, const int &)",
|
||||
"short_name": "operator+=",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "7:6-7:17|-1|1|1",
|
||||
"param_spellings": ["7:29-7:29", "7:41-7:41"]
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
120
index_tests/outline/outline.cc
Normal file
120
index_tests/outline/outline.cc
Normal file
@ -0,0 +1,120 @@
|
||||
#include <vector>
|
||||
|
||||
struct MergeableUpdate {
|
||||
int a;
|
||||
int b;
|
||||
std::vector<int> to_add;
|
||||
};
|
||||
|
||||
/*
|
||||
TEXT_REPLACE:
|
||||
std::__1::vector <===> std::vector
|
||||
c:@N@std@ST>2#T#T@vector <===> c:@N@std@N@__1@ST>2#T#T@vector
|
||||
10956461108384510180 <===> 9178760565669096175
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [{
|
||||
"line": 0,
|
||||
"resolved_path": "&vector"
|
||||
}],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 14399919566014425846,
|
||||
"detailed_name": "MergeableUpdate",
|
||||
"short_name": "MergeableUpdate",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "3:8-3:23|-1|1|2",
|
||||
"extent": "3:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0, 1, 2],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 9178760565669096175,
|
||||
"detailed_name": "std::vector",
|
||||
"short_name": "vector",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [2],
|
||||
"uses": ["6:8-6:14|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 5401847601697785946,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["6:3-6:6|0|2|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 11633578660978286467,
|
||||
"detailed_name": "int MergeableUpdate::a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "4:7-4:8|0|2|2",
|
||||
"extent": "4:3-4:8|0|2|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 14949552147532317793,
|
||||
"detailed_name": "int MergeableUpdate::b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "5:7-5:8|0|2|2",
|
||||
"extent": "5:3-5:8|0|2|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 9003350345237582363,
|
||||
"detailed_name": "std::vector<int> MergeableUpdate::to_add",
|
||||
"short_name": "to_add",
|
||||
"declarations": [],
|
||||
"spell": "6:20-6:26|0|2|2",
|
||||
"extent": "6:3-6:26|0|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
158
index_tests/outline/outline2.cc
Normal file
158
index_tests/outline/outline2.cc
Normal file
@ -0,0 +1,158 @@
|
||||
//#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct CompilationEntry {
|
||||
std::string directory;
|
||||
std::string filename;
|
||||
std::vector<std::string> args;
|
||||
};
|
||||
|
||||
std::vector<CompilationEntry> LoadCompilationEntriesFromDirectory(const std::string& project_directory);
|
||||
|
||||
/*
|
||||
TEXT_REPLACE:
|
||||
std::__1::vector <===> std::vector
|
||||
std::__1::string <===> std::string
|
||||
std::__cxx11::string <===> std::string
|
||||
c:@N@std@string <===> c:@N@std@N@__1@T@string
|
||||
c:@N@std@T@string <===> c:@N@std@N@__1@T@string
|
||||
c:@N@std@N@__cxx11@T@string <===> c:@N@std@N@__1@T@string
|
||||
c:@N@std@ST>2#T#T@vector <===> c:@N@std@N@__1@ST>2#T#T@vector
|
||||
c:@F@LoadCompilationEntriesFromDirectory#&1$@N@std@N@__1@S@basic_string>#C#$@N@std@N@__1@S@char_traits>#C#$@N@std@N@__1@S@allocator>#C# <===> c:@F@LoadCompilationEntriesFromDirectory#&1$@N@std@S@basic_string>#C#$@N@std@S@char_traits>#C#$@N@std@S@allocator>#C#
|
||||
c:@F@LoadCompilationEntriesFromDirectory#&1$@N@std@N@__cxx11@S@basic_string>#C#$@N@std@S@char_traits>#C#$@N@std@S@allocator>#C# <===> c:@F@LoadCompilationEntriesFromDirectory#&1$@N@std@S@basic_string>#C#$@N@std@S@char_traits>#C#$@N@std@S@allocator>#C#
|
||||
4160338041907786 <===> 14151982074805896770
|
||||
7543170857910783654 <===> 14151982074805896770
|
||||
9802818309312685221 <===> 11244864715202245734
|
||||
7636646237071509980 <===> 14151982074805896770
|
||||
9178760565669096175 <===> 10956461108384510180
|
||||
10468929532989002392 <===> 11244864715202245734
|
||||
4160338041907786 <===> 14151982074805896770
|
||||
9802818309312685221 <===> 11244864715202245734
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [{
|
||||
"line": 2,
|
||||
"resolved_path": "&string"
|
||||
}, {
|
||||
"line": 3,
|
||||
"resolved_path": "&vector"
|
||||
}],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 4992269036372211530,
|
||||
"detailed_name": "CompilationEntry",
|
||||
"short_name": "CompilationEntry",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "6:8-6:24|-1|1|2",
|
||||
"extent": "6:1-10:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0, 1, 2],
|
||||
"instances": [],
|
||||
"uses": ["12:13-12:29|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 14151982074805896770,
|
||||
"detailed_name": "std::string",
|
||||
"short_name": "string",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": ["7:8-7:14|-1|1|4", "8:8-8:14|-1|1|4", "9:20-9:26|-1|1|4", "12:78-12:84|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 5401847601697785946,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:3-7:6|0|2|4", "8:3-8:6|0|2|4", "9:3-9:6|0|2|4", "9:15-9:18|0|2|4", "12:1-12:4|-1|1|4", "12:73-12:76|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 10956461108384510180,
|
||||
"detailed_name": "std::vector",
|
||||
"short_name": "vector",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [2],
|
||||
"uses": ["9:8-9:14|-1|1|4", "12:6-12:12|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 11244864715202245734,
|
||||
"detailed_name": "std::vector<CompilationEntry> LoadCompilationEntriesFromDirectory(const std::string &project_directory)",
|
||||
"short_name": "LoadCompilationEntriesFromDirectory",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "12:31-12:66|-1|1|1",
|
||||
"param_spellings": ["12:86-12:103"]
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 1153224798516629792,
|
||||
"detailed_name": "std::string CompilationEntry::directory",
|
||||
"short_name": "directory",
|
||||
"declarations": [],
|
||||
"spell": "7:15-7:24|0|2|2",
|
||||
"extent": "7:3-7:24|0|2|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 2255668374222866345,
|
||||
"detailed_name": "std::string CompilationEntry::filename",
|
||||
"short_name": "filename",
|
||||
"declarations": [],
|
||||
"spell": "8:15-8:23|0|2|2",
|
||||
"extent": "8:3-8:23|0|2|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 12616880765274259414,
|
||||
"detailed_name": "std::vector<std::string> CompilationEntry::args",
|
||||
"short_name": "args",
|
||||
"declarations": [],
|
||||
"spell": "9:28-9:32|0|2|2",
|
||||
"extent": "9:3-9:32|0|2|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
192
index_tests/outline/static_function_in_type.cc
Normal file
192
index_tests/outline/static_function_in_type.cc
Normal file
@ -0,0 +1,192 @@
|
||||
#include "static_function_in_type.h"
|
||||
|
||||
namespace ns {
|
||||
// static
|
||||
void Foo::Register(Manager* m) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT: static_function_in_type.h
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11072669167287398027,
|
||||
"detailed_name": "ns",
|
||||
"short_name": "ns",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:13|-1|1|2",
|
||||
"extent": "1:1-9:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:13|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 1972401196751872203,
|
||||
"detailed_name": "ns::Manager",
|
||||
"short_name": "Manager",
|
||||
"kind": 5,
|
||||
"declarations": ["3:7-3:14|0|2|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["6:24-6:31|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 17262466801709381811,
|
||||
"detailed_name": "ns::Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "5:8-5:11|0|2|2",
|
||||
"extent": "5:1-7:2|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 17019747379608639279,
|
||||
"detailed_name": "void ns::Foo::Register(ns::Manager *)",
|
||||
"short_name": "Register",
|
||||
"kind": 254,
|
||||
"storage": 3,
|
||||
"declarations": [{
|
||||
"spell": "6:15-6:23|3|2|1",
|
||||
"param_spellings": ["6:32-6:32"]
|
||||
}],
|
||||
"declaring_type": 3,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
OUTPUT: static_function_in_type.cc
|
||||
{
|
||||
"includes": [{
|
||||
"line": 0,
|
||||
"resolved_path": "&static_function_in_type.h"
|
||||
}],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11072669167287398027,
|
||||
"detailed_name": "ns",
|
||||
"short_name": "ns",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "3:11-3:13|-1|1|2",
|
||||
"extent": "3:1-7:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["3:11-3:13|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 17262466801709381811,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:6-5:9|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 1972401196751872203,
|
||||
"detailed_name": "ns::Manager",
|
||||
"short_name": "Manager",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["5:20-5:27|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 17019747379608639279,
|
||||
"detailed_name": "void ns::Foo::Register(ns::Manager *m)",
|
||||
"short_name": "Register",
|
||||
"kind": 254,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:11-5:19|2|2|2",
|
||||
"extent": "5:1-6:2|0|2|0",
|
||||
"declaring_type": 2,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 9285345059965948351,
|
||||
"detailed_name": "ns::Manager *m",
|
||||
"short_name": "m",
|
||||
"declarations": [],
|
||||
"spell": "5:29-5:30|0|3|2",
|
||||
"extent": "5:20-5:30|0|3|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
9
index_tests/outline/static_function_in_type.h
Normal file
9
index_tests/outline/static_function_in_type.h
Normal file
@ -0,0 +1,9 @@
|
||||
namespace ns {
|
||||
|
||||
class Manager;
|
||||
|
||||
struct Foo {
|
||||
static void Register(Manager*);
|
||||
};
|
||||
|
||||
} // namespace ns
|
27
index_tests/preprocessor/include_guard.cc
Normal file
27
index_tests/preprocessor/include_guard.cc
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef FOO
|
||||
#define FOO
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 13076155634261037336,
|
||||
"detailed_name": "FOO",
|
||||
"short_name": "FOO",
|
||||
"hover": "#define FOO",
|
||||
"declarations": [],
|
||||
"spell": "2:9-2:12|-1|1|2",
|
||||
"extent": "2:9-2:12|-1|1|0",
|
||||
"uses": [],
|
||||
"kind": 255,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
25
index_tests/preprocessor/skipped.cc
Normal file
25
index_tests/preprocessor/skipped.cc
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
#ifdef FOOBAR
|
||||
void hello();
|
||||
#endif
|
||||
|
||||
#if false
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(OS_FOO)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": ["2:1-4:7", "6:1-10:7", "12:1-14:7"],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
70
index_tests/templates/func_specialized_template_param.cc
Normal file
70
index_tests/templates/func_specialized_template_param.cc
Normal file
@ -0,0 +1,70 @@
|
||||
template<class T>
|
||||
class Template {};
|
||||
|
||||
struct Foo {
|
||||
void Bar(Template<double>&);
|
||||
};
|
||||
|
||||
void Foo::Bar(Template<double>&) {}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 17107291254533526269,
|
||||
"detailed_name": "Template",
|
||||
"short_name": "Template",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:15|-1|1|2",
|
||||
"extent": "2:1-2:18|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:12-5:20|-1|1|4", "8:15-8:23|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "4:8-4:11|-1|1|2",
|
||||
"extent": "4:1-6:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["8:6-8:9|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 8412238651648388423,
|
||||
"detailed_name": "void Foo::Bar(Template<double> &)",
|
||||
"short_name": "Bar",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "5:8-5:11|1|2|1",
|
||||
"param_spellings": ["5:29-5:29"]
|
||||
}],
|
||||
"spell": "8:11-8:14|1|2|2",
|
||||
"extent": "8:1-8:36|-1|1|0",
|
||||
"declaring_type": 1,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
155
index_tests/templates/implicit_variable_instantiation.cc
Normal file
155
index_tests/templates/implicit_variable_instantiation.cc
Normal file
@ -0,0 +1,155 @@
|
||||
namespace ns {
|
||||
enum VarType {};
|
||||
|
||||
template<typename _>
|
||||
struct Holder {
|
||||
static constexpr VarType static_var = (VarType)0x0;
|
||||
};
|
||||
|
||||
template<typename _>
|
||||
const typename VarType Holder<_>::static_var;
|
||||
|
||||
|
||||
int Foo = Holder<int>::static_var;
|
||||
int Foo2 = Holder<int>::static_var;
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11072669167287398027,
|
||||
"detailed_name": "ns",
|
||||
"short_name": "ns",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:13|-1|1|2",
|
||||
"extent": "1:1-15:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [1, 2],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:13|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 1532099849728741556,
|
||||
"detailed_name": "ns::VarType",
|
||||
"short_name": "VarType",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:15|0|2|2",
|
||||
"extent": "2:3-2:18|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["6:22-6:29|-1|1|4", "6:44-6:51|-1|1|4", "10:18-10:25|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 12688716854043726585,
|
||||
"detailed_name": "ns::Holder",
|
||||
"short_name": "Holder",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "5:10-5:16|0|2|2",
|
||||
"extent": "5:3-7:4|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0],
|
||||
"instances": [],
|
||||
"uses": ["10:26-10:32|-1|1|4", "13:13-13:19|-1|1|4", "14:14-14:20|-1|1|4"]
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 14511917000226829276,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["10:33-10:34|-1|1|4"]
|
||||
}, {
|
||||
"id": 5,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1, 2],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 4731849186641714451,
|
||||
"detailed_name": "const ns::VarType ns::Holder::static_var",
|
||||
"short_name": "static_var",
|
||||
"hover": "const ns::VarType ns::Holder::static_var = (VarType)0x0",
|
||||
"declarations": ["6:30-6:40|3|2|1"],
|
||||
"spell": "10:37-10:47|3|2|2",
|
||||
"extent": "9:3-10:47|0|2|0",
|
||||
"type": 2,
|
||||
"uses": ["13:26-13:36|-1|1|4", "14:27-14:37|-1|1|4"],
|
||||
"kind": 8,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12898699035586282159,
|
||||
"detailed_name": "int ns::Foo",
|
||||
"short_name": "Foo",
|
||||
"hover": "int ns::Foo = Holder<int>::static_var",
|
||||
"declarations": [],
|
||||
"spell": "13:7-13:10|0|2|2",
|
||||
"extent": "13:3-13:36|0|2|0",
|
||||
"type": 5,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 9008550860229740818,
|
||||
"detailed_name": "int ns::Foo2",
|
||||
"short_name": "Foo2",
|
||||
"hover": "int ns::Foo2 = Holder<int>::static_var",
|
||||
"declarations": [],
|
||||
"spell": "14:7-14:11|0|2|2",
|
||||
"extent": "14:3-14:37|0|2|0",
|
||||
"type": 5,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
107
index_tests/templates/member_ref_in_template.cc
Normal file
107
index_tests/templates/member_ref_in_template.cc
Normal file
@ -0,0 +1,107 @@
|
||||
template <class T>
|
||||
struct C {
|
||||
T x;
|
||||
void bar();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void foo() {
|
||||
C<T> d;
|
||||
d.x; // spelling range is empty, use cursor extent for range
|
||||
d.bar(); // spelling range is empty, use cursor extent for range
|
||||
|
||||
auto e = new C<T>;
|
||||
e->x; // `x` seems not exposed by libclang
|
||||
e->bar(); // `bar` seems not exposed by libclang
|
||||
}
|
||||
|
||||
/*
|
||||
EXTRA_FLAGS:
|
||||
-fms-extensions
|
||||
-fms-compatibility
|
||||
-fdelayed-template-parsing
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 8402783583255987702,
|
||||
"detailed_name": "C",
|
||||
"short_name": "C",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:9|-1|1|2",
|
||||
"extent": "2:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [0],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 14750650276757822712,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "1:17-1:18|-1|1|2",
|
||||
"extent": "1:11-1:18|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["3:3-3:4|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 8905286151237717330,
|
||||
"detailed_name": "void C::bar()",
|
||||
"short_name": "bar",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "4:8-4:11|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 6875364467121018690,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "8:6-8:9|-1|1|2",
|
||||
"extent": "8:1-8:11|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 5866801090710377175,
|
||||
"detailed_name": "T C::x",
|
||||
"short_name": "x",
|
||||
"declarations": [],
|
||||
"spell": "3:5-3:6|0|2|2",
|
||||
"extent": "3:3-3:6|0|2|0",
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
@ -0,0 +1,125 @@
|
||||
namespace ns {
|
||||
template<typename T>
|
||||
struct Foo {
|
||||
template<typename R>
|
||||
static int foo() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
int a = Foo<int>::foo<float>();
|
||||
int b = Foo<bool>::foo<double>();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11072669167287398027,
|
||||
"detailed_name": "ns",
|
||||
"short_name": "ns",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:13|-1|1|2",
|
||||
"extent": "1:1-12:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0, 1],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:13|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 14042997404480181958,
|
||||
"detailed_name": "ns::Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "3:10-3:13|0|2|2",
|
||||
"extent": "3:3-8:4|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["10:11-10:14|-1|1|4", "11:11-11:14|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 8221803074608342407,
|
||||
"detailed_name": "int ns::Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 254,
|
||||
"storage": 3,
|
||||
"declarations": [],
|
||||
"spell": "5:16-5:19|2|2|2",
|
||||
"extent": "5:5-7:6|2|2|0",
|
||||
"declaring_type": 2,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["10:21-10:24|0|2|32", "11:22-11:25|0|2|32"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 15768138241775955040,
|
||||
"detailed_name": "int ns::a",
|
||||
"short_name": "a",
|
||||
"hover": "int ns::a = Foo<int>::foo<float>()",
|
||||
"declarations": [],
|
||||
"spell": "10:7-10:8|0|2|2",
|
||||
"extent": "10:3-10:33|0|2|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 3182917058194750998,
|
||||
"detailed_name": "int ns::b",
|
||||
"short_name": "b",
|
||||
"hover": "int ns::b = Foo<bool>::foo<double>()",
|
||||
"declarations": [],
|
||||
"spell": "11:7-11:8|0|2|2",
|
||||
"extent": "11:3-11:35|0|2|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
@ -0,0 +1,88 @@
|
||||
namespace ns {
|
||||
template<typename T>
|
||||
class Foo {};
|
||||
|
||||
Foo<int> a;
|
||||
Foo<bool> b;
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 11072669167287398027,
|
||||
"detailed_name": "ns",
|
||||
"short_name": "ns",
|
||||
"kind": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:11-1:13|-1|1|2",
|
||||
"extent": "1:1-7:2|-1|1|0",
|
||||
"bases": [1],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0, 1],
|
||||
"instances": [],
|
||||
"uses": ["1:11-1:13|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [0],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 14042997404480181958,
|
||||
"detailed_name": "ns::Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "3:9-3:12|0|2|2",
|
||||
"extent": "3:3-3:15|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": ["5:3-5:6|-1|1|4", "6:3-6:6|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 15768138241775955040,
|
||||
"detailed_name": "Foo<int> ns::a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "5:12-5:13|0|2|2",
|
||||
"extent": "5:3-5:13|0|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 3182917058194750998,
|
||||
"detailed_name": "Foo<bool> ns::b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "6:13-6:14|0|2|2",
|
||||
"extent": "6:3-6:14|0|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
436
index_tests/templates/specialization.cc
Normal file
436
index_tests/templates/specialization.cc
Normal file
@ -0,0 +1,436 @@
|
||||
template<class T>
|
||||
class function;
|
||||
|
||||
template<typename T, typename... Args>
|
||||
class function<T(Args...)> {};
|
||||
|
||||
function<void(int)> f;
|
||||
|
||||
template<typename T> class allocator;
|
||||
|
||||
template<typename T, typename Alloc = allocator<T> >
|
||||
class vector {
|
||||
void clear();
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class vector<T*> {};
|
||||
|
||||
struct Z1 {};
|
||||
|
||||
template class vector<Z1>;
|
||||
|
||||
struct Z2 {};
|
||||
|
||||
template<>
|
||||
class vector<Z2> {
|
||||
void clear();
|
||||
};
|
||||
|
||||
vector<char> vc;
|
||||
vector<int*> vip;
|
||||
vector<Z1> vz1;
|
||||
vector<Z2> vz2;
|
||||
|
||||
enum Enum {
|
||||
Enum0, Enum1
|
||||
};
|
||||
template <typename T, int I, Enum, int E>
|
||||
void foo(T Value) {}
|
||||
|
||||
static const int kOnst = 7;
|
||||
template <>
|
||||
void foo<float, 9, Enum0, kOnst + 7>(float Value);
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15019211479263750068,
|
||||
"detailed_name": "function",
|
||||
"short_name": "function",
|
||||
"kind": 5,
|
||||
"declarations": ["2:7-2:15|-1|1|1", "5:7-5:15|-1|1|4"],
|
||||
"spell": "2:7-2:15|-1|1|2",
|
||||
"extent": "1:1-2:15|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [1],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:1-7:9|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 218068462278884837,
|
||||
"detailed_name": "function",
|
||||
"short_name": "function",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "5:7-5:15|-1|1|2",
|
||||
"extent": "4:1-5:30|-1|1|0",
|
||||
"bases": [0],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["7:1-7:9|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 10862637711685426953,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "4:19-4:20|-1|1|2",
|
||||
"extent": "4:10-4:20|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:16-5:17|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 756188769017350739,
|
||||
"detailed_name": "Args",
|
||||
"short_name": "Args",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "4:34-4:38|-1|1|2",
|
||||
"extent": "4:22-4:38|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:18-5:22|-1|1|4"]
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 15695704394170757108,
|
||||
"detailed_name": "allocator",
|
||||
"short_name": "allocator",
|
||||
"kind": 5,
|
||||
"declarations": ["9:28-9:37|-1|1|1", "11:39-11:48|-1|1|4"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 5,
|
||||
"usr": 7440942986741176606,
|
||||
"detailed_name": "vector",
|
||||
"short_name": "vector",
|
||||
"kind": 5,
|
||||
"declarations": ["17:7-17:13|-1|1|4", "26:7-26:13|-1|1|4"],
|
||||
"spell": "12:7-12:13|-1|1|2",
|
||||
"extent": "12:1-14:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [6, 10],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [1, 3, 4],
|
||||
"uses": ["30:1-30:7|-1|1|4", "31:1-31:7|-1|1|4", "32:1-32:7|-1|1|4", "33:1-33:7|-1|1|4"]
|
||||
}, {
|
||||
"id": 6,
|
||||
"usr": 16155717907537731864,
|
||||
"detailed_name": "vector",
|
||||
"short_name": "vector",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "17:7-17:13|-1|1|2",
|
||||
"extent": "16:1-17:20|-1|1|0",
|
||||
"bases": [5],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [2],
|
||||
"uses": ["31:1-31:7|-1|1|4"]
|
||||
}, {
|
||||
"id": 7,
|
||||
"usr": 3421332160420436276,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "16:19-16:20|-1|1|2",
|
||||
"extent": "16:10-16:20|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["17:14-17:15|-1|1|4"]
|
||||
}, {
|
||||
"id": 8,
|
||||
"usr": 5760043510674081814,
|
||||
"detailed_name": "Z1",
|
||||
"short_name": "Z1",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "19:8-19:10|-1|1|2",
|
||||
"extent": "19:1-19:13|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["32:8-32:10|-1|1|4"]
|
||||
}, {
|
||||
"id": 9,
|
||||
"usr": 10124869160135436852,
|
||||
"detailed_name": "Z2",
|
||||
"short_name": "Z2",
|
||||
"kind": 23,
|
||||
"declarations": ["26:14-26:16|-1|1|4"],
|
||||
"spell": "23:8-23:10|-1|1|2",
|
||||
"extent": "23:1-23:13|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["33:8-33:10|-1|1|4"]
|
||||
}, {
|
||||
"id": 10,
|
||||
"usr": 1663022413889915338,
|
||||
"detailed_name": "vector",
|
||||
"short_name": "vector",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "26:7-26:13|-1|1|2",
|
||||
"extent": "25:1-28:2|-1|1|0",
|
||||
"bases": [5],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [1],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 11,
|
||||
"usr": 9201299975592934124,
|
||||
"detailed_name": "Enum",
|
||||
"short_name": "Enum",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "35:6-35:10|-1|1|2",
|
||||
"extent": "35:1-37:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 12,
|
||||
"usr": 2461355892344618654,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "38:20-38:21|2|3|2",
|
||||
"extent": "38:11-38:21|2|3|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["39:10-39:11|-1|1|4"]
|
||||
}, {
|
||||
"id": 13,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [8],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 18107614608385228556,
|
||||
"detailed_name": "void vector::clear()",
|
||||
"short_name": "clear",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "13:8-13:13|5|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 5,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 6113470698424012876,
|
||||
"detailed_name": "void vector::clear()",
|
||||
"short_name": "clear",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "27:8-27:13|10|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 10,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 17498190318698490707,
|
||||
"detailed_name": "void foo(T Value)",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "43:6-43:9|-1|1|1",
|
||||
"param_spellings": ["43:44-43:49"]
|
||||
}],
|
||||
"spell": "39:6-39:9|-1|1|2",
|
||||
"extent": "39:1-39:21|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [7],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 2933643612409209903,
|
||||
"detailed_name": "function<void (int)> f",
|
||||
"short_name": "f",
|
||||
"declarations": [],
|
||||
"spell": "7:21-7:22|-1|1|2",
|
||||
"extent": "7:1-7:22|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 5792869548777559988,
|
||||
"detailed_name": "vector<char> vc",
|
||||
"short_name": "vc",
|
||||
"declarations": [],
|
||||
"spell": "30:14-30:16|-1|1|2",
|
||||
"extent": "30:1-30:16|-1|1|0",
|
||||
"type": 5,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 86949563628772958,
|
||||
"detailed_name": "vector<int *> vip",
|
||||
"short_name": "vip",
|
||||
"declarations": [],
|
||||
"spell": "31:14-31:17|-1|1|2",
|
||||
"extent": "31:1-31:17|-1|1|0",
|
||||
"type": 6,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 3566687051827176322,
|
||||
"detailed_name": "vector<Z1> vz1",
|
||||
"short_name": "vz1",
|
||||
"declarations": [],
|
||||
"spell": "32:12-32:15|-1|1|2",
|
||||
"extent": "32:1-32:15|-1|1|0",
|
||||
"type": 5,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 4,
|
||||
"usr": 15931696253641284761,
|
||||
"detailed_name": "vector<Z2> vz2",
|
||||
"short_name": "vz2",
|
||||
"declarations": [],
|
||||
"spell": "33:12-33:15|-1|1|2",
|
||||
"extent": "33:1-33:15|-1|1|0",
|
||||
"type": 5,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 5,
|
||||
"usr": 15477793821005285152,
|
||||
"detailed_name": "Enum::Enum0",
|
||||
"short_name": "Enum0",
|
||||
"hover": "Enum::Enum0 = 0",
|
||||
"declarations": [],
|
||||
"spell": "36:3-36:8|11|2|2",
|
||||
"extent": "36:3-36:8|11|2|0",
|
||||
"type": 11,
|
||||
"uses": ["43:20-43:25|-1|1|4"],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 6,
|
||||
"usr": 4917621020431490070,
|
||||
"detailed_name": "Enum::Enum1",
|
||||
"short_name": "Enum1",
|
||||
"hover": "Enum::Enum1 = 1",
|
||||
"declarations": [],
|
||||
"spell": "36:10-36:15|11|2|2",
|
||||
"extent": "36:10-36:15|11|2|0",
|
||||
"type": 11,
|
||||
"uses": [],
|
||||
"kind": 22,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 7,
|
||||
"usr": 10307767688451422448,
|
||||
"detailed_name": "T Value",
|
||||
"short_name": "Value",
|
||||
"declarations": [],
|
||||
"spell": "39:12-39:17|2|3|2",
|
||||
"extent": "39:10-39:17|2|3|0",
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 8,
|
||||
"usr": 13914496963221806870,
|
||||
"detailed_name": "const int kOnst",
|
||||
"short_name": "kOnst",
|
||||
"hover": "const int kOnst = 7",
|
||||
"declarations": [],
|
||||
"spell": "41:18-41:23|-1|1|2",
|
||||
"extent": "41:1-41:27|-1|1|0",
|
||||
"type": 13,
|
||||
"uses": ["43:27-43:32|-1|1|4"],
|
||||
"kind": 13,
|
||||
"storage": 3
|
||||
}]
|
||||
}
|
||||
*/
|
81
index_tests/templates/specialized_func_definition.cc
Normal file
81
index_tests/templates/specialized_func_definition.cc
Normal file
@ -0,0 +1,81 @@
|
||||
template<class T>
|
||||
class Template {
|
||||
void Foo();
|
||||
};
|
||||
|
||||
template<class T>
|
||||
void Template<T>::Foo() {}
|
||||
|
||||
template<>
|
||||
void Template<void>::Foo() {}
|
||||
|
||||
|
||||
/*
|
||||
// TODO: usage information on Template is bad.
|
||||
// TODO: Foo() should have multiple definitions.
|
||||
|
||||
EXTRA_FLAGS:
|
||||
-fms-compatibility
|
||||
-fdelayed-template-parsing
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 17107291254533526269,
|
||||
"detailed_name": "Template",
|
||||
"short_name": "Template",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:15|-1|1|2",
|
||||
"extent": "2:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:6-7:14|-1|1|4", "10:6-10:14|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17649312483543982122,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 11994188353303124840,
|
||||
"detailed_name": "void Template::Foo()",
|
||||
"short_name": "Foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "3:8-3:11|0|2|1",
|
||||
"param_spellings": []
|
||||
}, {
|
||||
"spell": "10:22-10:25|-1|1|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "7:19-7:22|0|2|2",
|
||||
"extent": "6:1-7:24|-1|1|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
@ -0,0 +1,92 @@
|
||||
template<typename T>
|
||||
struct Foo {
|
||||
static int foo() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
int a = Foo<int>::foo();
|
||||
int b = Foo<bool>::foo();
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 10528472276654770367,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:11|-1|1|2",
|
||||
"extent": "2:1-6:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["8:9-8:12|-1|1|4", "9:9-9:12|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 8340731781048851399,
|
||||
"detailed_name": "int Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 254,
|
||||
"storage": 3,
|
||||
"declarations": [],
|
||||
"spell": "3:14-3:17|0|2|2",
|
||||
"extent": "3:3-5:4|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["8:19-8:22|-1|1|32", "9:20-9:23|-1|1|32"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 16721564935990383768,
|
||||
"detailed_name": "int a",
|
||||
"short_name": "a",
|
||||
"hover": "int a = Foo<int>::foo()",
|
||||
"declarations": [],
|
||||
"spell": "8:5-8:6|-1|1|2",
|
||||
"extent": "8:1-8:24|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12028309045033782423,
|
||||
"detailed_name": "int b",
|
||||
"short_name": "b",
|
||||
"hover": "int b = Foo<bool>::foo()",
|
||||
"declarations": [],
|
||||
"spell": "9:5-9:6|-1|1|2",
|
||||
"extent": "9:1-9:25|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
@ -0,0 +1,93 @@
|
||||
template<typename T>
|
||||
struct Foo {
|
||||
template<typename R>
|
||||
static int foo() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
int a = Foo<int>::foo<float>();
|
||||
int b = Foo<bool>::foo<double>();
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 10528472276654770367,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:11|-1|1|2",
|
||||
"extent": "2:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["9:9-9:12|-1|1|4", "10:9-10:12|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 9034026360701857235,
|
||||
"detailed_name": "int Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 254,
|
||||
"storage": 3,
|
||||
"declarations": [],
|
||||
"spell": "4:14-4:17|0|2|2",
|
||||
"extent": "4:3-6:4|0|2|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["9:19-9:22|-1|1|32", "10:20-10:23|-1|1|32"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 16721564935990383768,
|
||||
"detailed_name": "int a",
|
||||
"short_name": "a",
|
||||
"hover": "int a = Foo<int>::foo<float>()",
|
||||
"declarations": [],
|
||||
"spell": "9:5-9:6|-1|1|2",
|
||||
"extent": "9:1-9:31|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12028309045033782423,
|
||||
"detailed_name": "int b",
|
||||
"short_name": "b",
|
||||
"hover": "int b = Foo<bool>::foo<double>()",
|
||||
"declarations": [],
|
||||
"spell": "10:5-10:6|-1|1|2",
|
||||
"extent": "10:1-10:33|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
@ -0,0 +1,127 @@
|
||||
enum A {};
|
||||
enum B {};
|
||||
|
||||
template<typename T>
|
||||
struct Foo {
|
||||
struct Inner {};
|
||||
};
|
||||
|
||||
Foo<A>::Inner a;
|
||||
Foo<B>::Inner b;
|
||||
|
||||
#if false
|
||||
EnumDecl A
|
||||
EnumDecl B
|
||||
ClassTemplate Foo
|
||||
TemplateTypeParameter T
|
||||
StructDecl Inner
|
||||
VarDecl a
|
||||
TemplateRef Foo
|
||||
TypeRef enum A
|
||||
TypeRef struct Foo<enum A>::Inner
|
||||
CallExpr Inner
|
||||
VarDecl b
|
||||
TemplateRef Foo
|
||||
TypeRef enum B
|
||||
TypeRef struct Foo<enum B>::Inner
|
||||
CallExpr Inner
|
||||
#endif
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": ["12:1-28:7"],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 6697181287623958829,
|
||||
"detailed_name": "A",
|
||||
"short_name": "A",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:7|-1|1|2",
|
||||
"extent": "1:1-1:10|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["9:5-9:6|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13892793056005362145,
|
||||
"detailed_name": "B",
|
||||
"short_name": "B",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "2:6-2:7|-1|1|2",
|
||||
"extent": "2:1-2:10|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["10:5-10:6|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 10528472276654770367,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "5:8-5:11|-1|1|2",
|
||||
"extent": "5:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["9:1-9:4|-1|1|4", "10:1-10:4|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 13938528237873543349,
|
||||
"detailed_name": "Foo::Inner",
|
||||
"short_name": "Inner",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "6:10-6:15|2|2|2",
|
||||
"extent": "6:3-6:18|2|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": ["9:9-9:14|-1|1|4", "10:9-10:14|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 16721564935990383768,
|
||||
"detailed_name": "Foo<A>::Inner a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "9:15-9:16|-1|1|2",
|
||||
"extent": "9:1-9:16|-1|1|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12028309045033782423,
|
||||
"detailed_name": "Foo<B>::Inner b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "10:15-10:16|-1|1|2",
|
||||
"extent": "10:1-10:16|-1|1|0",
|
||||
"type": 3,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
@ -0,0 +1,85 @@
|
||||
template<typename T>
|
||||
struct Foo {
|
||||
static constexpr int var = 3;
|
||||
};
|
||||
|
||||
int a = Foo<int>::var;
|
||||
int b = Foo<bool>::var;
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 10528472276654770367,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:11|-1|1|2",
|
||||
"extent": "2:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["6:9-6:12|-1|1|4", "7:9-7:12|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1, 2],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 13545144895171991916,
|
||||
"detailed_name": "const int Foo::var",
|
||||
"short_name": "var",
|
||||
"hover": "const int Foo::var = 3",
|
||||
"declarations": ["3:24-3:27|0|2|1"],
|
||||
"type": 1,
|
||||
"uses": ["6:19-6:22|-1|1|4", "7:20-7:23|-1|1|4"],
|
||||
"kind": 8,
|
||||
"storage": 3
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 16721564935990383768,
|
||||
"detailed_name": "int a",
|
||||
"short_name": "a",
|
||||
"hover": "int a = Foo<int>::var",
|
||||
"declarations": [],
|
||||
"spell": "6:5-6:6|-1|1|2",
|
||||
"extent": "6:1-6:22|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 12028309045033782423,
|
||||
"detailed_name": "int b",
|
||||
"short_name": "b",
|
||||
"hover": "int b = Foo<bool>::var",
|
||||
"declarations": [],
|
||||
"spell": "7:5-7:6|-1|1|2",
|
||||
"extent": "7:1-7:23|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
76
index_tests/templates/template_func_usage_folded_into_one.cc
Normal file
76
index_tests/templates/template_func_usage_folded_into_one.cc
Normal file
@ -0,0 +1,76 @@
|
||||
template<typename T>
|
||||
static int foo() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
int a = foo<int>();
|
||||
int b = foo<bool>();
|
||||
|
||||
// TODO: put template foo inside a namespace
|
||||
// TODO: put template foo inside a template class inside a namespace
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 326583651986177228,
|
||||
"detailed_name": "int foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 3,
|
||||
"declarations": [],
|
||||
"spell": "2:12-2:15|-1|1|2",
|
||||
"extent": "2:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["6:9-6:12|-1|1|32", "7:9-7:12|-1|1|32"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 16721564935990383768,
|
||||
"detailed_name": "int a",
|
||||
"short_name": "a",
|
||||
"hover": "int a = foo<int>()",
|
||||
"declarations": [],
|
||||
"spell": "6:5-6:6|-1|1|2",
|
||||
"extent": "6:1-6:19|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12028309045033782423,
|
||||
"detailed_name": "int b",
|
||||
"short_name": "b",
|
||||
"hover": "int b = foo<bool>()",
|
||||
"declarations": [],
|
||||
"spell": "7:5-7:6|-1|1|2",
|
||||
"extent": "7:1-7:20|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
56
index_tests/templates/template_type_usage_folded_into_one.cc
Normal file
56
index_tests/templates/template_type_usage_folded_into_one.cc
Normal file
@ -0,0 +1,56 @@
|
||||
template<typename T>
|
||||
class Foo {};
|
||||
|
||||
Foo<int> a;
|
||||
Foo<bool> b;
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 10528472276654770367,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:10|-1|1|2",
|
||||
"extent": "2:1-2:13|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": ["4:1-4:4|-1|1|4", "5:1-5:4|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 16721564935990383768,
|
||||
"detailed_name": "Foo<int> a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "4:10-4:11|-1|1|2",
|
||||
"extent": "4:1-4:11|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 12028309045033782423,
|
||||
"detailed_name": "Foo<bool> b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "5:11-5:12|-1|1|2",
|
||||
"extent": "5:1-5:12|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
125
index_tests/templates/template_var_usage_folded_into_one.cc
Normal file
125
index_tests/templates/template_var_usage_folded_into_one.cc
Normal file
@ -0,0 +1,125 @@
|
||||
enum A {};
|
||||
enum B {};
|
||||
|
||||
template<typename T>
|
||||
T var = T();
|
||||
|
||||
A a = var<A>;
|
||||
B b = var<B>;
|
||||
|
||||
// NOTE: libclang before 4.0 doesn't expose template usage on |var|.
|
||||
|
||||
#if false
|
||||
EnumDecl A
|
||||
EnumDecl B
|
||||
UnexposedDecl var
|
||||
VarDecl a
|
||||
UnexposedExpr var
|
||||
UnexposedExpr var
|
||||
DeclRefExpr var
|
||||
TypeRef enum A
|
||||
UnexposedDecl var
|
||||
VarDecl b
|
||||
UnexposedExpr var
|
||||
UnexposedExpr var
|
||||
DeclRefExpr var
|
||||
TypeRef enum B
|
||||
UnexposedDecl var
|
||||
#endif
|
||||
|
||||
/*
|
||||
EXTRA_FLAGS:
|
||||
-std=c++14
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": ["12:1-28:7"],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 6697181287623958829,
|
||||
"detailed_name": "A",
|
||||
"short_name": "A",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:7|-1|1|2",
|
||||
"extent": "1:1-1:10|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1],
|
||||
"uses": ["7:1-7:2|-1|1|4", "7:11-7:12|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13892793056005362145,
|
||||
"detailed_name": "B",
|
||||
"short_name": "B",
|
||||
"kind": 10,
|
||||
"declarations": [],
|
||||
"spell": "2:6-2:7|-1|1|2",
|
||||
"extent": "2:1-2:10|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [2],
|
||||
"uses": ["8:1-8:2|-1|1|4", "8:11-8:12|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 8864163146308556810,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["5:1-5:2|-1|1|4", "5:9-5:10|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 8096973118640070624,
|
||||
"detailed_name": "T var",
|
||||
"short_name": "var",
|
||||
"declarations": [],
|
||||
"spell": "5:3-5:6|-1|1|2",
|
||||
"extent": "5:1-5:12|-1|1|0",
|
||||
"uses": ["7:7-7:10|-1|1|4", "8:7-8:10|-1|1|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 16721564935990383768,
|
||||
"detailed_name": "A a",
|
||||
"short_name": "a",
|
||||
"hover": "A a = var<A>",
|
||||
"declarations": [],
|
||||
"spell": "7:3-7:4|-1|1|2",
|
||||
"extent": "7:1-7:13|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 12028309045033782423,
|
||||
"detailed_name": "B b",
|
||||
"short_name": "b",
|
||||
"hover": "B b = var<B>",
|
||||
"declarations": [],
|
||||
"spell": "8:3-8:4|-1|1|2",
|
||||
"extent": "8:1-8:13|-1|1|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
109
index_tests/types/anonymous_struct.cc
Normal file
109
index_tests/types/anonymous_struct.cc
Normal file
@ -0,0 +1,109 @@
|
||||
union vector3 {
|
||||
struct { float x, y, z; };
|
||||
float v[3];
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 17937907487590875128,
|
||||
"detailed_name": "vector3",
|
||||
"short_name": "vector3",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:14|-1|1|2",
|
||||
"extent": "1:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [3],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 1428566502523368801,
|
||||
"detailed_name": "vector3::(anon struct)",
|
||||
"short_name": "(anon struct)",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "2:3-2:9|0|2|2",
|
||||
"extent": "2:3-2:28|0|2|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0, 1, 2],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 21,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1, 2, 3],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 3348817847649945564,
|
||||
"detailed_name": "float vector3::(anon struct)::x",
|
||||
"short_name": "x",
|
||||
"declarations": [],
|
||||
"spell": "2:18-2:19|1|2|2",
|
||||
"extent": "2:12-2:19|1|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 4821094820988543895,
|
||||
"detailed_name": "float vector3::(anon struct)::y",
|
||||
"short_name": "y",
|
||||
"declarations": [],
|
||||
"spell": "2:21-2:22|1|2|2",
|
||||
"extent": "2:12-2:22|1|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 15292551660437765731,
|
||||
"detailed_name": "float vector3::(anon struct)::z",
|
||||
"short_name": "z",
|
||||
"declarations": [],
|
||||
"spell": "2:24-2:25|1|2|2",
|
||||
"extent": "2:12-2:25|1|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 1963212417280098348,
|
||||
"detailed_name": "float [3] vector3::v",
|
||||
"short_name": "v",
|
||||
"declarations": [],
|
||||
"spell": "3:9-3:10|0|2|2",
|
||||
"extent": "3:3-3:13|0|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
61
index_tests/types/typedefs.cc
Normal file
61
index_tests/types/typedefs.cc
Normal file
@ -0,0 +1,61 @@
|
||||
typedef int (func)(const int *a, const int *b);
|
||||
static func g;
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 13838176792705659279,
|
||||
"detailed_name": "<fundamental>",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 10383876566159302459,
|
||||
"detailed_name": "func",
|
||||
"short_name": "func",
|
||||
"kind": 252,
|
||||
"hover": "typedef int (func)(const int *a, const int *b)",
|
||||
"declarations": [],
|
||||
"spell": "1:14-1:18|-1|1|2",
|
||||
"extent": "1:1-1:47|-1|1|0",
|
||||
"alias_of": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["1:14-1:18|-1|1|4", "2:8-2:12|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 8105378401105136463,
|
||||
"detailed_name": "func g",
|
||||
"short_name": "g",
|
||||
"kind": 12,
|
||||
"storage": 3,
|
||||
"declarations": [{
|
||||
"spell": "2:13-2:14|-1|1|1",
|
||||
"param_spellings": ["2:13-2:13", "2:13-2:13"]
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
83
index_tests/unions/union_decl.cc
Normal file
83
index_tests/unions/union_decl.cc
Normal file
@ -0,0 +1,83 @@
|
||||
union Foo {
|
||||
int a;
|
||||
bool b;
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 8501689086387244262,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0, 1],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 3,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 9529311430721959843,
|
||||
"detailed_name": "int Foo::a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:8|0|2|2",
|
||||
"extent": "2:3-2:8|0|2|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 8804696910588009104,
|
||||
"detailed_name": "bool Foo::b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "3:8-3:9|0|2|2",
|
||||
"extent": "3:3-3:9|0|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
120
index_tests/unions/union_usage.cc
Normal file
120
index_tests/unions/union_usage.cc
Normal file
@ -0,0 +1,120 @@
|
||||
union Foo {
|
||||
int a : 5;
|
||||
bool b : 3;
|
||||
};
|
||||
|
||||
Foo f;
|
||||
|
||||
void act(Foo*) {
|
||||
f.a = 3;
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO: instantiations on Foo should include parameter?
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 8501689086387244262,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "1:7-1:10|-1|1|2",
|
||||
"extent": "1:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0, 1],
|
||||
"instances": [2],
|
||||
"uses": ["6:1-6:4|-1|1|4", "8:10-8:13|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 3,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 13982179977217945200,
|
||||
"detailed_name": "void act(Foo *)",
|
||||
"short_name": "act",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "8:6-8:9|-1|1|2",
|
||||
"extent": "8:1-10:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 9529311430721959843,
|
||||
"detailed_name": "int Foo::a",
|
||||
"short_name": "a",
|
||||
"hover": "int Foo::a : 5",
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:8|0|2|2",
|
||||
"extent": "2:3-2:12|0|2|0",
|
||||
"type": 1,
|
||||
"uses": ["9:5-9:6|0|3|4"],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 8804696910588009104,
|
||||
"detailed_name": "bool Foo::b",
|
||||
"short_name": "b",
|
||||
"hover": "bool Foo::b : 3",
|
||||
"declarations": [],
|
||||
"spell": "3:8-3:9|0|2|2",
|
||||
"extent": "3:3-3:13|0|2|0",
|
||||
"type": 2,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 2933643612409209903,
|
||||
"detailed_name": "Foo f",
|
||||
"short_name": "f",
|
||||
"declarations": [],
|
||||
"spell": "6:5-6:6|-1|1|2",
|
||||
"extent": "6:1-6:6|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": ["9:3-9:4|0|3|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
70
index_tests/usage/func_called_from_constructor.cc
Normal file
70
index_tests/usage/func_called_from_constructor.cc
Normal file
@ -0,0 +1,70 @@
|
||||
void called() {}
|
||||
|
||||
struct Foo {
|
||||
Foo();
|
||||
};
|
||||
|
||||
Foo::Foo() {
|
||||
called();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": ["4:3-4:6|-1|1|4", "7:6-7:9|-1|1|4"],
|
||||
"spell": "3:8-3:11|-1|1|2",
|
||||
"extent": "3:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [1],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["4:3-4:6|0|2|4", "7:6-7:9|-1|1|4", "7:1-7:4|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 468307235068920063,
|
||||
"detailed_name": "void called()",
|
||||
"short_name": "called",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:12|-1|1|2",
|
||||
"extent": "1:1-1:17|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["8:3-8:9|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 3385168158331140247,
|
||||
"detailed_name": "void Foo::Foo()",
|
||||
"short_name": "Foo",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "4:3-4:6|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "7:6-7:9|0|2|2",
|
||||
"extent": "7:1-9:2|-1|1|0",
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["8:3-8:9|0|3|32"]
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
61
index_tests/usage/func_called_from_macro_argument.cc
Normal file
61
index_tests/usage/func_called_from_macro_argument.cc
Normal file
@ -0,0 +1,61 @@
|
||||
#define MACRO_CALL(e) e
|
||||
|
||||
bool called(bool a, bool b);
|
||||
|
||||
void caller() {
|
||||
MACRO_CALL(called(true, true));
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 3787803219955606747,
|
||||
"detailed_name": "bool called(bool a, bool b)",
|
||||
"short_name": "called",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "3:6-3:12|-1|1|1",
|
||||
"param_spellings": ["3:18-3:19", "3:26-3:27"]
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["6:14-6:20|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 11404881820527069090,
|
||||
"detailed_name": "void caller()",
|
||||
"short_name": "caller",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:6-5:12|-1|1|2",
|
||||
"extent": "5:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["6:14-6:20|0|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 1290746656694198202,
|
||||
"detailed_name": "MACRO_CALL",
|
||||
"short_name": "MACRO_CALL",
|
||||
"hover": "#define MACRO_CALL(e) e",
|
||||
"declarations": [],
|
||||
"spell": "1:9-1:19|-1|1|2",
|
||||
"extent": "1:9-1:24|-1|1|0",
|
||||
"uses": ["6:3-6:13|-1|1|4"],
|
||||
"kind": 255,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
69
index_tests/usage/func_called_from_template.cc
Normal file
69
index_tests/usage/func_called_from_template.cc
Normal file
@ -0,0 +1,69 @@
|
||||
void called();
|
||||
|
||||
template <typename T>
|
||||
void caller() {
|
||||
called();
|
||||
}
|
||||
|
||||
void foo() {
|
||||
caller<int>();
|
||||
}
|
||||
|
||||
/*
|
||||
// NOTE: without caller<int>() instantation caller() is never visited so
|
||||
// called() is never referenced.
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 468307235068920063,
|
||||
"detailed_name": "void called()",
|
||||
"short_name": "called",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "1:6-1:12|-1|1|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["5:3-5:9|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 10177235824697315808,
|
||||
"detailed_name": "void caller()",
|
||||
"short_name": "caller",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "4:6-4:12|-1|1|2",
|
||||
"extent": "4:1-6:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["9:3-9:9|2|3|32"],
|
||||
"callees": ["5:3-5:9|0|3|32"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "8:6-8:9|-1|1|2",
|
||||
"extent": "8:1-10:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["9:3-9:9|1|3|32"]
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
83
index_tests/usage/func_called_implicit_ctor.cc
Normal file
83
index_tests/usage/func_called_implicit_ctor.cc
Normal file
@ -0,0 +1,83 @@
|
||||
struct Wrapper {
|
||||
Wrapper(int i);
|
||||
};
|
||||
|
||||
int called() { return 1; }
|
||||
|
||||
Wrapper caller() {
|
||||
return called();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 13611487872560323389,
|
||||
"detailed_name": "Wrapper",
|
||||
"short_name": "Wrapper",
|
||||
"kind": 23,
|
||||
"declarations": ["2:3-2:10|-1|1|4"],
|
||||
"spell": "1:8-1:15|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["2:3-2:10|0|2|4", "7:1-7:8|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 10544127002917214589,
|
||||
"detailed_name": "void Wrapper::Wrapper(int i)",
|
||||
"short_name": "Wrapper",
|
||||
"kind": 9,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:3-2:10|0|2|1",
|
||||
"param_spellings": ["2:15-2:16"]
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["8:10-8:18|2|3|288"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 468307235068920063,
|
||||
"detailed_name": "int called()",
|
||||
"short_name": "called",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:5-5:11|-1|1|2",
|
||||
"extent": "5:1-5:27|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["8:10-8:16|2|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 11404881820527069090,
|
||||
"detailed_name": "Wrapper caller()",
|
||||
"short_name": "caller",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "7:9-7:15|-1|1|2",
|
||||
"extent": "7:1-9:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["8:10-8:18|0|3|288", "8:10-8:16|1|3|32"]
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
75
index_tests/usage/func_usage_addr_func.cc
Normal file
75
index_tests/usage/func_usage_addr_func.cc
Normal file
@ -0,0 +1,75 @@
|
||||
void consume(void (*)()) {}
|
||||
|
||||
void used() {}
|
||||
|
||||
void user() {
|
||||
void (*x)() = &used;
|
||||
consume(&used);
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 12924914488846929470,
|
||||
"detailed_name": "void consume(void (*)())",
|
||||
"short_name": "consume",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:13|-1|1|2",
|
||||
"extent": "1:1-1:28|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["7:3-7:10|2|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 5264867802674151787,
|
||||
"detailed_name": "void used()",
|
||||
"short_name": "used",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:6-3:10|-1|1|2",
|
||||
"extent": "3:1-3:15|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["6:18-6:22|2|3|32", "7:12-7:16|2|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 9376923949268137283,
|
||||
"detailed_name": "void user()",
|
||||
"short_name": "user",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:6-5:10|-1|1|2",
|
||||
"extent": "5:1-8:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0],
|
||||
"uses": [],
|
||||
"callees": ["6:18-6:22|1|3|32", "6:18-6:22|1|3|32", "7:3-7:10|0|3|32", "7:12-7:16|1|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 13681544683892648258,
|
||||
"detailed_name": "void (*)() x",
|
||||
"short_name": "x",
|
||||
"declarations": [],
|
||||
"spell": "6:10-6:11|2|3|2",
|
||||
"extent": "6:3-6:22|2|3|0",
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
78
index_tests/usage/func_usage_addr_method.cc
Normal file
78
index_tests/usage/func_usage_addr_method.cc
Normal file
@ -0,0 +1,78 @@
|
||||
struct Foo {
|
||||
void Used();
|
||||
};
|
||||
|
||||
void user() {
|
||||
auto x = &Foo::Used;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "1:8-1:11|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["6:13-6:16|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 18417145003926999463,
|
||||
"detailed_name": "void Foo::Used()",
|
||||
"short_name": "Used",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:8-2:12|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["6:18-6:22|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 9376923949268137283,
|
||||
"detailed_name": "void user()",
|
||||
"short_name": "user",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:6-5:10|-1|1|2",
|
||||
"extent": "5:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0],
|
||||
"uses": [],
|
||||
"callees": ["6:18-6:22|0|3|32", "6:18-6:22|0|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 8436636043513449412,
|
||||
"detailed_name": "void (Foo::*)() x",
|
||||
"short_name": "x",
|
||||
"declarations": [],
|
||||
"spell": "6:8-6:9|1|3|2",
|
||||
"extent": "6:3-6:22|1|3|0",
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
45
index_tests/usage/func_usage_call_func.cc
Normal file
45
index_tests/usage/func_usage_call_func.cc
Normal file
@ -0,0 +1,45 @@
|
||||
void called() {}
|
||||
void caller() {
|
||||
called();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 468307235068920063,
|
||||
"detailed_name": "void called()",
|
||||
"short_name": "called",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "1:6-1:12|-1|1|2",
|
||||
"extent": "1:1-1:17|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["3:3-3:9|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 11404881820527069090,
|
||||
"detailed_name": "void caller()",
|
||||
"short_name": "caller",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "2:6-2:12|-1|1|2",
|
||||
"extent": "2:1-4:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["3:3-3:9|0|3|32"]
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
80
index_tests/usage/func_usage_call_method.cc
Normal file
80
index_tests/usage/func_usage_call_method.cc
Normal file
@ -0,0 +1,80 @@
|
||||
struct Foo {
|
||||
void Used();
|
||||
};
|
||||
|
||||
void user() {
|
||||
Foo* f = nullptr;
|
||||
f->Used();
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "1:8-1:11|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["6:3-6:6|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 18417145003926999463,
|
||||
"detailed_name": "void Foo::Used()",
|
||||
"short_name": "Used",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:8-2:12|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["7:6-7:10|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 9376923949268137283,
|
||||
"detailed_name": "void user()",
|
||||
"short_name": "user",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:6-5:10|-1|1|2",
|
||||
"extent": "5:1-8:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0],
|
||||
"uses": [],
|
||||
"callees": ["7:6-7:10|0|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 3014406561587537195,
|
||||
"detailed_name": "Foo *f",
|
||||
"short_name": "f",
|
||||
"hover": "Foo *f = nullptr",
|
||||
"declarations": [],
|
||||
"spell": "6:8-6:9|1|3|2",
|
||||
"extent": "6:3-6:19|1|3|0",
|
||||
"type": 0,
|
||||
"uses": ["7:3-7:4|1|3|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
76
index_tests/usage/func_usage_class_inline_var_def.cc
Normal file
76
index_tests/usage/func_usage_class_inline_var_def.cc
Normal file
@ -0,0 +1,76 @@
|
||||
static int helper() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
class Foo {
|
||||
int x = helper();
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "5:7-5:10|-1|1|2",
|
||||
"extent": "5:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 17,
|
||||
"detailed_name": "",
|
||||
"short_name": "",
|
||||
"kind": 0,
|
||||
"declarations": [],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 9630503130605430498,
|
||||
"detailed_name": "int helper()",
|
||||
"short_name": "helper",
|
||||
"kind": 12,
|
||||
"storage": 3,
|
||||
"declarations": [],
|
||||
"spell": "1:12-1:18|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["6:11-6:17|0|2|32"],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 4220150017963593039,
|
||||
"detailed_name": "int Foo::x",
|
||||
"short_name": "x",
|
||||
"hover": "int Foo::x = helper()",
|
||||
"declarations": [],
|
||||
"spell": "6:7-6:8|0|2|2",
|
||||
"extent": "6:3-6:19|0|2|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
46
index_tests/usage/func_usage_forward_decl_func.cc
Normal file
46
index_tests/usage/func_usage_forward_decl_func.cc
Normal file
@ -0,0 +1,46 @@
|
||||
void foo();
|
||||
|
||||
void usage() {
|
||||
foo();
|
||||
}
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "1:6-1:9|-1|1|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["4:3-4:6|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 6767773193109753523,
|
||||
"detailed_name": "void usage()",
|
||||
"short_name": "usage",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "3:6-3:11|-1|1|2",
|
||||
"extent": "3:1-5:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["4:3-4:6|0|3|32"]
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
79
index_tests/usage/func_usage_forward_decl_method.cc
Normal file
79
index_tests/usage/func_usage_forward_decl_method.cc
Normal file
@ -0,0 +1,79 @@
|
||||
struct Foo {
|
||||
void foo();
|
||||
};
|
||||
|
||||
void usage() {
|
||||
Foo* f = nullptr;
|
||||
f->foo();
|
||||
}
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "1:8-1:11|-1|1|2",
|
||||
"extent": "1:1-3:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [0],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["6:3-6:6|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 17922201480358737771,
|
||||
"detailed_name": "void Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:8-2:11|0|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"declaring_type": 0,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["7:6-7:9|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 6767773193109753523,
|
||||
"detailed_name": "void usage()",
|
||||
"short_name": "usage",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "5:6-5:11|-1|1|2",
|
||||
"extent": "5:1-8:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0],
|
||||
"uses": [],
|
||||
"callees": ["7:6-7:9|0|3|32"]
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 12410753116854389823,
|
||||
"detailed_name": "Foo *f",
|
||||
"short_name": "f",
|
||||
"hover": "Foo *f = nullptr",
|
||||
"declarations": [],
|
||||
"spell": "6:8-6:9|1|3|2",
|
||||
"extent": "6:3-6:19|1|3|0",
|
||||
"type": 0,
|
||||
"uses": ["7:3-7:4|1|3|4"],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
65
index_tests/usage/func_usage_template_func.cc
Normal file
65
index_tests/usage/func_usage_template_func.cc
Normal file
@ -0,0 +1,65 @@
|
||||
template<typename T>
|
||||
void accept(T);
|
||||
|
||||
void foo() {
|
||||
accept(1);
|
||||
accept(true);
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 13420564603121289209,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 26,
|
||||
"declarations": [],
|
||||
"spell": "1:19-1:20|0|3|2",
|
||||
"extent": "1:10-1:20|0|3|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["2:13-2:14|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 10585861037135727329,
|
||||
"detailed_name": "void accept(T)",
|
||||
"short_name": "accept",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "2:6-2:12|-1|1|1",
|
||||
"param_spellings": ["2:14-2:14"]
|
||||
}],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": ["5:3-5:9|1|3|32", "6:3-6:9|1|3|32"],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 4259594751088586730,
|
||||
"detailed_name": "void foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "4:6-4:9|-1|1|2",
|
||||
"extent": "4:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": ["5:3-5:9|0|3|32", "6:3-6:9|0|3|32"]
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
105
index_tests/usage/type_usage_as_template_parameter.cc
Normal file
105
index_tests/usage/type_usage_as_template_parameter.cc
Normal file
@ -0,0 +1,105 @@
|
||||
template<typename T>
|
||||
class unique_ptr {};
|
||||
|
||||
struct S {};
|
||||
|
||||
static unique_ptr<bool> f0;
|
||||
static unique_ptr<S> f1;
|
||||
|
||||
unique_ptr<S>* return_type() {
|
||||
unique_ptr<S>* local;
|
||||
return nullptr;
|
||||
}
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 3286534761799572592,
|
||||
"detailed_name": "unique_ptr",
|
||||
"short_name": "unique_ptr",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:17|-1|1|2",
|
||||
"extent": "2:1-2:20|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1, 2],
|
||||
"uses": ["6:8-6:18|-1|1|4", "7:8-7:18|-1|1|4", "9:1-9:11|-1|1|4", "10:3-10:13|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 4750332761459066907,
|
||||
"detailed_name": "S",
|
||||
"short_name": "S",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "4:8-4:9|-1|1|2",
|
||||
"extent": "4:1-4:12|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["7:19-7:20|-1|1|4", "9:12-9:13|-1|1|4", "10:14-10:15|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 16359708726068806331,
|
||||
"detailed_name": "unique_ptr<S> *return_type()",
|
||||
"short_name": "return_type",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "9:16-9:27|-1|1|2",
|
||||
"extent": "9:1-12:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [2],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 12857919739649552168,
|
||||
"detailed_name": "unique_ptr<bool> f0",
|
||||
"short_name": "f0",
|
||||
"declarations": [],
|
||||
"spell": "6:25-6:27|-1|1|2",
|
||||
"extent": "6:1-6:27|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 3
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 18075066956054788088,
|
||||
"detailed_name": "unique_ptr<S> f1",
|
||||
"short_name": "f1",
|
||||
"declarations": [],
|
||||
"spell": "7:22-7:24|-1|1|2",
|
||||
"extent": "7:1-7:24|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 3
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 2462000803278878465,
|
||||
"detailed_name": "unique_ptr<S> *local",
|
||||
"short_name": "local",
|
||||
"declarations": [],
|
||||
"spell": "10:18-10:23|0|3|2",
|
||||
"extent": "10:3-10:23|0|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
234
index_tests/usage/type_usage_as_template_parameter_complex.cc
Normal file
234
index_tests/usage/type_usage_as_template_parameter_complex.cc
Normal file
@ -0,0 +1,234 @@
|
||||
template<typename T, typename B>
|
||||
class unique_ptr;
|
||||
|
||||
struct S1;
|
||||
struct S2;
|
||||
|
||||
#if false
|
||||
VarDecl f
|
||||
TemplateRef unique_ptr
|
||||
TemplateRef unique_ptr
|
||||
TypeRef struct S1
|
||||
TypeRef struct S2
|
||||
TypeRef struct S2
|
||||
#endif
|
||||
extern unique_ptr<unique_ptr<S1, S2>, S2> f;
|
||||
|
||||
#if false
|
||||
FunctionDecl as_return_type
|
||||
TemplateRef unique_ptr
|
||||
TemplateRef unique_ptr
|
||||
TypeRef struct S1
|
||||
TypeRef struct S2
|
||||
TypeRef struct S2
|
||||
ParmDecl
|
||||
TemplateRef unique_ptr
|
||||
TypeRef struct S1
|
||||
TypeRef struct S2
|
||||
CompoundStmt
|
||||
ReturnStmt
|
||||
UnexposedExpr
|
||||
CXXNullPtrLiteralExpr
|
||||
#endif
|
||||
unique_ptr<unique_ptr<S1, S2>, S2>* as_return_type(unique_ptr<S1, S2>*) { return nullptr; }
|
||||
|
||||
#if false
|
||||
FunctionDecl no_return_type
|
||||
ParmDecl
|
||||
CompoundStmt
|
||||
#endif
|
||||
void no_return_type(int) {}
|
||||
|
||||
#if false
|
||||
FunctionDecl empty
|
||||
CompoundStmt
|
||||
DeclStmt
|
||||
VarDecl local
|
||||
TemplateRef unique_ptr
|
||||
TemplateRef unique_ptr
|
||||
TypeRef struct S1
|
||||
TypeRef struct S2
|
||||
TypeRef struct S2
|
||||
#endif
|
||||
void empty() {
|
||||
unique_ptr<unique_ptr<S1, S2>, S2>* local;
|
||||
}
|
||||
|
||||
#if false
|
||||
ClassDecl Foo
|
||||
CXXMethod foo
|
||||
TemplateRef unique_ptr
|
||||
TypeRef struct S1
|
||||
TypeRef struct S2
|
||||
#endif
|
||||
class Foo {
|
||||
unique_ptr<S1, S2>* foo();
|
||||
};
|
||||
|
||||
#if false
|
||||
CXXMethod foo
|
||||
TemplateRef unique_ptr
|
||||
TypeRef struct S1
|
||||
TypeRef struct S2
|
||||
TypeRef class Foo
|
||||
CompoundStmt
|
||||
ReturnStmt
|
||||
UnexposedExpr
|
||||
CXXNullPtrLiteralExpr
|
||||
#endif
|
||||
unique_ptr<S1, S2>* Foo::foo() { return nullptr; }
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": ["7:1-14:7", "17:1-32:7", "35:1-39:7", "42:1-52:7", "57:1-63:7", "68:1-78:7"],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 14209198335088845323,
|
||||
"detailed_name": "unique_ptr",
|
||||
"short_name": "unique_ptr",
|
||||
"kind": 5,
|
||||
"declarations": ["2:7-2:17|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0, 1],
|
||||
"uses": ["15:8-15:18|-1|1|4", "15:19-15:29|-1|1|4", "33:1-33:11|-1|1|4", "33:12-33:22|-1|1|4", "33:52-33:62|-1|1|4", "54:3-54:13|-1|1|4", "54:14-54:24|-1|1|4", "65:3-65:13|-1|1|4", "79:1-79:11|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 4310164820010458371,
|
||||
"detailed_name": "S1",
|
||||
"short_name": "S1",
|
||||
"kind": 23,
|
||||
"declarations": ["4:8-4:10|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["15:30-15:32|-1|1|4", "33:23-33:25|-1|1|4", "33:63-33:65|-1|1|4", "54:25-54:27|-1|1|4", "65:14-65:16|-1|1|4", "79:12-79:14|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 12728490517004312484,
|
||||
"detailed_name": "S2",
|
||||
"short_name": "S2",
|
||||
"kind": 23,
|
||||
"declarations": ["5:8-5:10|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["15:34-15:36|-1|1|4", "15:39-15:41|-1|1|4", "33:27-33:29|-1|1|4", "33:32-33:34|-1|1|4", "33:67-33:69|-1|1|4", "54:29-54:31|-1|1|4", "54:34-54:36|-1|1|4", "65:18-65:20|-1|1|4", "79:16-79:18|-1|1|4"]
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "64:7-64:10|-1|1|2",
|
||||
"extent": "64:1-66:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [3],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["79:21-79:24|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 1246637699196435450,
|
||||
"detailed_name": "unique_ptr<unique_ptr<S1, S2>, S2> *as_return_type(unique_ptr<S1, S2> *)",
|
||||
"short_name": "as_return_type",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "33:37-33:51|-1|1|2",
|
||||
"extent": "33:1-33:92|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 13067214284561914253,
|
||||
"detailed_name": "void no_return_type(int)",
|
||||
"short_name": "no_return_type",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "40:6-40:20|-1|1|2",
|
||||
"extent": "40:1-40:28|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 18320186404467436976,
|
||||
"detailed_name": "void empty()",
|
||||
"short_name": "empty",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "53:6-53:11|-1|1|2",
|
||||
"extent": "53:1-55:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [1],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}, {
|
||||
"id": 3,
|
||||
"usr": 17922201480358737771,
|
||||
"detailed_name": "unique_ptr<S1, S2> *Foo::foo()",
|
||||
"short_name": "foo",
|
||||
"kind": 6,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "65:23-65:26|3|2|1",
|
||||
"param_spellings": []
|
||||
}],
|
||||
"spell": "79:26-79:29|3|2|2",
|
||||
"extent": "79:1-79:51|-1|1|0",
|
||||
"declaring_type": 3,
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 2933643612409209903,
|
||||
"detailed_name": "unique_ptr<unique_ptr<S1, S2>, S2> f",
|
||||
"short_name": "f",
|
||||
"declarations": ["15:43-15:44|-1|1|1"],
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 2
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 11547294959889394856,
|
||||
"detailed_name": "unique_ptr<unique_ptr<S1, S2>, S2> *local",
|
||||
"short_name": "local",
|
||||
"declarations": [],
|
||||
"spell": "54:39-54:44|2|3|2",
|
||||
"extent": "54:3-54:44|2|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
59
index_tests/usage/type_usage_as_template_parameter_simple.cc
Normal file
59
index_tests/usage/type_usage_as_template_parameter_simple.cc
Normal file
@ -0,0 +1,59 @@
|
||||
template<typename T>
|
||||
class unique_ptr {};
|
||||
|
||||
struct S;
|
||||
|
||||
static unique_ptr<S> foo;
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 3286534761799572592,
|
||||
"detailed_name": "unique_ptr",
|
||||
"short_name": "unique_ptr",
|
||||
"kind": 5,
|
||||
"declarations": [],
|
||||
"spell": "2:7-2:17|-1|1|2",
|
||||
"extent": "2:1-2:20|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["6:8-6:18|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 4750332761459066907,
|
||||
"detailed_name": "S",
|
||||
"short_name": "S",
|
||||
"kind": 23,
|
||||
"declarations": ["4:8-4:9|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["6:19-6:20|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 3398408600781120939,
|
||||
"detailed_name": "unique_ptr<S> foo",
|
||||
"short_name": "foo",
|
||||
"declarations": [],
|
||||
"spell": "6:22-6:25|-1|1|2",
|
||||
"extent": "6:1-6:25|-1|1|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 3
|
||||
}]
|
||||
}
|
||||
*/
|
39
index_tests/usage/type_usage_declare_extern.cc
Normal file
39
index_tests/usage/type_usage_declare_extern.cc
Normal file
@ -0,0 +1,39 @@
|
||||
struct T {};
|
||||
|
||||
extern T t;
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 5673439900521455039,
|
||||
"detailed_name": "T",
|
||||
"short_name": "T",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "1:8-1:9|-1|1|2",
|
||||
"extent": "1:1-1:12|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["3:8-3:9|-1|1|4"]
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 1346710425945444872,
|
||||
"detailed_name": "T t",
|
||||
"short_name": "t",
|
||||
"declarations": ["3:10-3:11|-1|1|1"],
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 2
|
||||
}]
|
||||
}
|
||||
*/
|
88
index_tests/usage/type_usage_declare_field.cc
Normal file
88
index_tests/usage/type_usage_declare_field.cc
Normal file
@ -0,0 +1,88 @@
|
||||
struct ForwardType;
|
||||
struct ImplementedType {};
|
||||
|
||||
struct Foo {
|
||||
ForwardType* a;
|
||||
ImplementedType b;
|
||||
};
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 13749354388332789217,
|
||||
"detailed_name": "ForwardType",
|
||||
"short_name": "ForwardType",
|
||||
"kind": 23,
|
||||
"declarations": ["1:8-1:19|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["5:3-5:14|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 8508299082070213750,
|
||||
"detailed_name": "ImplementedType",
|
||||
"short_name": "ImplementedType",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:23|-1|1|2",
|
||||
"extent": "2:1-2:26|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1],
|
||||
"uses": ["6:3-6:18|-1|1|4"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "4:8-4:11|-1|1|2",
|
||||
"extent": "4:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [0, 1],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"funcs": [],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 14314859014962085433,
|
||||
"detailed_name": "ForwardType *Foo::a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "5:16-5:17|2|2|2",
|
||||
"extent": "5:3-5:17|2|2|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 14727441168849658842,
|
||||
"detailed_name": "ImplementedType Foo::b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "6:19-6:20|2|2|2",
|
||||
"extent": "6:3-6:20|2|2|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 8,
|
||||
"storage": 0
|
||||
}]
|
||||
}
|
||||
*/
|
87
index_tests/usage/type_usage_declare_local.cc
Normal file
87
index_tests/usage/type_usage_declare_local.cc
Normal file
@ -0,0 +1,87 @@
|
||||
struct ForwardType;
|
||||
struct ImplementedType {};
|
||||
|
||||
void Foo() {
|
||||
ForwardType* a;
|
||||
ImplementedType b;
|
||||
}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 13749354388332789217,
|
||||
"detailed_name": "ForwardType",
|
||||
"short_name": "ForwardType",
|
||||
"kind": 23,
|
||||
"declarations": ["1:8-1:19|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["5:3-5:14|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 8508299082070213750,
|
||||
"detailed_name": "ImplementedType",
|
||||
"short_name": "ImplementedType",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:23|-1|1|2",
|
||||
"extent": "2:1-2:26|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1],
|
||||
"uses": ["6:3-6:18|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 4654328188330986029,
|
||||
"detailed_name": "void Foo()",
|
||||
"short_name": "Foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "4:6-4:9|-1|1|2",
|
||||
"extent": "4:1-7:2|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0, 1],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 11033478034711123650,
|
||||
"detailed_name": "ForwardType *a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "5:16-5:17|0|3|2",
|
||||
"extent": "5:3-5:17|0|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 8949902309768550158,
|
||||
"detailed_name": "ImplementedType b",
|
||||
"short_name": "b",
|
||||
"declarations": [],
|
||||
"spell": "6:19-6:20|0|3|2",
|
||||
"extent": "6:3-6:20|0|3|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 13,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
84
index_tests/usage/type_usage_declare_param.cc
Normal file
84
index_tests/usage/type_usage_declare_param.cc
Normal file
@ -0,0 +1,84 @@
|
||||
struct ForwardType;
|
||||
struct ImplementedType {};
|
||||
|
||||
void foo(ForwardType* f, ImplementedType a) {}
|
||||
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 13749354388332789217,
|
||||
"detailed_name": "ForwardType",
|
||||
"short_name": "ForwardType",
|
||||
"kind": 23,
|
||||
"declarations": ["1:8-1:19|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["4:10-4:21|-1|1|4"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 8508299082070213750,
|
||||
"detailed_name": "ImplementedType",
|
||||
"short_name": "ImplementedType",
|
||||
"kind": 23,
|
||||
"declarations": [],
|
||||
"spell": "2:8-2:23|-1|1|2",
|
||||
"extent": "2:1-2:26|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [1],
|
||||
"uses": ["4:26-4:41|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 1699390678058422036,
|
||||
"detailed_name": "void foo(ForwardType *f, ImplementedType a)",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "4:6-4:9|-1|1|2",
|
||||
"extent": "4:1-4:47|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0, 1],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 2584795197111552890,
|
||||
"detailed_name": "ForwardType *f",
|
||||
"short_name": "f",
|
||||
"declarations": [],
|
||||
"spell": "4:23-4:24|0|3|2",
|
||||
"extent": "4:10-4:24|0|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": 5136230284979460117,
|
||||
"detailed_name": "ImplementedType a",
|
||||
"short_name": "a",
|
||||
"declarations": [],
|
||||
"spell": "4:42-4:43|0|3|2",
|
||||
"extent": "4:26-4:43|0|3|0",
|
||||
"type": 1,
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
64
index_tests/usage/type_usage_declare_param_prototype.cc
Normal file
64
index_tests/usage/type_usage_declare_param_prototype.cc
Normal file
@ -0,0 +1,64 @@
|
||||
struct Foo;
|
||||
|
||||
void foo(Foo* f, Foo*);
|
||||
void foo(Foo* f, Foo*) {}
|
||||
|
||||
/*
|
||||
// TODO: No interesting usage on prototype. But maybe that's ok!
|
||||
// TODO: We should have the same variable declared for both prototype and
|
||||
// declaration. So it should have a usage marker on both. Then we could
|
||||
// rename parameters!
|
||||
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 15041163540773201510,
|
||||
"detailed_name": "Foo",
|
||||
"short_name": "Foo",
|
||||
"kind": 23,
|
||||
"declarations": ["1:8-1:11|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [0],
|
||||
"uses": ["3:10-3:13|-1|1|4", "3:18-3:21|-1|1|4", "4:10-4:13|-1|1|4", "4:18-4:21|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 8908726657907936744,
|
||||
"detailed_name": "void foo(Foo *f, Foo *)",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [{
|
||||
"spell": "3:6-3:9|-1|1|1",
|
||||
"param_spellings": ["3:15-3:16", "3:22-3:22"]
|
||||
}],
|
||||
"spell": "4:6-4:9|-1|1|2",
|
||||
"extent": "4:1-4:26|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [0],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": [{
|
||||
"id": 0,
|
||||
"usr": 2161866804398917919,
|
||||
"detailed_name": "Foo *f",
|
||||
"short_name": "f",
|
||||
"declarations": [],
|
||||
"spell": "4:15-4:16|0|3|2",
|
||||
"extent": "4:10-4:16|0|3|0",
|
||||
"type": 0,
|
||||
"uses": [],
|
||||
"kind": 253,
|
||||
"storage": 1
|
||||
}]
|
||||
}
|
||||
*/
|
41
index_tests/usage/type_usage_declare_param_unnamed.cc
Normal file
41
index_tests/usage/type_usage_declare_param_unnamed.cc
Normal file
@ -0,0 +1,41 @@
|
||||
struct ForwardType;
|
||||
void foo(ForwardType*) {}
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"includes": [],
|
||||
"skipped_by_preprocessor": [],
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": 13749354388332789217,
|
||||
"detailed_name": "ForwardType",
|
||||
"short_name": "ForwardType",
|
||||
"kind": 23,
|
||||
"declarations": ["1:8-1:19|-1|1|1"],
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"types": [],
|
||||
"funcs": [],
|
||||
"vars": [],
|
||||
"instances": [],
|
||||
"uses": ["2:10-2:21|-1|1|4"]
|
||||
}],
|
||||
"funcs": [{
|
||||
"id": 0,
|
||||
"usr": 15327735280790448926,
|
||||
"detailed_name": "void foo(ForwardType *)",
|
||||
"short_name": "foo",
|
||||
"kind": 12,
|
||||
"storage": 1,
|
||||
"declarations": [],
|
||||
"spell": "2:6-2:9|-1|1|2",
|
||||
"extent": "2:1-2:26|-1|1|0",
|
||||
"bases": [],
|
||||
"derived": [],
|
||||
"vars": [],
|
||||
"uses": [],
|
||||
"callees": []
|
||||
}],
|
||||
"vars": []
|
||||
}
|
||||
*/
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user