forked from OSchip/llvm-project
[clangd] Drop dangling relations while sharding
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D78359
This commit is contained in:
parent
c82faea9fb
commit
4503cf5f23
|
@ -174,8 +174,8 @@ FileShardedIndex::FileShardedIndex(IndexFileIn Input, PathRef HintPath)
|
|||
// not have been indexed, see SymbolCollector::processRelations for details.
|
||||
if (Index.Relations) {
|
||||
for (const auto &R : *Index.Relations) {
|
||||
auto *File = SymbolIDToFile.lookup(R.Subject);
|
||||
assert(File && "unknown subject in relation");
|
||||
// FIXME: RelationSlab shouldn't contain dangling relations.
|
||||
if (auto *File = SymbolIDToFile.lookup(R.Subject))
|
||||
File->Relations.insert(&R);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -540,6 +540,8 @@ TEST(FileShardedIndexTest, Sharding) {
|
|||
B.insert(Relation{Sym1.ID, RelationKind::BaseOf, Sym2.ID});
|
||||
// Should be stored in b.h
|
||||
B.insert(Relation{Sym2.ID, RelationKind::BaseOf, Sym1.ID});
|
||||
// Dangling relation should be dropped.
|
||||
B.insert(Relation{symbol("3").ID, RelationKind::BaseOf, Sym1.ID});
|
||||
IF.Relations = std::move(B).build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue