mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-30 03:17:08 +00:00
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
|
#pragma once
|
||
|
|
||
|
#include <memory>
|
||
|
#include <vector>
|
||
|
|
||
|
// TODO:
|
||
|
// - rename indexer.h to clang_indexer.h and pull out non-clang specific code
|
||
|
// like IndexFile
|
||
|
// - rename this file to indexer.h
|
||
|
|
||
|
struct Config;
|
||
|
struct IndexFile;
|
||
|
struct FileContents;
|
||
|
struct FileConsumerSharedState;
|
||
|
struct PerformanceImportFile;
|
||
|
|
||
|
// Abstracts away the actual indexing process. Each IIndexer instance is
|
||
|
// per-thread and constructing an instance may be extremely expensive (ie,
|
||
|
// acquire a lock) and should be done as rarely as possible.
|
||
|
struct IIndexer {
|
||
|
struct TestEntry {
|
||
|
std::string path;
|
||
|
int num_indexes = 0;
|
||
|
};
|
||
|
|
||
|
static std::unique_ptr<IIndexer> MakeClangIndexer();
|
||
|
static std::unique_ptr<IIndexer> MakeTestIndexer(
|
||
|
const std::vector<TestEntry>& entries);
|
||
|
|
||
|
virtual ~IIndexer() = default;
|
||
|
virtual std::vector<std::unique_ptr<IndexFile>> Index(
|
||
|
Config* config,
|
||
|
FileConsumerSharedState* file_consumer_shared,
|
||
|
std::string file,
|
||
|
const std::vector<std::string>& args,
|
||
|
const std::vector<FileContents>& file_contents,
|
||
|
PerformanceImportFile* perf) = 0;
|
||
|
};
|