| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_MERGE_H |
| 10 |
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_MERGE_H |
| 11 |
|
| 12 |
#include "index/Index.h" |
| 13 |
|
| 14 |
namespace clang { |
| 15 |
namespace clangd { |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
Symbol mergeSymbol(const Symbol &L, const Symbol &R); |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
class MergedIndex : public SymbolIndex { |
| 27 |
const SymbolIndex *Dynamic, *Static; |
| 28 |
|
| 29 |
public: |
| 30 |
|
| 31 |
|
| 32 |
MergedIndex(const SymbolIndex *Dynamic, const SymbolIndex *Static) |
| 33 |
: Dynamic(Dynamic), Static(Static) {} |
| 34 |
|
| 35 |
bool fuzzyFind(const FuzzyFindRequest &, |
| 36 |
llvm::function_ref<void(const Symbol &)>) const override; |
| 37 |
void lookup(const LookupRequest &, |
| 38 |
llvm::function_ref<void(const Symbol &)>) const override; |
| 39 |
bool refs(const RefsRequest &, |
| 40 |
llvm::function_ref<void(const Ref &)>) const override; |
| 41 |
void relations(const RelationsRequest &, |
| 42 |
llvm::function_ref<void(const SymbolID &, const Symbol &)>) |
| 43 |
const override; |
| 44 |
llvm::unique_function<IndexContents(llvm::StringRef) const> |
| 45 |
indexedFiles() const override; |
| 46 |
size_t estimateMemoryUsage() const override { |
| 47 |
return Dynamic->estimateMemoryUsage() + Static->estimateMemoryUsage(); |
| 48 |
} |
| 49 |
}; |
| 50 |
|
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
#endif |