LCOV - code coverage report
Current view: top level - clang/tools/extra/clangd/index - MemIndex.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 0 1 0.0 %
Date: 2018-02-23 05:02:05 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===--- MemIndex.h - Dynamic in-memory symbol index. -------------- C++-*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : 
      10             : #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_MEMINDEX_H
      11             : #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_MEMINDEX_H
      12             : 
      13             : #include "Index.h"
      14             : #include <mutex>
      15             : 
      16             : namespace clang {
      17             : namespace clangd {
      18             : 
      19             : /// \brief This implements an index for a (relatively small) set of symbols that
      20             : /// can be easily managed in memory.
      21           0 : class MemIndex : public SymbolIndex {
      22             : public:
      23             :   /// \brief (Re-)Build index for `Symbols`. All symbol pointers must remain
      24             :   /// accessible as long as `Symbols` is kept alive.
      25             :   void build(std::shared_ptr<std::vector<const Symbol *>> Symbols);
      26             : 
      27             :   /// \brief Build index from a symbol slab.
      28             :   static std::unique_ptr<SymbolIndex> build(SymbolSlab Slab);
      29             : 
      30             :   bool
      31             :   fuzzyFind(const FuzzyFindRequest &Req,
      32             :             llvm::function_ref<void(const Symbol &)> Callback) const override;
      33             : 
      34             : private:
      35             :   std::shared_ptr<std::vector<const Symbol *>> Symbols;
      36             :   // Index is a set of symbols that are deduplicated by symbol IDs.
      37             :   // FIXME: build smarter index structure.
      38             :   llvm::DenseMap<SymbolID, const Symbol *> Index;
      39             :   mutable std::mutex Mutex;
      40             : };
      41             : 
      42             : } // namespace clangd
      43             : } // namespace clang
      44             : 
      45             : #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_MEMINDEX_H

Generated by: LCOV version 1.13