Skip to content

Commit 138934e

Browse files
committed
[PluginRegistry] Error handling tweaks
1 parent 623043e commit 138934e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/AST/CASTBridging.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,10 @@ void Plugin_unlock(PluginHandle handle) {
651651
bool Plugin_sendMessage(PluginHandle handle, const BridgedData data) {
652652
auto *plugin = static_cast<LoadedExecutablePlugin *>(handle);
653653
StringRef message(data.baseAddress, data.size);
654-
return bool(plugin->sendMessage(message));
654+
auto error = plugin->sendMessage(message);
655+
bool hadError = bool(error);
656+
llvm::consumeError(std::move(error));
657+
return hadError;
655658
}
656659

657660
bool Plugin_waitForNextMessage(PluginHandle handle, BridgedData *out) {

lib/AST/PluginRegistry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ llvm::Error PluginRegistry::loadLibraryPlugin(StringRef path) {
5656
#else
5757
lib = dlopen(path.str().c_str(), RTLD_LAZY | RTLD_LOCAL);
5858
if (!lib) {
59-
return llvm::createStringError(std::error_code(), dlerror());
59+
return llvm::createStringError(llvm::inconvertibleErrorCode(), dlerror());
6060
}
6161
#endif
6262
LoadedPluginLibraries.insert({path, lib});

0 commit comments

Comments
 (0)