Pass LLVM error message back to pass wrapper.

This commit is contained in:
Ao Li 2024-01-05 15:59:11 -05:00
parent 11035f9f52
commit c9276ea042

View File

@ -787,7 +787,9 @@ LLVMRustOptimize(
for (auto PluginPath: Plugins) { for (auto PluginPath: Plugins) {
auto Plugin = PassPlugin::Load(PluginPath.str()); auto Plugin = PassPlugin::Load(PluginPath.str());
if (!Plugin) { if (!Plugin) {
LLVMRustSetLastError(("Failed to load pass plugin" + PluginPath.str()).c_str()); auto Err = Plugin.takeError();
auto ErrMsg = llvm::toString(std::move(Err));
LLVMRustSetLastError(ErrMsg.c_str());
return LLVMRustResult::Failure; return LLVMRustResult::Failure;
} }
Plugin->registerPassBuilderCallbacks(PB); Plugin->registerPassBuilderCallbacks(PB);