From 06a04d5102bb5551d37eb1e5a789f744f013491c Mon Sep 17 00:00:00 2001 From: xVan Turing Date: Sat, 16 Nov 2019 05:42:51 +0800 Subject: [PATCH] indexer: add name for anonymous Enum --- src/indexer.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/indexer.cc b/src/indexer.cc index acebd3fd..4c7a262c 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -947,11 +947,12 @@ public: } } [[fallthrough]]; + case Decl::Enum: case Decl::Record: - if (auto *rd = dyn_cast(d)) { + if (auto *tag_d = dyn_cast(d)) { if (type->def.detailed_name[0] == '\0' && info->short_name.empty()) { StringRef tag; - switch (rd->getTagKind()) { + switch (tag_d->getTagKind()) { case TTK_Struct: tag = "struct"; break; @@ -968,7 +969,7 @@ public: tag = "enum"; break; } - if (TypedefNameDecl *td = rd->getTypedefNameForAnonDecl()) { + if (TypedefNameDecl *td = tag_d->getTypedefNameForAnonDecl()) { StringRef name = td->getName(); std::string detailed = ("anon " + tag + " " + name).str(); type->def.detailed_name = intern(detailed); @@ -979,7 +980,7 @@ public: type->def.short_name_size = name.size(); } } - if (is_def) + if (is_def && !isa(d)) if (auto *ord = dyn_cast(origD)) collectRecordMembers(*type, ord); }