mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 00:55:08 +00:00
9338bcfd0e
- Don't reindex the file if the modification time has not changed. - Import file dependencies before importing other files, which might be a full-on index operation.
39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <optional.h>
|
|
#include <sparsepp/spp.h>
|
|
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
using std::experimental::optional;
|
|
using std::experimental::nullopt;
|
|
|
|
struct Project {
|
|
struct Entry {
|
|
std::string filename;
|
|
std::vector<std::string> args;
|
|
optional<uint64_t> last_modification_time;
|
|
};
|
|
|
|
std::vector<Entry> entries;
|
|
spp::sparse_hash_map<std::string, int> absolute_path_to_entry_index_;
|
|
std::mutex entries_modification_mutex_;
|
|
|
|
// Loads a project for the given |directory|.
|
|
//
|
|
// If |directory| contains a compile_commands.json file, that will be used to
|
|
// discover all files and args. Otherwise, a recursive directory listing of
|
|
// all *.cpp, *.cc, *.h, and *.hpp files will be used. clang arguments can be
|
|
// specified in a clang_args file located inside of |directory|.
|
|
void Load(const std::string& directory);
|
|
|
|
// Lookup the CompilationEntry for |filename|.
|
|
optional<Entry> FindCompilationEntryForFile(const std::string& filename);
|
|
|
|
// Update the modification time for the given filename. This is thread-safe.
|
|
void UpdateModificationTime(const std::string& filename, uint64_t modification_time);
|
|
};
|
|
|