#include "compile_commands.h" #include std::vector CompileCommands::Command::parameter_values(const std::string ¶meter_name) const { std::vector parameter_values; bool found_argument=false; for(auto ¶meter: parameters) { if(found_argument) { parameter_values.emplace_back(parameter); found_argument=false; } else if(parameter==parameter_name) found_argument=true; } return parameter_values; } CompileCommands::CompileCommands(const boost::filesystem::path &build_path) { try { boost::property_tree::ptree root_pt; boost::property_tree::json_parser::read_json((build_path/"compile_commands.json").string(), root_pt); auto commands_pt=root_pt.get_child(""); for(auto &command: commands_pt) { boost::filesystem::path directory=command.second.get("directory"); auto parameters_str=command.second.get("command"); boost::filesystem::path file=command.second.get("file"); std::vector parameters; bool backslash=false; bool single_quote=false; bool double_quote=false; size_t parameter_start_pos=std::string::npos; size_t parameter_size=0; auto add_parameter=[¶meters, ¶meters_str, ¶meter_start_pos, ¶meter_size] { auto parameter=parameters_str.substr(parameter_start_pos, parameter_size); // Remove escaping for(size_t c=0;c