2017-12-24 01:30:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-12-29 16:29:47 +00:00
|
|
|
// FIXME: do not include clang-c outside of clang_ files.
|
|
|
|
#include <clang-c/Index.h>
|
2017-12-24 01:30:52 +00:00
|
|
|
|
2017-12-28 16:55:46 +00:00
|
|
|
#include <atomic>
|
2018-02-05 03:38:57 +00:00
|
|
|
#include <memory>
|
2018-04-22 17:01:44 +00:00
|
|
|
#include <optional>
|
2017-12-24 01:30:52 +00:00
|
|
|
#include <string>
|
2018-04-22 17:01:44 +00:00
|
|
|
#include <mutex>
|
|
|
|
#include <unordered_map>
|
2017-12-24 01:30:52 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct ClangTranslationUnit;
|
2018-03-06 01:18:33 +00:00
|
|
|
class DiagnosticsEngine;
|
2017-12-29 16:29:47 +00:00
|
|
|
struct FileConsumerSharedState;
|
2018-04-22 17:01:44 +00:00
|
|
|
struct ICacheManager;
|
2017-12-24 01:30:52 +00:00
|
|
|
struct ImportManager;
|
2017-12-29 15:52:43 +00:00
|
|
|
struct MultiQueueWaiter;
|
|
|
|
struct Project;
|
2017-12-24 01:30:52 +00:00
|
|
|
struct QueryDatabase;
|
|
|
|
struct SemanticHighlightSymbolCache;
|
|
|
|
struct WorkingFiles;
|
|
|
|
|
2018-04-22 17:01:44 +00:00
|
|
|
// Caches timestamps of cc files so we can avoid a filesystem reads. This is
|
|
|
|
// important for import perf, as during dependency checking the same files are
|
|
|
|
// checked over and over again if they are common headers.
|
|
|
|
struct TimestampManager {
|
|
|
|
std::optional<int64_t> GetLastCachedModificationTime(ICacheManager* cache_manager,
|
|
|
|
const std::string& path);
|
|
|
|
|
|
|
|
void UpdateCachedModificationTime(const std::string& path, int64_t timestamp);
|
|
|
|
|
|
|
|
// TODO: use std::shared_mutex so we can have multiple readers.
|
|
|
|
std::mutex mutex_;
|
|
|
|
std::unordered_map<std::string, int64_t> timestamps_;
|
|
|
|
};
|
|
|
|
|
2017-12-28 16:55:46 +00:00
|
|
|
struct ImportPipelineStatus {
|
|
|
|
std::atomic<int> num_active_threads;
|
2018-01-07 21:37:30 +00:00
|
|
|
std::atomic<long long> next_progress_output;
|
2017-12-28 18:21:30 +00:00
|
|
|
|
|
|
|
ImportPipelineStatus();
|
2017-12-28 16:55:46 +00:00
|
|
|
};
|
|
|
|
|
2017-12-24 01:30:52 +00:00
|
|
|
void IndexWithTuFromCodeCompletion(
|
2017-12-29 16:29:47 +00:00
|
|
|
FileConsumerSharedState* file_consumer_shared,
|
2017-12-24 01:30:52 +00:00
|
|
|
ClangTranslationUnit* tu,
|
|
|
|
const std::vector<CXUnsavedFile>& file_contents,
|
|
|
|
const std::string& path,
|
|
|
|
const std::vector<std::string>& args);
|
|
|
|
|
2018-04-04 06:05:41 +00:00
|
|
|
void Indexer_Main(DiagnosticsEngine* diag_engine,
|
2017-12-29 16:29:47 +00:00
|
|
|
FileConsumerSharedState* file_consumer_shared,
|
2017-12-29 15:56:34 +00:00
|
|
|
TimestampManager* timestamp_manager,
|
|
|
|
ImportManager* import_manager,
|
|
|
|
ImportPipelineStatus* status,
|
|
|
|
Project* project,
|
|
|
|
WorkingFiles* working_files,
|
|
|
|
MultiQueueWaiter* waiter);
|
2017-12-29 15:52:43 +00:00
|
|
|
|
2018-04-04 06:05:41 +00:00
|
|
|
bool QueryDb_ImportMain(QueryDatabase* db,
|
2017-12-24 01:30:52 +00:00
|
|
|
ImportManager* import_manager,
|
2018-01-07 21:06:18 +00:00
|
|
|
ImportPipelineStatus* status,
|
2017-12-24 01:30:52 +00:00
|
|
|
SemanticHighlightSymbolCache* semantic_cache,
|
|
|
|
WorkingFiles* working_files);
|