11#include "llvm/ADT/StringRef.h"
12#include "llvm/Support/CommandLine.h"
13#include "llvm/Support/ConvertUTF.h"
14#include "llvm/Support/ErrorOr.h"
15#include "llvm/Support/MemoryBuffer.h"
16#include "llvm/Support/Path.h"
17#include "llvm/Support/StringSaver.h"
18#include "llvm/TargetParser/Host.h"
19#include "llvm/TargetParser/Triple.h"
25class ExpandResponseFilesDatabase :
public CompilationDatabase {
27 ExpandResponseFilesDatabase(
28 std::unique_ptr<CompilationDatabase>
Base,
29 llvm::cl::TokenizerCallback Tokenizer,
32 assert(this->Base !=
nullptr);
33 assert(this->Tokenizer !=
nullptr);
34 assert(this->FS !=
nullptr);
37 std::vector<std::string> getAllFiles()
const override {
38 return Base->getAllFiles();
41 std::vector<CompileCommand>
42 getCompileCommands(StringRef FilePath)
const override {
43 return expand(
Base->getCompileCommands(FilePath));
46 std::vector<CompileCommand> getAllCompileCommands()
const override {
47 return expand(
Base->getAllCompileCommands());
51 std::vector<CompileCommand> expand(std::vector<CompileCommand> Cmds)
const {
52 for (
auto &
Cmd : Cmds)
59 std::unique_ptr<CompilationDatabase>
Base;
60 llvm::cl::TokenizerCallback Tokenizer;
66std::unique_ptr<CompilationDatabase>
69 auto Tokenizer = llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows()
70 ? llvm::cl::TokenizeWindowsCommandLine
71 : llvm::cl::TokenizeGNUCommandLine;
72 return std::make_unique<ExpandResponseFilesDatabase>(
73 std::move(
Base), Tokenizer, std::move(FS));
The JSON file list parser is used to communicate input to InstallAPI.