|
|
|
@ -945,16 +945,8 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file |
|
|
|
} |
|
|
|
} |
|
|
|
}, &client_data); |
|
|
|
}, &client_data); |
|
|
|
|
|
|
|
|
|
|
|
if(!client_data.found_include.empty()) { |
|
|
|
if(!client_data.found_include.empty()) |
|
|
|
// Workaround for bug in ArchLinux's clang_getFileName()
|
|
|
|
return Offset(0, 0, client_data.found_include); |
|
|
|
// TODO: remove the workaround when this is fixed
|
|
|
|
|
|
|
|
auto include_path=filesystem::get_normal_path(client_data.found_include); |
|
|
|
|
|
|
|
boost::system::error_code ec; |
|
|
|
|
|
|
|
if(!boost::filesystem::exists(include_path, ec)) |
|
|
|
|
|
|
|
include_path="/usr/include"/include_path; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Offset(0, 0, include_path); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Find a matching include file if no include was found previously
|
|
|
|
// Find a matching include file if no include was found previously
|
|
|
|
clang_getInclusions(clang_tu->cx_tu, [](CXFile included_file, CXSourceLocation *inclusion_stack, unsigned include_len, CXClientData client_data_) { |
|
|
|
clang_getInclusions(clang_tu->cx_tu, [](CXFile included_file, CXSourceLocation *inclusion_stack, unsigned include_len, CXClientData client_data_) { |
|
|
|
@ -975,16 +967,8 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file |
|
|
|
} |
|
|
|
} |
|
|
|
}, &client_data); |
|
|
|
}, &client_data); |
|
|
|
|
|
|
|
|
|
|
|
if(!client_data.found_include.empty()) { |
|
|
|
if(!client_data.found_include.empty()) |
|
|
|
// Workaround for bug in ArchLinux's clang_getFileName()
|
|
|
|
return Offset(0, 0, client_data.found_include); |
|
|
|
// TODO: remove the workaround when this is fixed
|
|
|
|
|
|
|
|
auto include_path=filesystem::get_normal_path(client_data.found_include); |
|
|
|
|
|
|
|
boost::system::error_code ec; |
|
|
|
|
|
|
|
if(!boost::filesystem::exists(include_path, ec)) |
|
|
|
|
|
|
|
include_path="/usr/include"/include_path; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Offset(0, 0, include_path); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return Offset(); |
|
|
|
return Offset(); |
|
|
|
@ -998,6 +982,14 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file |
|
|
|
auto offset=declaration_location(); |
|
|
|
auto offset=declaration_location(); |
|
|
|
if(!offset) |
|
|
|
if(!offset) |
|
|
|
Info::get().print("No declaration found"); |
|
|
|
Info::get().print("No declaration found"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Workaround for bug in ArchLinux's clang_getFileName()
|
|
|
|
|
|
|
|
// TODO: remove the workaround when this is fixed
|
|
|
|
|
|
|
|
auto include_path=filesystem::get_normal_path(offset.file_path); |
|
|
|
|
|
|
|
boost::system::error_code ec; |
|
|
|
|
|
|
|
if(!boost::filesystem::exists(include_path, ec)) |
|
|
|
|
|
|
|
offset.file_path="/usr/include"/include_path; |
|
|
|
|
|
|
|
|
|
|
|
return offset; |
|
|
|
return offset; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -1095,6 +1087,16 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file |
|
|
|
auto offsets=implementation_locations(views); |
|
|
|
auto offsets=implementation_locations(views); |
|
|
|
if(offsets.empty()) |
|
|
|
if(offsets.empty()) |
|
|
|
Info::get().print("No implementation found"); |
|
|
|
Info::get().print("No implementation found"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Workaround for bug in ArchLinux's clang_getFileName()
|
|
|
|
|
|
|
|
// TODO: remove the workaround when this is fixed
|
|
|
|
|
|
|
|
for(auto &offset: offsets) { |
|
|
|
|
|
|
|
auto include_path=filesystem::get_normal_path(offset.file_path); |
|
|
|
|
|
|
|
boost::system::error_code ec; |
|
|
|
|
|
|
|
if(!boost::filesystem::exists(include_path, ec)) |
|
|
|
|
|
|
|
offset.file_path="/usr/include"/include_path; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return offsets; |
|
|
|
return offsets; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -1140,6 +1142,15 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file |
|
|
|
if(offsets.empty()) |
|
|
|
if(offsets.empty()) |
|
|
|
Info::get().print("No declaration or implementation found"); |
|
|
|
Info::get().print("No declaration or implementation found"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Workaround for bug in ArchLinux's clang_getFileName()
|
|
|
|
|
|
|
|
// TODO: remove the workaround when this is fixed
|
|
|
|
|
|
|
|
for(auto &offset: offsets) { |
|
|
|
|
|
|
|
auto include_path=filesystem::get_normal_path(offset.file_path); |
|
|
|
|
|
|
|
boost::system::error_code ec; |
|
|
|
|
|
|
|
if(!boost::filesystem::exists(include_path, ec)) |
|
|
|
|
|
|
|
offset.file_path="/usr/include"/include_path; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return offsets; |
|
|
|
return offsets; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|