ccls/libclangmm/CompileCommand.cc

28 lines
806 B
C++
Raw Normal View History

2017-02-16 09:35:30 +00:00
#include "CompileCommand.h"
#include "CompileCommands.h"
#include "Utility.h"
2017-02-22 08:52:00 +00:00
namespace clang {
CompileCommand::CompileCommand(const CXCompileCommand& command)
: cx_command(command) {};
std::string CompileCommand::get_command() const {
std::string result;
unsigned int num_args = clang_CompileCommand_getNumArgs(cx_command);
for (unsigned int i = 0; i < num_args; i++)
result += ToString(clang_CompileCommand_getArg(cx_command, i));
return result;
2017-02-16 09:35:30 +00:00
}
2017-02-22 08:52:00 +00:00
std::vector<std::string> CompileCommand::get_command_as_args() const {
unsigned num_args = clang_CompileCommand_getNumArgs(cx_command);
std::vector<std::string> result(num_args);
for (unsigned i = 0; i < num_args; i++)
result[i] = ToString(clang_CompileCommand_getArg(cx_command, i));
return result;
2017-02-16 09:35:30 +00:00
}
2017-02-22 08:52:00 +00:00
} // namespace clang