From e0a9166cd93b338e1fe86151a682dc0387a42862 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Sun, 9 Oct 2022 14:02:29 +0200 Subject: [PATCH] ide: libclang ubuntu 22.04 crash problem workaround --- uppsrc/ide/clang/Visitor.cpp | 13 +++++++++++++ uppsrc/ide/clang/clang.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/uppsrc/ide/clang/Visitor.cpp b/uppsrc/ide/clang/Visitor.cpp index 05b42ef51..15938931e 100644 --- a/uppsrc/ide/clang/Visitor.cpp +++ b/uppsrc/ide/clang/Visitor.cpp @@ -120,7 +120,18 @@ String ClangCursorInfo::Id() case CXCursor_Constructor: case CXCursor_Destructor: case CXCursor_CXXMethod: +#ifdef UBUNTU2204_WORKAROUND + { + String h = RawId(); + int q = 0; + while(findarg(h[q], ':', '*', '&', '(', ')', ' ') >= 0) + q++; + m = Scope(); + m.Cat(~h + q, h.GetCount() - q); + } +#else m = RawId(); +#endif break; case CXCursor_ClassTemplate: case CXCursor_VarDecl: @@ -376,7 +387,9 @@ void ClangVisitor::Do(CXTranslationUnit tu) CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors, CXPrintingPolicy_TerseOutput, CXPrintingPolicy_SuppressImplicitBase, +#ifndef UBUNTU2204_WORKAROUND CXPrintingPolicy_FullyQualifiedName, +#endif CXPrintingPolicy_Bool }) clang_PrintingPolicy_setProperty(pp_id, p, 1); diff --git a/uppsrc/ide/clang/clang.h b/uppsrc/ide/clang/clang.h index 5d33055a7..addfad271 100644 --- a/uppsrc/ide/clang/clang.h +++ b/uppsrc/ide/clang/clang.h @@ -3,6 +3,8 @@ #include +#define UBUNTU2204_WORKAROUND // there appears to be a bug in Ubuntu 22.04.1LTS libclang 14 + // Configuration extern bool LibClangEnabled;