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

try #128474

Draft
wants to merge 1 commit into
base: users/vitalybuka/spr/main.try-1
Choose a base branch
from
Draft

Conversation

vitalybuka
Copy link
Collaborator

No description provided.

Created using spr 1.3.4
@vitalybuka vitalybuka marked this pull request as draft February 24, 2025 06:52
@llvmbot
Copy link
Member

llvmbot commented Feb 24, 2025

@llvm/pr-subscribers-llvm-support

Author: Vitaly Buka (vitalybuka)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/128474.diff

1 Files Affected:

  • (modified) llvm/lib/Support/Unix/DynamicLibrary.inc (+7-2)
diff --git a/llvm/lib/Support/Unix/DynamicLibrary.inc b/llvm/lib/Support/Unix/DynamicLibrary.inc
index 7452913049ebb..ac254790a6ca4 100644
--- a/llvm/lib/Support/Unix/DynamicLibrary.inc
+++ b/llvm/lib/Support/Unix/DynamicLibrary.inc
@@ -27,8 +27,10 @@ DynamicLibrary::HandleSet::~HandleSet() {
 void *DynamicLibrary::HandleSet::DLOpen(const char *File, std::string *Err) {
   void *Handle = ::dlopen(File, RTLD_LAZY | RTLD_GLOBAL);
   if (!Handle) {
-    if (Err)
+    if (Err) {
       *Err = ::dlerror();
+      ::dlerror();
+    }
     return &DynamicLibrary::Invalid;
   }
 
@@ -45,7 +47,10 @@ void *DynamicLibrary::HandleSet::DLOpen(const char *File, std::string *Err) {
 void DynamicLibrary::HandleSet::DLClose(void *Handle) { ::dlclose(Handle); }
 
 void *DynamicLibrary::HandleSet::DLSym(void *Handle, const char *Symbol) {
-  return ::dlsym(Handle, Symbol);
+  auto* p = ::dlsym(Handle, Symbol);
+  ::dlerror();
+  ::dlerror();
+  return p;
 }
 
 #else // !HAVE_DLOPEN

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 8cfd2db29c5079a02dab713c59cfa8a5674d6ea3 936ef337f1c3cd0b94fd494dcb81e6e09ed0e284 --extensions inc -- llvm/lib/Support/Unix/DynamicLibrary.inc
View the diff from clang-format here.
diff --git a/llvm/lib/Support/Unix/DynamicLibrary.inc b/llvm/lib/Support/Unix/DynamicLibrary.inc
index ac254790a6..56ccb46af5 100644
--- a/llvm/lib/Support/Unix/DynamicLibrary.inc
+++ b/llvm/lib/Support/Unix/DynamicLibrary.inc
@@ -47,7 +47,7 @@ void *DynamicLibrary::HandleSet::DLOpen(const char *File, std::string *Err) {
 void DynamicLibrary::HandleSet::DLClose(void *Handle) { ::dlclose(Handle); }
 
 void *DynamicLibrary::HandleSet::DLSym(void *Handle, const char *Symbol) {
-  auto* p = ::dlsym(Handle, Symbol);
+  auto *p = ::dlsym(Handle, Symbol);
   ::dlerror();
   ::dlerror();
   return p;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants