[compiler-rt] d1538c1 - Revert fuzzer windows changes (#83551)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 02:32:15 PST 2024


Author: David CARLIER
Date: 2024-03-01T10:32:10Z
New Revision: d1538c15f9c65a70f4650bd724972536f00f5094

URL: https://github.com/llvm/llvm-project/commit/d1538c15f9c65a70f4650bd724972536f00f5094
DIFF: https://github.com/llvm/llvm-project/commit/d1538c15f9c65a70f4650bd724972536f00f5094.diff

LOG: Revert fuzzer windows changes (#83551)

Added: 
    

Modified: 
    compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index 39ab9e241b59148..71770166805f782 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
@@ -21,15 +21,10 @@
 #include <signal.h>
 #include <stdio.h>
 #include <sys/types.h>
-// clang-format off
 #include <windows.h>
-// These must be included after windows.h.
-// archicture need to be set before including
-// libloaderapi
-#include <libloaderapi.h>
-#include <stringapiset.h>
+
+// This must be included after windows.h.
 #include <psapi.h>
-// clang-format on
 
 namespace fuzzer {
 
@@ -239,20 +234,8 @@ size_t PageSize() {
 }
 
 void SetThreadName(std::thread &thread, const std::string &name) {
-  typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
-  HMODULE kbase = GetModuleHandleA("KernelBase.dll");
-  proc ThreadNameProc =
-      reinterpret_cast<proc>(GetProcAddress, "SetThreadDescription");
-  if (proc) {
-    std::wstring buf;
-    auto sz = MultiByteToWideChar(CP_UTF8, 0, name.data(), -1, nullptr, 0);
-    if (sz > 0) {
-      buf.resize(sz);
-      if (MultyByteToWideChar(CP_UTF8, 0, name.data(), -1, &buf[0], sz) > 0) {
-        (void)ThreadNameProc(thread.native_handle(), buf.c_str());
-      }
-    }
-  }
+  // TODO ?
+  // to UTF-8 then SetThreadDescription ?
 }
 
 } // namespace fuzzer


        


More information about the llvm-commits mailing list