mirror of
https://github.com/MaskRay/ccls.git
synced 2025-04-16 13:52:17 +00:00
do not index namespace ref
This commit is contained in:
parent
f7e2b20059
commit
49c6f7787a
@ -549,7 +549,7 @@ optional<TypeId> AddDeclUsages(IndexedFile* db, clang::Cursor decl_cursor,
|
|||||||
is_interesting == false ||
|
is_interesting == false ||
|
||||||
param.previous_cursor.has_value() == false ||
|
param.previous_cursor.has_value() == false ||
|
||||||
(param.previous_cursor.value().get_kind() == CXCursor_TypeRef ||
|
(param.previous_cursor.value().get_kind() == CXCursor_TypeRef ||
|
||||||
param.previous_cursor.value().get_kind() == CXCursor_TemplateRef));
|
param.previous_cursor.value().get_kind() == CXCursor_TemplateRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
return param.initial_type;
|
return param.initial_type;
|
||||||
@ -866,6 +866,12 @@ void indexEntityReference(CXClientData client_data, const CXIdxEntityRefInfo* re
|
|||||||
clang::Cursor cursor(ref->cursor);
|
clang::Cursor cursor(ref->cursor);
|
||||||
|
|
||||||
switch (ref->referencedEntity->kind) {
|
switch (ref->referencedEntity->kind) {
|
||||||
|
case CXIdxEntity_CXXNamespace:
|
||||||
|
{
|
||||||
|
// We don't index namespace usages.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CXIdxEntity_EnumConstant:
|
case CXIdxEntity_EnumConstant:
|
||||||
case CXIdxEntity_CXXStaticVariable:
|
case CXIdxEntity_CXXStaticVariable:
|
||||||
case CXIdxEntity_Variable:
|
case CXIdxEntity_Variable:
|
||||||
|
2
test.cc
2
test.cc
@ -97,7 +97,7 @@ int main(int argc, char** argv) {
|
|||||||
//if (path != "tests/templates/specialized_func_definition.cc") continue;
|
//if (path != "tests/templates/specialized_func_definition.cc") continue;
|
||||||
//if (path != "tests/constructors/invalid_reference.cc") continue;
|
//if (path != "tests/constructors/invalid_reference.cc") continue;
|
||||||
//if (path == "tests/inheritance/class_inherit_templated_parent.cc") continue;
|
//if (path == "tests/inheritance/class_inherit_templated_parent.cc") continue;
|
||||||
//if (path != "tests/foobar.cc") continue;
|
//if (path != "tests/namespaces/namespace_reference.cc") continue;
|
||||||
if (path == "tests/stl.cc") continue;
|
if (path == "tests/stl.cc") continue;
|
||||||
|
|
||||||
//if (path != "tests/templates/template_class_type_usage_folded_into_one.cc") continue;
|
//if (path != "tests/templates/template_class_type_usage_folded_into_one.cc") continue;
|
||||||
|
102
tests/foobar.cc
102
tests/foobar.cc
@ -61,105 +61,3 @@ OUTPUT:
|
|||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if false
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
OUTPUT:
|
|
||||||
{
|
|
||||||
"types": [{
|
|
||||||
"id": 0,
|
|
||||||
"usr": "c:@N@ns@E@VarType",
|
|
||||||
"short_name": "VarType",
|
|
||||||
"qualified_name": "ns::VarType",
|
|
||||||
"definition": "1:2:8",
|
|
||||||
"uses": ["*1:2:8", "*1:6:22", "1:6:44", "*1:10:18"]
|
|
||||||
}, {
|
|
||||||
"id": 1,
|
|
||||||
"usr": "c:@N@ns@ST>1#T@Holder",
|
|
||||||
"short_name": "Holder",
|
|
||||||
"qualified_name": "ns::Holder",
|
|
||||||
"definition": "1:5:10",
|
|
||||||
"vars": [0],
|
|
||||||
"uses": ["*1:5:10", "*1:10:26", "1:13:13", "1:14:14"]
|
|
||||||
}],
|
|
||||||
"functions": [],
|
|
||||||
"variables": [{
|
|
||||||
"id": 0,
|
|
||||||
"usr": "c:@N@ns@ST>1#T@Holder@static_var",
|
|
||||||
"short_name": "static_var",
|
|
||||||
"qualified_name": "ns::Holder::static_var",
|
|
||||||
"declaration": "1:6:30",
|
|
||||||
"definition": "1:10:37",
|
|
||||||
"variable_type": 0,
|
|
||||||
"declaring_type": 1,
|
|
||||||
"uses": ["1:6:30", "1:10:37"]
|
|
||||||
}, {
|
|
||||||
"id": 1,
|
|
||||||
"usr": "c:@N@ns@Foo",
|
|
||||||
"short_name": "Foo",
|
|
||||||
"qualified_name": "ns::Foo",
|
|
||||||
"definition": "1:13:7",
|
|
||||||
"uses": ["1:13:7"]
|
|
||||||
}, {
|
|
||||||
"id": 2,
|
|
||||||
"usr": "c:@N@ns@S@Holder>#I@static_var",
|
|
||||||
"short_name": "static_var",
|
|
||||||
"qualified_name": "static_var",
|
|
||||||
"definition": "1:10:37",
|
|
||||||
"variable_type": 0,
|
|
||||||
"declaring_type": 2,
|
|
||||||
"uses": ["1:13:26", "1:10:37", "1:14:27"]
|
|
||||||
}, {
|
|
||||||
"id": 3,
|
|
||||||
"usr": "c:@N@ns@Foo2",
|
|
||||||
"short_name": "Foo2",
|
|
||||||
"qualified_name": "ns::Foo2",
|
|
||||||
"definition": "1:14:7",
|
|
||||||
"uses": ["1:14:7"]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
52
tests/namespaces/namespace_reference.cc
Normal file
52
tests/namespaces/namespace_reference.cc
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
namespace ns {
|
||||||
|
int Foo;
|
||||||
|
void Accept(int a) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Runner() {
|
||||||
|
ns::Accept(ns::Foo);
|
||||||
|
using namespace ns;
|
||||||
|
Accept(Foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
OUTPUT:
|
||||||
|
{
|
||||||
|
"types": [],
|
||||||
|
"functions": [{
|
||||||
|
"id": 0,
|
||||||
|
"usr": "c:@N@ns@F@Accept#I#",
|
||||||
|
"short_name": "Accept",
|
||||||
|
"qualified_name": "ns::Accept",
|
||||||
|
"definition": "1:3:8",
|
||||||
|
"callers": ["1@1:7:7", "1@1:9:3"],
|
||||||
|
"uses": ["1:3:8", "1:7:7", "1:9:3"]
|
||||||
|
}, {
|
||||||
|
"id": 1,
|
||||||
|
"usr": "c:@F@Runner#",
|
||||||
|
"short_name": "Runner",
|
||||||
|
"qualified_name": "Runner",
|
||||||
|
"definition": "1:6:6",
|
||||||
|
"callees": ["0@1:7:7", "0@1:9:3"],
|
||||||
|
"uses": ["1:6:6"]
|
||||||
|
}],
|
||||||
|
"variables": [{
|
||||||
|
"id": 0,
|
||||||
|
"usr": "c:@N@ns@Foo",
|
||||||
|
"short_name": "Foo",
|
||||||
|
"qualified_name": "ns::Foo",
|
||||||
|
"definition": "1:2:7",
|
||||||
|
"uses": ["1:2:7", "1:7:18", "1:9:10"]
|
||||||
|
}, {
|
||||||
|
"id": 1,
|
||||||
|
"usr": "c:namespace_reference.cc@42@N@ns@F@Accept#I#@a",
|
||||||
|
"short_name": "a",
|
||||||
|
"qualified_name": "a",
|
||||||
|
"definition": "1:3:19",
|
||||||
|
"uses": ["1:3:19"]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user