|
|
|
@ -84,12 +84,13 @@ std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem: |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static auto resource_path = []() -> std::string { |
|
|
|
static std::string resource_path = []() -> std::string { |
|
|
|
// Try based on clang_getClangVersion first, even though its format is not guaranteed to be stable.
|
|
|
|
// Try based on clang_getClangVersion first, even though its format is not guaranteed to be stable.
|
|
|
|
auto clang_version = clangmm::to_string(clang_getClangVersion()); |
|
|
|
auto clang_version = clangmm::to_string(clang_getClangVersion()); |
|
|
|
std::string version; |
|
|
|
std::regex clang_version_regex("([0-9]+\\.[0-9]+\\.[0-9]+)"); |
|
|
|
for(auto it = clang_version.rbegin(); it != clang_version.rend() && ((*it >= '0' && *it <= '9') || *it == '.'); ++it) |
|
|
|
std::smatch sm; |
|
|
|
version.insert(version.begin(), *it); |
|
|
|
if(std::regex_search(clang_version, sm, clang_version_regex)) { |
|
|
|
|
|
|
|
auto version = sm[1].str(); |
|
|
|
while(!version.empty() && version.front() != '.' && version.back() != '.') { |
|
|
|
while(!version.empty() && version.front() != '.' && version.back() != '.') { |
|
|
|
auto path = boost::filesystem::path(LIBCLANG_LIBRARY_DIR) / "clang" / version; |
|
|
|
auto path = boost::filesystem::path(LIBCLANG_LIBRARY_DIR) / "clang" / version; |
|
|
|
boost::system::error_code ec; |
|
|
|
boost::system::error_code ec; |
|
|
|
@ -100,6 +101,7 @@ std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem: |
|
|
|
break; |
|
|
|
break; |
|
|
|
version.erase(pos); |
|
|
|
version.erase(pos); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
boost::system::error_code ec; |
|
|
|
boost::system::error_code ec; |
|
|
|
for(boost::filesystem::directory_iterator it(boost::filesystem::path(LIBCLANG_LIBRARY_DIR) / "clang", ec), end; it != end; ++it) { |
|
|
|
for(boost::filesystem::directory_iterator it(boost::filesystem::path(LIBCLANG_LIBRARY_DIR) / "clang", ec), end; it != end; ++it) { |
|
|
|
|