mirror of https://gitlab.com/cppit/libclangmm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
753 B
21 lines
753 B
#include "CompileCommands.h" |
|
|
|
clangmm::CompileCommands::CompileCommands(const std::string &filename, CompilationDatabase &db) { |
|
cx_commands = |
|
clang_CompilationDatabase_getCompileCommands(db.cx_db, filename.c_str()); |
|
if(clang_CompileCommands_getSize(cx_commands)==0) |
|
cx_commands = clang_CompilationDatabase_getAllCompileCommands(db.cx_db); |
|
} |
|
|
|
clangmm::CompileCommands::~CompileCommands() { |
|
clang_CompileCommands_dispose(cx_commands); |
|
} |
|
|
|
std::vector<clangmm::CompileCommand> clangmm::CompileCommands::get_commands() { |
|
unsigned N = clang_CompileCommands_getSize(cx_commands); |
|
std::vector<CompileCommand> res; |
|
for (unsigned i = 0; i < N; i++) { |
|
res.emplace_back(clang_CompileCommands_getCommand(cx_commands, i)); |
|
} |
|
return res; |
|
}
|
|
|