11#include "llvm/ADT/StringRef.h"
12#include "llvm/Support/CommandLine.h"
13#include "llvm/Support/ConvertUTF.h"
14#include "llvm/TargetParser/Host.h"
15#include "llvm/TargetParser/Triple.h"
21class ExpandResponseFilesDatabase :
public CompilationDatabase {
23 ExpandResponseFilesDatabase(
24 std::unique_ptr<CompilationDatabase>
Base,
25 llvm::cl::TokenizerCallback Tokenizer,
28 assert(this->Base !=
nullptr);
29 assert(this->Tokenizer !=
nullptr);
30 assert(this->FS !=
nullptr);
33 std::vector<std::string> getAllFiles()
const override {
34 return Base->getAllFiles();
37 std::vector<CompileCommand>
38 getCompileCommands(StringRef FilePath)
const override {
39 return expand(
Base->getCompileCommands(FilePath));
42 std::vector<CompileCommand> getAllCompileCommands()
const override {
43 return expand(
Base->getAllCompileCommands());
47 std::vector<CompileCommand> expand(std::vector<CompileCommand> Cmds)
const {
48 for (
auto &
Cmd : Cmds)
55 std::unique_ptr<CompilationDatabase>
Base;
56 llvm::cl::TokenizerCallback Tokenizer;
62std::unique_ptr<CompilationDatabase>
65 auto Tokenizer = llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows()
66 ? llvm::cl::TokenizeWindowsCommandLine
67 : llvm::cl::TokenizeGNUCommandLine;
68 return std::make_unique<ExpandResponseFilesDatabase>(
69 std::move(
Base), Tokenizer, std::move(FS));
The JSON file list parser is used to communicate input to InstallAPI.