ccls/src/import_pipeline.h

67 lines
2.1 KiB
C
Raw Normal View History

#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-28 16:55:46 +00:00
#include <atomic>
2018-02-05 03:38:57 +00:00
#include <memory>
#include <optional>
#include <string>
#include <mutex>
#include <unordered_map>
#include <vector>
struct ClangTranslationUnit;
class DiagnosticsEngine;
2017-12-29 16:29:47 +00:00
struct FileConsumerSharedState;
struct ICacheManager;
struct ImportManager;
struct MultiQueueWaiter;
struct Project;
struct QueryDatabase;
struct SemanticHighlightSymbolCache;
struct WorkingFiles;
// 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;
ImportPipelineStatus();
2017-12-28 16:55:46 +00:00
};
void IndexWithTuFromCodeCompletion(
2017-12-29 16:29:47 +00:00
FileConsumerSharedState* file_consumer_shared,
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);
2018-04-04 06:05:41 +00:00
bool QueryDb_ImportMain(QueryDatabase* db,
ImportManager* import_manager,
ImportPipelineStatus* status,
SemanticHighlightSymbolCache* semantic_cache,
WorkingFiles* working_files);