14 #ifndef LLVM_CLANG_TOOLING_JSONCOMPILATIONDATABASE_H 15 #define LLVM_CLANG_TOOLING_JSONCOMPILATIONDATABASE_H 20 #include "llvm/ADT/ArrayRef.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" 67 static std::unique_ptr<JSONCompilationDatabase>
68 loadFromFile(StringRef FilePath, std::string &ErrorMessage,
74 static std::unique_ptr<JSONCompilationDatabase>
75 loadFromBuffer(StringRef DatabaseString, std::string &ErrorMessage,
83 std::vector<CompileCommand>
84 getCompileCommands(StringRef FilePath)
const override;
89 std::vector<std::string> getAllFiles()
const override;
93 std::vector<CompileCommand> getAllCompileCommands()
const override;
99 : Database(std::move(Database)), Syntax(Syntax),
100 YAMLStream(this->Database->getBuffer(),
SM) {}
106 bool parse(std::string &ErrorMessage);
115 using CompileCommandRef =
116 std::tuple<llvm::yaml::ScalarNode *, llvm::yaml::ScalarNode *,
117 std::vector<llvm::yaml::ScalarNode *>,
118 llvm::yaml::ScalarNode *>;
122 std::vector<CompileCommand> &Commands)
const;
125 llvm::StringMap<std::vector<CompileCommandRef>> IndexByFile;
129 std::vector<CompileCommandRef> AllCommands;
133 std::unique_ptr<llvm::MemoryBuffer> Database;
136 llvm::yaml::Stream YAMLStream;
142 #endif // LLVM_CLANG_TOOLING_JSONCOMPILATIONDATABASE_H
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Dataflow Directional Tag Classes.