2017-03-26 21:40:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <optional.h>
|
2017-03-31 04:21:52 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2017-03-26 21:40:34 +00:00
|
|
|
|
|
|
|
using std::experimental::optional;
|
|
|
|
using std::experimental::nullopt;
|
|
|
|
|
2017-03-31 04:21:52 +00:00
|
|
|
struct CompilationEntry {
|
|
|
|
std::string filename;
|
|
|
|
std::vector<std::string> args;
|
|
|
|
};
|
|
|
|
|
2017-03-26 21:40:34 +00:00
|
|
|
struct Project {
|
|
|
|
std::vector<CompilationEntry> entries;
|
|
|
|
|
2017-03-31 04:21:52 +00:00
|
|
|
// 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|.
|
2017-03-26 21:40:34 +00:00
|
|
|
optional<CompilationEntry> FindCompilationEntryForFile(const std::string& filename);
|
2017-03-31 04:21:52 +00:00
|
|
|
};
|
|
|
|
|