mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 09:05:10 +00:00
dtors
This commit is contained in:
parent
d01eb6b86f
commit
d26cb81854
4
main.cpp
4
main.cpp
@ -1252,6 +1252,7 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
||||
|
||||
case CXIdxEntity_Function:
|
||||
case CXIdxEntity_CXXConstructor:
|
||||
case CXIdxEntity_CXXDestructor:
|
||||
case CXIdxEntity_CXXInstanceMethod:
|
||||
case CXIdxEntity_CXXStaticMethod:
|
||||
{
|
||||
@ -1424,6 +1425,7 @@ void indexEntityReference(CXClientData client_data, const CXIdxEntityRefInfo* re
|
||||
case CXIdxEntity_CXXStaticMethod:
|
||||
case CXIdxEntity_CXXInstanceMethod:
|
||||
case CXIdxEntity_Function:
|
||||
case CXIdxEntity_CXXConstructor:
|
||||
{
|
||||
// TODO: Redirect container to constructor for
|
||||
// int Gen() { return 5; }
|
||||
@ -1704,7 +1706,7 @@ int main(int argc, char** argv) {
|
||||
for (std::string path : GetFilesInFolder("tests")) {
|
||||
// TODO: Fix all existing tests.
|
||||
//if (path == "tests/usage/type_usage_declare_extern.cc") continue;
|
||||
if (path == "tests/constructors/constructor.cc") continue;
|
||||
//if (path != "tests/constructors/destructor.cc") continue;
|
||||
//if (path != "tests/usage/usage_inside_of_call.cc") continue;
|
||||
//if (path != "tests/usage/type_usage_typedef_and_using.cc") continue;
|
||||
//if (path != "tests/usage/type_usage_declare_local.cc") continue;
|
||||
|
@ -17,7 +17,7 @@ OUTPUT:
|
||||
"qualified_name": "Foo",
|
||||
"definition": "tests/constructors/constructor.cc:1:7",
|
||||
"funcs": [0],
|
||||
"all_uses": ["tests/constructors/constructor.cc:7:3"]
|
||||
"all_uses": ["tests/constructors/constructor.cc:1:7", "tests/constructors/constructor.cc:7:3"],
|
||||
"interesting_uses": ["tests/constructors/constructor.cc:7:3"]
|
||||
}],
|
||||
"functions": [{
|
||||
@ -28,14 +28,15 @@ OUTPUT:
|
||||
"definition": "tests/constructors/constructor.cc:3:3",
|
||||
"declaring_type": 0,
|
||||
"callers": ["1@tests/constructors/constructor.cc:7:7"],
|
||||
"uses": ["tests/constructors/constructor.cc:7:7"]
|
||||
"all_uses": ["tests/constructors/constructor.cc:3:3", "tests/constructors/constructor.cc:7:7"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": "c:@F@foo#",
|
||||
"short_name": "foo",
|
||||
"qualified_name": "foo",
|
||||
"definition": "tests/constructors/constructor.cc:6:6",
|
||||
"callees": ["0@tests/constructors/constructor.cc:7:7"]
|
||||
"callees": ["0@tests/constructors/constructor.cc:7:7"],
|
||||
"all_uses": ["tests/constructors/constructor.cc:6:6"]
|
||||
}],
|
||||
"variables": [{
|
||||
"id": 0,
|
||||
@ -43,8 +44,8 @@ OUTPUT:
|
||||
"short_name": "f",
|
||||
"qualified_name": "f",
|
||||
"declaration": "tests/constructors/constructor.cc:7:7",
|
||||
"initializations": ["tests/constructors/constructor.cc:7:7"],
|
||||
"variable_type": 0
|
||||
"variable_type": 0,
|
||||
"all_uses": ["tests/constructors/constructor.cc:7:7"]
|
||||
}]
|
||||
}
|
||||
*/
|
@ -1,4 +1,14 @@
|
||||
// TODO: Support destructors.
|
||||
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
|
||||
@ -6,8 +16,50 @@
|
||||
/*
|
||||
OUTPUT:
|
||||
{
|
||||
"types": [],
|
||||
"functions": [],
|
||||
"variables": []
|
||||
"types": [{
|
||||
"id": 0,
|
||||
"usr": "c:@S@Foo",
|
||||
"short_name": "Foo",
|
||||
"qualified_name": "Foo",
|
||||
"definition": "tests/constructors/destructor.cc:1:7",
|
||||
"funcs": [0, 1],
|
||||
"all_uses": ["tests/constructors/destructor.cc:1:7", "tests/constructors/destructor.cc:8:3"],
|
||||
"interesting_uses": ["tests/constructors/destructor.cc:8:3"]
|
||||
}],
|
||||
"functions": [{
|
||||
"id": 0,
|
||||
"usr": "c:@S@Foo@F@Foo#",
|
||||
"short_name": "Foo",
|
||||
"qualified_name": "Foo::Foo",
|
||||
"definition": "tests/constructors/destructor.cc:3:3",
|
||||
"declaring_type": 0,
|
||||
"callers": ["2@tests/constructors/destructor.cc:8:7"],
|
||||
"all_uses": ["tests/constructors/destructor.cc:3:3", "tests/constructors/destructor.cc:8:7"]
|
||||
}, {
|
||||
"id": 1,
|
||||
"usr": "c:@S@Foo@F@~Foo#",
|
||||
"short_name": "~Foo",
|
||||
"qualified_name": "Foo::~Foo",
|
||||
"definition": "tests/constructors/destructor.cc:4:3",
|
||||
"declaring_type": 0,
|
||||
"all_uses": ["tests/constructors/destructor.cc:4:3"]
|
||||
}, {
|
||||
"id": 2,
|
||||
"usr": "c:@F@foo#",
|
||||
"short_name": "foo",
|
||||
"qualified_name": "foo",
|
||||
"definition": "tests/constructors/destructor.cc:7:6",
|
||||
"callees": ["0@tests/constructors/destructor.cc:8:7"],
|
||||
"all_uses": ["tests/constructors/destructor.cc:7:6"]
|
||||
}],
|
||||
"variables": [{
|
||||
"id": 0,
|
||||
"usr": "c:destructor.cc@70@F@foo#@f",
|
||||
"short_name": "f",
|
||||
"qualified_name": "f",
|
||||
"declaration": "tests/constructors/destructor.cc:8:7",
|
||||
"variable_type": 0,
|
||||
"all_uses": ["tests/constructors/destructor.cc:8:7"]
|
||||
}]
|
||||
}
|
||||
*/
|
Loading…
Reference in New Issue
Block a user