mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-23 08:05:07 +00:00
Fix EnumConstantDecl's kind & EnumDecl's vars
This commit is contained in:
parent
c8e57ee7b3
commit
c598f3ebbd
@ -36,7 +36,13 @@ OUTPUT:
|
||||
"bases": [],
|
||||
"funcs": [],
|
||||
"types": [],
|
||||
"vars": [],
|
||||
"vars": [{
|
||||
"L": 439339022761937396,
|
||||
"R": -1
|
||||
}, {
|
||||
"L": 15962370213938840720,
|
||||
"R": -1
|
||||
}],
|
||||
"alias_of": 0,
|
||||
"kind": 10,
|
||||
"parent_kind": 0,
|
||||
@ -52,7 +58,7 @@ OUTPUT:
|
||||
"short_name": "A",
|
||||
"hover": "Foo::A = 0",
|
||||
"spell": "3:3-3:4|3:3-3:4|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"storage": 0,
|
||||
@ -64,7 +70,7 @@ OUTPUT:
|
||||
"qual_name_offset": 0,
|
||||
"short_name": "B",
|
||||
"spell": "4:3-4:4|4:3-4:9|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"storage": 0,
|
||||
|
@ -34,9 +34,9 @@ OUTPUT:
|
||||
"short_name": "A",
|
||||
"hover": "A = 0",
|
||||
"spell": "2:3-2:4|2:3-2:4|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
@ -46,9 +46,9 @@ OUTPUT:
|
||||
"qual_name_offset": 0,
|
||||
"short_name": "B",
|
||||
"spell": "3:3-3:4|3:3-3:9|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
|
@ -25,7 +25,13 @@ OUTPUT:
|
||||
"bases": [],
|
||||
"funcs": [],
|
||||
"types": [],
|
||||
"vars": [],
|
||||
"vars": [{
|
||||
"L": 16614320383091394267,
|
||||
"R": -1
|
||||
}, {
|
||||
"L": 16847439761518576294,
|
||||
"R": -1
|
||||
}],
|
||||
"alias_of": 0,
|
||||
"kind": 10,
|
||||
"parent_kind": 0,
|
||||
@ -75,9 +81,9 @@ OUTPUT:
|
||||
"short_name": "A",
|
||||
"hover": "A = 0",
|
||||
"spell": "2:3-2:4|2:3-2:4|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
@ -87,9 +93,9 @@ OUTPUT:
|
||||
"qual_name_offset": 0,
|
||||
"short_name": "B",
|
||||
"spell": "3:3-3:4|3:3-3:9|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
@ -100,7 +106,7 @@ OUTPUT:
|
||||
"short_name": "E0",
|
||||
"hover": "E::E0 = 0",
|
||||
"spell": "9:3-9:5|9:3-9:5|1026|-1",
|
||||
"type": 0,
|
||||
"type": 2986879766914123941,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"storage": 0,
|
||||
@ -112,7 +118,7 @@ OUTPUT:
|
||||
"qual_name_offset": 0,
|
||||
"short_name": "E20",
|
||||
"spell": "10:3-10:6|10:3-10:11|1026|-1",
|
||||
"type": 0,
|
||||
"type": 2986879766914123941,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"storage": 0,
|
||||
|
@ -20,7 +20,13 @@ OUTPUT:
|
||||
"bases": [],
|
||||
"funcs": [],
|
||||
"types": [],
|
||||
"vars": [],
|
||||
"vars": [{
|
||||
"L": 439339022761937396,
|
||||
"R": -1
|
||||
}, {
|
||||
"L": 15962370213938840720,
|
||||
"R": -1
|
||||
}],
|
||||
"alias_of": 0,
|
||||
"kind": 10,
|
||||
"parent_kind": 0,
|
||||
@ -36,7 +42,7 @@ OUTPUT:
|
||||
"short_name": "A",
|
||||
"hover": "Foo::A = 0",
|
||||
"spell": "2:3-2:4|2:3-2:4|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"storage": 0,
|
||||
@ -61,7 +67,7 @@ OUTPUT:
|
||||
"qual_name_offset": 0,
|
||||
"short_name": "B",
|
||||
"spell": "3:3-3:4|3:3-3:9|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"storage": 0,
|
||||
|
@ -21,14 +21,14 @@ OUTPUT:
|
||||
"detailed_name": "int a()",
|
||||
"qual_name_offset": 4,
|
||||
"short_name": "a",
|
||||
"spell": "12:1-12:20|12:1-12:20|2|-1",
|
||||
"spell": "12:1-12:20|12:1-12:4|2|-1",
|
||||
"bases": [],
|
||||
"vars": [],
|
||||
"callees": ["12:5-12:10|14400399977994209582|3|16420"],
|
||||
"kind": 12,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": ["12:1-12:20|12:1-12:20|1|-1"],
|
||||
"declarations": ["12:1-12:20|12:1-12:4|1|-1"],
|
||||
"derived": [],
|
||||
"uses": ["2:7-2:8|64|0", "3:7-3:8|64|0"]
|
||||
}, {
|
||||
|
@ -17,7 +17,7 @@ OUTPUT:
|
||||
"detailed_name": "Foo::Foo(Foo &&) = delete",
|
||||
"qual_name_offset": 0,
|
||||
"short_name": "Foo",
|
||||
"spell": "5:12-5:15|5:12-5:15|1026|-1",
|
||||
"spell": "5:12-5:15|5:3-5:11|1026|-1",
|
||||
"bases": [],
|
||||
"vars": [],
|
||||
"callees": [],
|
||||
@ -94,7 +94,7 @@ OUTPUT:
|
||||
"qual_name_offset": 4,
|
||||
"short_name": "x",
|
||||
"hover": "int x = A",
|
||||
"spell": "8:5-8:6|8:1-1:1|2|-1",
|
||||
"spell": "8:5-8:6|8:1-8:10|2|-1",
|
||||
"type": 53,
|
||||
"kind": 13,
|
||||
"parent_kind": 0,
|
||||
|
@ -20,9 +20,9 @@ OUTPUT: funky_enum.h
|
||||
"hover": "A = 0",
|
||||
"comments": "This file cannot be built directory. It is included in an enum definition of\nanother file.",
|
||||
"spell": "4:1-4:2|4:1-4:2|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
@ -34,9 +34,9 @@ OUTPUT: funky_enum.h
|
||||
"hover": "C = 2",
|
||||
"comments": "This file cannot be built directory. It is included in an enum definition of\nanother file.",
|
||||
"spell": "6:1-6:2|6:1-6:2|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
@ -48,9 +48,9 @@ OUTPUT: funky_enum.h
|
||||
"hover": "B = 1",
|
||||
"comments": "This file cannot be built directory. It is included in an enum definition of\nanother file.",
|
||||
"spell": "5:1-5:2|5:1-5:2|1026|-1",
|
||||
"type": 0,
|
||||
"type": 16985894625255407295,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
|
@ -146,9 +146,9 @@ OUTPUT: header.h
|
||||
"short_name": "A",
|
||||
"hover": "A = 0",
|
||||
"spell": "15:13-15:14|15:13-15:14|1026|-1",
|
||||
"type": 0,
|
||||
"type": 4481210672785600703,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
@ -159,9 +159,9 @@ OUTPUT: header.h
|
||||
"short_name": "C",
|
||||
"hover": "C = 2",
|
||||
"spell": "15:19-15:20|15:19-15:20|1026|-1",
|
||||
"type": 0,
|
||||
"type": 4481210672785600703,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
@ -184,9 +184,9 @@ OUTPUT: header.h
|
||||
"short_name": "B",
|
||||
"hover": "B = 1",
|
||||
"spell": "15:16-15:17|15:16-15:17|1026|-1",
|
||||
"type": 0,
|
||||
"type": 4481210672785600703,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
|
@ -22,23 +22,7 @@ OUTPUT:
|
||||
"derived": [],
|
||||
"uses": []
|
||||
}],
|
||||
"usr2type": [{
|
||||
"usr": 7144845543074395457,
|
||||
"detailed_name": "",
|
||||
"qual_name_offset": 0,
|
||||
"short_name": "",
|
||||
"bases": [],
|
||||
"funcs": [5010253035933134245],
|
||||
"types": [],
|
||||
"vars": [],
|
||||
"alias_of": 0,
|
||||
"kind": 0,
|
||||
"parent_kind": 0,
|
||||
"declarations": [],
|
||||
"derived": [],
|
||||
"instances": [],
|
||||
"uses": []
|
||||
}],
|
||||
"usr2type": [],
|
||||
"usr2var": []
|
||||
}
|
||||
*/
|
||||
|
@ -349,9 +349,9 @@ OUTPUT:
|
||||
"short_name": "Enum1",
|
||||
"hover": "Enum1 = 1",
|
||||
"spell": "36:10-36:15|36:10-36:15|1026|-1",
|
||||
"type": 0,
|
||||
"type": 9201299975592934124,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": []
|
||||
@ -387,9 +387,9 @@ OUTPUT:
|
||||
"short_name": "Enum0",
|
||||
"hover": "Enum0 = 0",
|
||||
"spell": "36:3-36:8|36:3-36:8|1026|-1",
|
||||
"type": 0,
|
||||
"type": 9201299975592934124,
|
||||
"kind": 22,
|
||||
"parent_kind": 10,
|
||||
"parent_kind": 0,
|
||||
"storage": 0,
|
||||
"declarations": [],
|
||||
"uses": ["43:20-43:25|4|-1"]
|
||||
|
@ -67,7 +67,7 @@ OUTPUT:
|
||||
"hover": "static constexpr int Foo::var = 3",
|
||||
"type": 53,
|
||||
"kind": 13,
|
||||
"parent_kind": 0,
|
||||
"parent_kind": 23,
|
||||
"storage": 2,
|
||||
"declarations": ["3:24-3:27|3:3-3:31|1025|-1"],
|
||||
"uses": ["6:19-6:22|12|-1", "7:20-7:23|12|-1"]
|
||||
|
@ -46,10 +46,10 @@ OUTPUT:
|
||||
"usr2type": [],
|
||||
"usr2var": [{
|
||||
"usr": 9121974011454213596,
|
||||
"detailed_name": "auto x",
|
||||
"qual_name_offset": 5,
|
||||
"detailed_name": "void (*)() x",
|
||||
"qual_name_offset": 11,
|
||||
"short_name": "x",
|
||||
"hover": "auto x = &called",
|
||||
"hover": "void (*)() x = &called",
|
||||
"spell": "4:8-4:9|4:3-4:19|2|-1",
|
||||
"type": 0,
|
||||
"kind": 13,
|
||||
|
@ -84,7 +84,7 @@ OUTPUT:
|
||||
"short_name": "x",
|
||||
"type": 53,
|
||||
"kind": 13,
|
||||
"parent_kind": 0,
|
||||
"parent_kind": 23,
|
||||
"storage": 2,
|
||||
"declarations": ["2:14-2:15|2:3-2:15|1025|-1"],
|
||||
"uses": ["8:15-8:16|12|-1"]
|
||||
|
@ -48,7 +48,7 @@ OUTPUT:
|
||||
"short_name": "member",
|
||||
"type": 53,
|
||||
"kind": 13,
|
||||
"parent_kind": 0,
|
||||
"parent_kind": 5,
|
||||
"storage": 2,
|
||||
"declarations": ["2:14-2:20|2:3-2:20|1025|-1"],
|
||||
"uses": []
|
||||
|
@ -45,10 +45,10 @@ OUTPUT:
|
||||
}],
|
||||
"usr2var": [{
|
||||
"usr": 10601729374837386290,
|
||||
"detailed_name": "auto x",
|
||||
"detailed_name": "Foo *x",
|
||||
"qual_name_offset": 5,
|
||||
"short_name": "x",
|
||||
"hover": "auto x = new Foo()",
|
||||
"hover": "Foo *x = new Foo()",
|
||||
"spell": "3:8-3:9|3:3-3:21|2|-1",
|
||||
"type": 15041163540773201510,
|
||||
"kind": 13,
|
||||
|
@ -840,20 +840,20 @@ public:
|
||||
if (var->def.detailed_name[0] == '\0')
|
||||
SetVarName(D, info->short_name, info->qualified, var->def);
|
||||
QualType T;
|
||||
if (auto *VD = dyn_cast<VarDecl>(D))
|
||||
if (auto *VD = dyn_cast<ValueDecl>(D))
|
||||
T = VD->getType();
|
||||
else if (auto *FD = dyn_cast<FieldDecl>(D))
|
||||
T = FD->getType();
|
||||
if (is_def || is_decl) {
|
||||
const Decl *DC = cast<Decl>(SemDC);
|
||||
if (GetSymbolKind(DC, ls_kind) == SymbolKind::Func)
|
||||
SymbolKind kind = GetSymbolKind(DC, var->def.parent_kind);
|
||||
if (kind == SymbolKind::Func)
|
||||
db->ToFunc(GetUsr(DC)).def.vars.push_back(usr);
|
||||
else if (auto *ND = dyn_cast<NamespaceDecl>(SemDC))
|
||||
db->ToType(GetUsr(ND)).def.vars.emplace_back(usr, -1);
|
||||
else if (kind == SymbolKind::Type && !isa<RecordDecl>(SemDC))
|
||||
db->ToType(GetUsr(DC)).def.vars.emplace_back(usr, -1);
|
||||
if (!T.isNull()) {
|
||||
if (auto *BT = T->getAs<BuiltinType>()) {
|
||||
Usr usr1 = static_cast<Usr>(BT->getKind());
|
||||
var->def.type = usr1;
|
||||
if (!isa<EnumConstantDecl>(D))
|
||||
db->ToType(usr1).instances.push_back(usr);
|
||||
} else if (const Decl *D1 = GetAdjustedDecl(GetTypeDecl(T))) {
|
||||
if (isa<TemplateTypeParmDecl>(D1)) {
|
||||
@ -882,6 +882,7 @@ public:
|
||||
IndexParam::DeclInfo *info1;
|
||||
Usr usr1 = GetUsr(D1, &info1);
|
||||
var->def.type = usr1;
|
||||
if (!isa<EnumConstantDecl>(D))
|
||||
db->ToType(usr1).instances.push_back(usr);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user