mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-28 18:41:57 +00:00
Support BindingDecl and VarTemplate{,Partial}SpecializationDecl
This commit is contained in:
parent
8cce275206
commit
0f63be2418
@ -125,6 +125,8 @@ SymbolKind GetSymbolKind(const Decl* D) {
|
|||||||
case Decl::ParmVar:
|
case Decl::ParmVar:
|
||||||
case Decl::ImplicitParam:
|
case Decl::ImplicitParam:
|
||||||
case Decl::Decomposition:
|
case Decl::Decomposition:
|
||||||
|
case Decl::VarTemplateSpecialization:
|
||||||
|
case Decl::VarTemplatePartialSpecialization:
|
||||||
case Decl::EnumConstant:
|
case Decl::EnumConstant:
|
||||||
case Decl::UnresolvedUsingValue:
|
case Decl::UnresolvedUsingValue:
|
||||||
return SymbolKind::Var;
|
return SymbolKind::Var;
|
||||||
@ -454,6 +456,7 @@ public:
|
|||||||
std::string_view qualified, IndexVar::Def &def) {
|
std::string_view qualified, IndexVar::Def &def) {
|
||||||
QualType T;
|
QualType T;
|
||||||
const Expr* init = nullptr;
|
const Expr* init = nullptr;
|
||||||
|
bool binding = false;
|
||||||
if (auto *VD = dyn_cast<VarDecl>(D)) {
|
if (auto *VD = dyn_cast<VarDecl>(D)) {
|
||||||
T = VD->getType();
|
T = VD->getType();
|
||||||
init = VD->getAnyInitializer();
|
init = VD->getAnyInitializer();
|
||||||
@ -461,9 +464,12 @@ public:
|
|||||||
} else if (auto *FD = dyn_cast<FieldDecl>(D)) {
|
} else if (auto *FD = dyn_cast<FieldDecl>(D)) {
|
||||||
T = FD->getType();
|
T = FD->getType();
|
||||||
init = FD->getInClassInitializer();
|
init = FD->getInClassInitializer();
|
||||||
|
} else if (auto *BD = dyn_cast<BindingDecl>(D)) {
|
||||||
|
T = BD->getType();
|
||||||
|
binding = true;
|
||||||
}
|
}
|
||||||
auto BT = GetBaseType(T, false);
|
auto BT = GetBaseType(T, false);
|
||||||
if (!BT.isNull() && BT->getAs<AutoType>()) {
|
if (!BT.isNull() && (binding || BT->getAs<AutoType>())) {
|
||||||
SmallString<256> Str;
|
SmallString<256> Str;
|
||||||
llvm::raw_svector_ostream OS(Str);
|
llvm::raw_svector_ostream OS(Str);
|
||||||
PrintingPolicy PP = GetDefaultPolicy();
|
PrintingPolicy PP = GetDefaultPolicy();
|
||||||
@ -589,6 +595,8 @@ public:
|
|||||||
|
|
||||||
bool is_decl = Roles & uint32_t(index::SymbolRole::Declaration);
|
bool is_decl = Roles & uint32_t(index::SymbolRole::Declaration);
|
||||||
bool is_def = Roles & uint32_t(index::SymbolRole::Definition);
|
bool is_def = Roles & uint32_t(index::SymbolRole::Definition);
|
||||||
|
if (is_decl && D->getKind() == Decl::Binding)
|
||||||
|
is_def = true;
|
||||||
IndexFunc *func = nullptr;
|
IndexFunc *func = nullptr;
|
||||||
IndexType *type = nullptr;
|
IndexType *type = nullptr;
|
||||||
IndexVar *var = nullptr;
|
IndexVar *var = nullptr;
|
||||||
@ -614,7 +622,7 @@ public:
|
|||||||
switch (kind) {
|
switch (kind) {
|
||||||
case SymbolKind::Invalid:
|
case SymbolKind::Invalid:
|
||||||
LOG_S(INFO) << "Unhandled " << int(D->getKind()) << " " << info->qualified
|
LOG_S(INFO) << "Unhandled " << int(D->getKind()) << " " << info->qualified
|
||||||
<< " in " << db->path << ":" << loc.start.line;
|
<< " in " << db->path << ":" << loc.start.line + 1;
|
||||||
return true;
|
return true;
|
||||||
case SymbolKind::File:
|
case SymbolKind::File:
|
||||||
return true;
|
return true;
|
||||||
@ -883,6 +891,10 @@ public:
|
|||||||
// ccls extension
|
// ccls extension
|
||||||
var->def.kind = lsSymbolKind::Parameter;
|
var->def.kind = lsSymbolKind::Parameter;
|
||||||
break;
|
break;
|
||||||
|
case Decl::VarTemplateSpecialization:
|
||||||
|
case Decl::VarTemplatePartialSpecialization:
|
||||||
|
var->def.kind = lsSymbolKind::Variable;
|
||||||
|
break;
|
||||||
case Decl::EnumConstant:
|
case Decl::EnumConstant:
|
||||||
var->def.kind = lsSymbolKind::EnumMember;
|
var->def.kind = lsSymbolKind::EnumMember;
|
||||||
// TODO Pretty printer may print =
|
// TODO Pretty printer may print =
|
||||||
|
Loading…
Reference in New Issue
Block a user