[PATCH] D92484: [clangd] Relation slabs should not be accounted when computing backing storage size

Ilya Golovenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 3 04:33:44 PST 2020


ilya-golovenko added a comment.

In D92484#2430851 <https://reviews.llvm.org/D92484#2430851>, @sammccall wrote:

> Can you give a little context? Why not?

It seems `Relations` should be not taken into account because they don't reference a backing storage.
Only `SymStorage` and `RefsStorage` are passed to the respective index in the `Payload` argument.

  cpp
      return std::make_unique<MemIndex>(
          llvm::make_pointee_range(AllSymbols), std::move(AllRefs),
          std::move(AllRelations),
          std::make_tuple(std::move(SymbolSlabs), std::move(RefSlabs),
                          std::move(RefsStorage), std::move(SymsStorage)),
          StorageSize);

Also, there is a comment regarding `Rels` slab in `Dex.cpp`:

  cpp
  std::unique_ptr<SymbolIndex> Dex::build(SymbolSlab Symbols, RefSlab Refs, RelationSlab Rels) {
    auto Size = Symbols.bytes() + Refs.bytes();
    // There is no need to include "Rels" in Data because the relations are self-  <<<<<
    // contained, without references into a backing store.                         <<<<<
    auto Data = std::make_pair(std::move(Symbols), std::move(Refs));
    return std::make_unique<Dex>(Data.first, Data.second, Rels, std::move(Data),
                                  Size);
  }

MemIndex also uses only `Symbols` and `Refs` slabs to compute backing storage size.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92484/new/

https://reviews.llvm.org/D92484



More information about the cfe-commits mailing list