forked from MaskRay/ccls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.h
60 lines (49 loc) · 1.86 KB
/
project.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include "config.h"
#include <optional.h>
#include <sparsepp/spp.h>
#include <variant.h>
#include <functional>
#include <mutex>
#include <string>
#include <vector>
// FIXME ipc.h
using lsRequestId = std::variant<std::monostate, int64_t, std::string>;
class QueueManager;
struct WorkingFiles;
struct Project {
struct Entry {
std::string filename;
std::vector<std::string> args;
// If true, this entry is inferred and was not read from disk.
bool is_inferred = false;
};
// Include directories for "" headers
std::vector<std::string> quote_include_directories;
// Include directories for <> headers
std::vector<std::string> angle_include_directories;
std::vector<Entry> entries;
spp::sparse_hash_map<std::string, int> absolute_path_to_entry_index_;
// Loads a project for the given |directory|.
//
// If |config->compilationDatabaseDirectory| is not empty, look for .cquery or
// compile_commands.json in it, otherwise they are retrieved in
// |root_directory|.
// For .cquery, recursive directory listing is used and files with known
// suffixes are indexed. .cquery files can exist in subdirectories and they will affect
// flags in their subtrees (relative paths are relative to the project root,
// not subdirectories).
// For compile_commands.json, its entries are indexed.
void Load(Config* config, const std::string& root_directory);
// Lookup the CompilationEntry for |filename|. If no entry was found this
// will infer one based on existing project structure.
Entry FindCompilationEntryForFile(const std::string& filename);
// Run |action| on every file in the project.
void ForAllFilteredFiles(
Config* config,
std::function<void(int i, const Entry& entry)> action);
void Index(Config* config,
QueueManager* queue,
WorkingFiles* wfiles,
lsRequestId id);
};