0002-fix-main-Handle-different-LLVM-version.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 460ae24e289f8c10696b88a468a94100b2a39965 Mon Sep 17 00:00:00 2001
  2. From: KokaKiwi <kokakiwi+git@kokakiwi.net>
  3. Date: Sun, 31 Dec 2023 13:29:36 +0100
  4. Subject: [PATCH 2/2] fix(main): Handle different LLVM version
  5. ---
  6. main/gui/source/crash_handlers.cpp | 6 ++++++
  7. 1 file changed, 6 insertions(+)
  8. diff --git a/main/gui/source/crash_handlers.cpp b/main/gui/source/crash_handlers.cpp
  9. index 2ddf766c..2ff85621 100644
  10. --- a/main/gui/source/crash_handlers.cpp
  11. +++ b/main/gui/source/crash_handlers.cpp
  12. @@ -14,6 +14,8 @@
  13. #include <nlohmann/json.hpp>
  14. #include <stacktrace.hpp>
  15. +
  16. +#include <llvm/Config/llvm-config.h>
  17. #include <llvm/Demangle/Demangle.h>
  18. #include <csignal>
  19. @@ -142,7 +144,11 @@ namespace hex::crash {
  20. try {
  21. std::rethrow_exception(std::current_exception());
  22. } catch (std::exception &ex) {
  23. +#if LLVM_VERSION_MAJOR >= 17
  24. std::string exceptionStr = hex::format("{}()::what() -> {}", llvm::itaniumDemangle(typeid(ex).name()), ex.what());
  25. +#else
  26. + std::string exceptionStr = hex::format("{}()::what() -> {}", llvm::itaniumDemangle(typeid(ex).name(), nullptr, nullptr, nullptr), ex.what());
  27. +#endif
  28. handleCrash(exceptionStr);
  29. log::fatal("Program terminated with uncaught exception: {}", exceptionStr);
  30. --
  31. 2.43.0