Browse Source

Namespace: improve indexer and don't trace bases in $ccls/member

pull/522/head
Fangrui Song 6 years ago
parent
commit
7b19c87485
  1. 13
      src/indexer.cc
  2. 16
      src/messages/ccls_member.cc

13
src/indexer.cc

@ -719,8 +719,17 @@ public:
// spell, extent, comments use OrigD while most others use adjusted |D|.
const Decl *OrigD = ASTNode.OrigD;
const DeclContext *SemDC = OrigD->getDeclContext();
const DeclContext *LexDC = ASTNode.ContainerDC;
const DeclContext *SemDC = OrigD->getDeclContext()->getRedeclContext();
const DeclContext *LexDC = ASTNode.ContainerDC->getRedeclContext();
{
const NamespaceDecl *ND;
while ((ND = dyn_cast<NamespaceDecl>(cast<Decl>(SemDC))) &&
ND->isAnonymousNamespace())
SemDC = ND->getDeclContext()->getRedeclContext();
while ((ND = dyn_cast<NamespaceDecl>(cast<Decl>(LexDC))) &&
ND->isAnonymousNamespace())
LexDC = ND->getDeclContext()->getRedeclContext();
}
Role role = static_cast<Role>(Roles);
db->language = LanguageId((int)db->language | (int)GetDeclLanguage(D));

16
src/messages/ccls_member.cc

@ -133,14 +133,16 @@ bool Expand(MessageHandler *m, Out_CclsMember::Entry *entry,
type = stack.back();
stack.pop_back();
const auto *def = type->AnyDef();
if (!def) continue;
for (Usr usr : def->bases) {
auto &type1 = m->db->Type(usr);
if (type1.def.size()) {
seen.insert(type1.usr);
stack.push_back(&type1);
if (!def)
continue;
if (def->kind != lsSymbolKind::Namespace)
for (Usr usr : def->bases) {
auto &type1 = m->db->Type(usr);
if (type1.def.size()) {
seen.insert(type1.usr);
stack.push_back(&type1);
}
}
}
if (def->alias_of) {
const QueryType::Def *def1 = m->db->Type(def->alias_of).AnyDef();
Out_CclsMember::Entry entry1;

Loading…
Cancel
Save