ccls/libclangmm/CompileCommands.cc
Jacob Dufault ce4c2232d7 update
2017-02-22 00:52:00 -08:00

23 lines
751 B
C++

#include "CompileCommands.h"
clang::CompileCommands::CompileCommands(const CompilationDatabase& db) {
cx_commands =
clang_CompilationDatabase_getAllCompileCommands(db.cx_db);
//if (clang_CompileCommands_getSize(cx_commands) == 0)
// cx_commands = clang_CompilationDatabase_getAllCompileCommands(db.cx_db);
}
clang::CompileCommands::~CompileCommands() {
clang_CompileCommands_dispose(cx_commands);
}
std::vector<clang::CompileCommand> clang::CompileCommands::get_commands() {
unsigned N = clang_CompileCommands_getSize(cx_commands);
std::vector<CompileCommand> res;
for (unsigned i = 0; i < N; i++) {
CXCompileCommand command = clang_CompileCommands_getCommand(cx_commands, i);
res.push_back(command);
}
return res;
}