Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compilation error with llvm16 #524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/xmagics/executable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ namespace xcpp
}

std::unique_ptr<clang::CodeGenerator> 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());
Expand All @@ -180,7 +180,7 @@ namespace xcpp
std::unique_ptr<llvm::raw_pwrite_stream> 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(),
Expand Down Expand Up @@ -220,10 +220,10 @@ namespace xcpp

llvm::StringRef OutputFileStr(OutputFile);
llvm::StringRef ErrorFileStr(ErrorFile);
llvm::SmallVector<llvm::Optional<llvm::StringRef>, 16> Redirects = {llvm::NoneType::None, OutputFileStr, ErrorFileStr};
llvm::SmallVector<llvm::Optional<llvm::StringRef>, 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.
Expand Down
5 changes: 3 additions & 2 deletions src/xmagics/execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <sstream>
#include <string>
#include <vector>
#include <cmath>

#include "cling/Interpreter/Value.h"
#include "cling/Interpreter/Exception.h"
Expand Down Expand Up @@ -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<double>() >= 0.2)
if (output.castAs<double>() >= 0.2)
{
break;
}
Expand All @@ -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<double>() / number);
all_runs.push_back(output.castAs<double>() / number);
mean += all_runs.back();
}
mean /= repeat;
Expand Down
2 changes: 1 addition & 1 deletion src/xmime_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Loading