15 #ifndef LLVM_CLANG_TOOLING_JSONCOMPILATIONDATABASE_H
16 #define LLVM_CLANG_TOOLING_JSONCOMPILATIONDATABASE_H
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/Support/MemoryBuffer.h"
24 #include "llvm/Support/SourceMgr.h"
25 #include "llvm/Support/YAMLParser.h"
64 static std::unique_ptr<JSONCompilationDatabase>
70 static std::unique_ptr<JSONCompilationDatabase>
71 loadFromBuffer(StringRef DatabaseString, std::string &ErrorMessage);
78 std::vector<CompileCommand>
84 std::vector<std::string>
getAllFiles()
const override;
93 : Database(std::move(Database)),
94 YAMLStream(this->Database->getBuffer(), SM) {}
100 bool parse(std::string &ErrorMessage);
108 typedef std::tuple<llvm::yaml::ScalarNode *,
109 llvm::yaml::ScalarNode *,
110 std::vector<llvm::yaml::ScalarNode *>> CompileCommandRef;
114 std::vector<CompileCommand> &Commands)
const;
117 llvm::StringMap<std::vector<CompileCommandRef>> IndexByFile;
121 std::vector<CompileCommandRef> AllCommands;
125 std::unique_ptr<llvm::MemoryBuffer> Database;
127 llvm::yaml::Stream YAMLStream;
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...