Browse Source

Temporary fix for llvm 15 where the TranslationUnit cursor kind was changed from 300 to 350

merge-requests/413/head
eidheim 3 years ago
parent
commit
bab7e16a90
  1. 14
      src/source_clang.cpp

14
src/source_clang.cpp

@ -682,6 +682,8 @@ void Source::ClangViewParse::show_type_tooltips(const Gdk::Rectangle &rectangle)
auto start_cursor = cursor;
for(auto parent = cursor.get_semantic_parent();
parent.get_kind() != clangmm::Cursor::Kind::TranslationUnit &&
// TODO: update clangmm::Cursor::Kind::TranslationUnit (changed from 300 to 350 in llvm 15)
static_cast<int>(parent.get_kind()) != 350 &&
parent.get_kind() != clangmm::Cursor::Kind::ClassDecl;
parent = parent.get_semantic_parent())
start_cursor = parent;
@ -1559,7 +1561,8 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file
// If no implementation was found, try using Ctags
auto name = identifier.cursor.get_spelling();
auto parent = identifier.cursor.get_semantic_parent();
while(parent && parent.get_kind() != clangmm::Cursor::Kind::TranslationUnit) {
// TODO: update clangmm::Cursor::Kind::TranslationUnit (changed from 300 to 350 in llvm 15)
while(parent && parent.get_kind() != clangmm::Cursor::Kind::TranslationUnit && static_cast<int>(parent.get_kind()) != 350) {
auto spelling = parent.get_spelling() + "::";
name.insert(0, spelling);
parent = parent.get_semantic_parent();
@ -1789,7 +1792,8 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file
if(c == 0 || (*clang_tokens)[c - 1].get_spelling() != "::") {
auto name = token_spelling;
auto parent = token.get_cursor().get_type().get_cursor().get_semantic_parent();
while(parent && parent.get_kind() != clangmm::Cursor::Kind::TranslationUnit) {
// TODO: update clangmm::Cursor::Kind::TranslationUnit (changed from 300 to 350 in llvm 15)
while(parent && parent.get_kind() != clangmm::Cursor::Kind::TranslationUnit && static_cast<int>(parent.get_kind()) != 350) {
auto spelling = parent.get_token_spelling();
name.insert(0, spelling + "::");
parent = parent.get_semantic_parent();
@ -1831,7 +1835,8 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file
auto name = cursor.get_spelling();
auto parent = cursor.get_semantic_parent();
std::vector<std::string> semantic_parents;
while(parent && parent.get_kind() != clangmm::Cursor::Kind::TranslationUnit) {
// TODO: update clangmm::Cursor::Kind::TranslationUnit (changed from 300 to 350 in llvm 15)
while(parent && parent.get_kind() != clangmm::Cursor::Kind::TranslationUnit && static_cast<int>(parent.get_kind()) != 350) {
auto spelling = parent.get_spelling() + "::";
if(spelling != "::") {
semantic_parents.emplace_back(spelling);
@ -1908,7 +1913,8 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file
}
last_cursor = cursor;
cursor = cursor.get_semantic_parent();
} while(cursor && cursor.get_kind() != clangmm::Cursor::Kind::TranslationUnit);
// TODO: update clangmm::Cursor::Kind::TranslationUnit (changed from 300 to 350 in llvm 15)
} while(cursor && cursor.get_kind() != clangmm::Cursor::Kind::TranslationUnit && static_cast<int>(cursor.get_kind()) != 350);
if(last_cursor.get_kind() != clangmm::Cursor::Kind::Namespace)
data.emplace(++data.begin(), "");

Loading…
Cancel
Save