ccls/src/iindexer.h

45 lines
1.2 KiB
C
Raw Normal View History

#pragma once
2018-01-20 07:56:49 +00:00
#include <optional.h>
2018-01-07 01:11:34 +00:00
#include <initializer_list>
#include <memory>
2018-01-07 00:51:55 +00:00
#include <string>
#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;
2018-01-07 01:11:34 +00:00
TestEntry(const std::string& path, int num_indexes);
};
static std::unique_ptr<IIndexer> MakeClangIndexer();
static std::unique_ptr<IIndexer> MakeTestIndexer(
2018-01-07 01:11:34 +00:00
std::initializer_list<TestEntry> entries);
virtual ~IIndexer() = default;
2018-01-20 07:56:49 +00:00
virtual optional<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;
2018-01-07 00:51:55 +00:00
};