[clang] [clang-repl] Fix target creation in Wasm.cpp (PR #130909)
Anutosh Bhat via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 00:06:18 PDT 2025
https://github.com/anutosh491 created https://github.com/llvm/llvm-project/pull/130909
After #129868 went in, I realize some updates have been made to the Triple.
Not sure if @nikic overlooked including this change in his PR (hence I have having build issue when compiling clang against emscripten while building for wasm)
But yeah just like the change was addressed in other files, we need to make the change here too I think
https://github.com/llvm/llvm-project/blob/d921bf233c4fd3840953b1a4b5bb35ad594da773/clang/lib/Interpreter/DeviceOffload.cpp#L79-L86
>From 18e1f9713b34bf1f9c0e946cd915c0ae04748607 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Wed, 12 Mar 2025 12:32:02 +0530
Subject: [PATCH] Fix target creation in Wasm.cpp
---
clang/lib/Interpreter/Wasm.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index aa10b160ccf84..85a62e05f6e82 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -66,7 +66,7 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
std::string ErrorString;
const llvm::Target *Target = llvm::TargetRegistry::lookupTarget(
- PTU.TheModule->getTargetTriple(), ErrorString);
+ PTU.TheModule->getTargetTriple().str(), ErrorString);
if (!Target) {
return llvm::make_error<llvm::StringError>("Failed to create Wasm Target: ",
llvm::inconvertibleErrorCode());
@@ -74,7 +74,7 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
llvm::TargetOptions TO = llvm::TargetOptions();
llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
- PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
+ PTU.TheModule->getTargetTriple().str(), "", "", TO, llvm::Reloc::Model::PIC_);
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
std::string ObjectFileName = PTU.TheModule->getName().str() + ".o";
std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm";
More information about the cfe-commits
mailing list