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.
22 lines
840 B
22 lines
840 B
|
6 years ago
|
#include "compile_commands.hpp"
|
||
|
11 years ago
|
|
||
|
9 years ago
|
clangmm::CompileCommands::CompileCommands(const std::string &filename, CompilationDatabase &db) {
|
||
|
8 years ago
|
if(!filename.empty())
|
||
|
|
cx_commands = clang_CompilationDatabase_getCompileCommands(db.cx_db, filename.c_str());
|
||
|
8 years ago
|
if(filename.empty() || clang_CompileCommands_getSize(cx_commands) == 0)
|
||
|
11 years ago
|
cx_commands = clang_CompilationDatabase_getAllCompileCommands(db.cx_db);
|
||
|
11 years ago
|
}
|
||
|
|
|
||
|
9 years ago
|
clangmm::CompileCommands::~CompileCommands() {
|
||
|
11 years ago
|
clang_CompileCommands_dispose(cx_commands);
|
||
|
11 years ago
|
}
|
||
|
|
|
||
|
9 years ago
|
std::vector<clangmm::CompileCommand> clangmm::CompileCommands::get_commands() {
|
||
|
8 years ago
|
unsigned size = clang_CompileCommands_getSize(cx_commands);
|
||
|
|
std::vector<CompileCommand> commands;
|
||
|
8 years ago
|
commands.reserve(size);
|
||
|
8 years ago
|
for(unsigned i = 0; i < size; i++)
|
||
|
8 years ago
|
commands.emplace_back(clang_CompileCommands_getCommand(cx_commands, i));
|
||
|
|
return commands;
|
||
|
11 years ago
|
}
|