From ae23f057a969700075384a1269fb7821e4a758ff Mon Sep 17 00:00:00 2001 From: Nrusingh Prasad Dash Date: Thu, 2 May 2024 20:57:56 +0530 Subject: [PATCH] fix compilation error with llvm16 Signed-off-by: Nrusingh Prasad Dash --- CMakeLists.txt | 3 +-- src/xmagics/executable.cpp | 10 +++++----- src/xmagics/execution.cpp | 5 +++-- src/xmime_internal.hpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43718f5a..d0d8670e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,8 +63,7 @@ if(LLVM_CONFIG) "--bindir" "--libdir" "--includedir" - "--prefix" - "--src-root") + "--prefix") execute_process(COMMAND ${CONFIG_COMMAND} RESULT_VARIABLE HAD_ERROR OUTPUT_VARIABLE CONFIG_OUTPUT) diff --git a/src/xmagics/executable.cpp b/src/xmagics/executable.cpp index 48d3b75d..fe4053ad 100644 --- a/src/xmagics/executable.cpp +++ b/src/xmagics/executable.cpp @@ -155,8 +155,8 @@ namespace xcpp } std::unique_ptr CG(clang::CreateLLVMCodeGen( - CI->getDiagnostics(), "object", HeaderSearchOpts, - CI->getPreprocessorOpts(), CodeGenOpts, *Context)); + CI->getDiagnostics(), "object", &CI->getVirtualFileSystem(), HeaderSearchOpts, + CI->getPreprocessorOpts(), CodeGenOpts, *m_interpreter.getLLVMContext())); CG->Initialize(AST); FindTopLevelDecls Visitor(CG.get()); @@ -180,7 +180,7 @@ namespace xcpp std::unique_ptr OS( new llvm::raw_fd_ostream(ObjectFD, true)); - auto DataLayout = AST.getTargetInfo().getDataLayout(); + auto DataLayout = AST.getTargetInfo().getDataLayoutString(); EmitBackendOutput(CI->getDiagnostics(), HeaderSearchOpts, CodeGenOpts, CI->getTargetOpts(), CI->getLangOpts(), DataLayout, CG->GetModule(), @@ -220,10 +220,10 @@ namespace xcpp llvm::StringRef OutputFileStr(OutputFile); llvm::StringRef ErrorFileStr(ErrorFile); - llvm::SmallVector, 16> Redirects = {llvm::NoneType::None, OutputFileStr, ErrorFileStr}; + llvm::SmallVector, 16> Redirects = {std::nullopt, OutputFileStr, ErrorFileStr}; // Finally run the linker. - int ret = llvm::sys::ExecuteAndWait(Compiler, Args, llvm::NoneType::None, + int ret = llvm::sys::ExecuteAndWait(Compiler, Args, std::nullopt, Redirects); // Read back output and error streams. diff --git a/src/xmagics/execution.cpp b/src/xmagics/execution.cpp index 22f6f745..66c7028b 100644 --- a/src/xmagics/execution.cpp +++ b/src/xmagics/execution.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "cling/Interpreter/Value.h" #include "cling/Interpreter/Exception.h" @@ -148,7 +149,7 @@ namespace xcpp number = std::pow(10, n); std::string timeit_code = inner(number, code); compilation_result = m_interpreter->process(timeit_code.c_str(), &output); - if (output.simplisticCastAs() >= 0.2) + if (output.castAs() >= 0.2) { break; } @@ -162,7 +163,7 @@ namespace xcpp { std::string timeit_code = inner(number, code); compilation_result = m_interpreter->process(timeit_code.c_str(), &output); - all_runs.push_back(output.simplisticCastAs() / number); + all_runs.push_back(output.castAs() / number); mean += all_runs.back(); } mean /= repeat; diff --git a/src/xmime_internal.hpp b/src/xmime_internal.hpp index f26981bf..a47c5fc8 100644 --- a/src/xmime_internal.hpp +++ b/src/xmime_internal.hpp @@ -204,7 +204,7 @@ namespace xcpp cling_detail::AccessCtrlRAII_t AccessCtrlRAII(*interpreter); cling_detail::LockCompilationDuringUserCodeExecutionRAII LCDUCER(*interpreter); - interpreter->process(code.str(), &mimeReprV); + interpreter->process(std::string(code.str()), &mimeReprV); } if (mimeReprV.isValid() && mimeReprV.getPtr())