mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
indexer: add name for anonymous Enum
This commit is contained in:
parent
760f5e57ff
commit
06a04d5102
@ -947,11 +947,12 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
case Decl::Enum:
|
||||||
case Decl::Record:
|
case Decl::Record:
|
||||||
if (auto *rd = dyn_cast<RecordDecl>(d)) {
|
if (auto *tag_d = dyn_cast<TagDecl>(d)) {
|
||||||
if (type->def.detailed_name[0] == '\0' && info->short_name.empty()) {
|
if (type->def.detailed_name[0] == '\0' && info->short_name.empty()) {
|
||||||
StringRef tag;
|
StringRef tag;
|
||||||
switch (rd->getTagKind()) {
|
switch (tag_d->getTagKind()) {
|
||||||
case TTK_Struct:
|
case TTK_Struct:
|
||||||
tag = "struct";
|
tag = "struct";
|
||||||
break;
|
break;
|
||||||
@ -968,7 +969,7 @@ public:
|
|||||||
tag = "enum";
|
tag = "enum";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (TypedefNameDecl *td = rd->getTypedefNameForAnonDecl()) {
|
if (TypedefNameDecl *td = tag_d->getTypedefNameForAnonDecl()) {
|
||||||
StringRef name = td->getName();
|
StringRef name = td->getName();
|
||||||
std::string detailed = ("anon " + tag + " " + name).str();
|
std::string detailed = ("anon " + tag + " " + name).str();
|
||||||
type->def.detailed_name = intern(detailed);
|
type->def.detailed_name = intern(detailed);
|
||||||
@ -979,7 +980,7 @@ public:
|
|||||||
type->def.short_name_size = name.size();
|
type->def.short_name_size = name.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_def)
|
if (is_def && !isa<EnumDecl>(d))
|
||||||
if (auto *ord = dyn_cast<RecordDecl>(origD))
|
if (auto *ord = dyn_cast<RecordDecl>(origD))
|
||||||
collectRecordMembers(*type, ord);
|
collectRecordMembers(*type, ord);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user