Skip to content

Commit 623043e

Browse files
committed
[AST] Fix Windows compile error
1 parent c6387a5 commit 623043e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/AST/PluginRegistry.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ llvm::Error PluginRegistry::loadLibraryPlugin(StringRef path) {
5050
#if defined(_WIN32)
5151
lib = LoadLibraryA(path.str().c_str());
5252
if (!lib) {
53-
return llvm::createStringError(std::errc::not_supported, "failed");
54-
return true;
53+
std::error_code ec(GetLastError(), std::system_category());
54+
return llvm::errorCodeToError(ec);
5555
}
5656
#else
5757
lib = dlopen(path.str().c_str(), RTLD_LAZY | RTLD_LOCAL);
5858
if (!lib) {
59-
return llvm::createStringError(std::errc::not_supported,
60-
"unsupported platform");
59+
return llvm::createStringError(std::error_code(), dlerror());
6160
}
6261
#endif
6362
LoadedPluginLibraries.insert({path, lib});

0 commit comments

Comments
 (0)