[compiler-rt] [sanitizer_common][nfc] Rename `tid_t` to avoid conflicting duplicate declarations (PR #149011)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 20:07:09 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- compiler-rt/lib/asan/asan_thread.cpp compiler-rt/lib/asan/asan_thread.h compiler-rt/lib/hwasan/hwasan_thread.cpp compiler-rt/lib/hwasan/hwasan_thread.h compiler-rt/lib/lsan/lsan_common.cpp compiler-rt/lib/lsan/lsan_common.h compiler-rt/lib/lsan/lsan_interceptors.cpp compiler-rt/lib/lsan/lsan_posix.cpp compiler-rt/lib/lsan/lsan_posix.h compiler-rt/lib/lsan/lsan_thread.cpp compiler-rt/lib/lsan/lsan_thread.h compiler-rt/lib/memprof/memprof_thread.cpp compiler-rt/lib/memprof/memprof_thread.h compiler-rt/lib/sanitizer_common/sanitizer_common.h compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp compiler-rt/lib/sanitizer_common/sanitizer_haiku.cpp compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp compiler-rt/lib/sanitizer_common/sanitizer_linux.h compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cpp compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld.h compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_win.cpp compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cpp compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h compiler-rt/lib/sanitizer_common/sanitizer_win.cpp compiler-rt/lib/sanitizer_common/tests/sanitizer_linux_test.cpp compiler-rt/lib/tsan/rtl/tsan_debugging.cpp compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp compiler-rt/lib/tsan/rtl/tsan_interface.h compiler-rt/lib/tsan/rtl/tsan_report.h compiler-rt/lib/tsan/rtl/tsan_rtl.h compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp compiler-rt/lib/xray/xray_fdr_controller.h compiler-rt/lib/xray/xray_profile_collector.cpp compiler-rt/lib/xray/xray_profile_collector.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp b/compiler-rt/lib/lsan/lsan_interceptors.cpp
index 0aa2e4a70..d97f64edd 100644
--- a/compiler-rt/lib/lsan/lsan_interceptors.cpp
+++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp
@@ -390,7 +390,7 @@ INTERCEPTOR(void, thr_exit, thid_t *state) {
   ThreadFinish();
   REAL(thr_exit)(state);
 }
-#define LSAN_MAYBE_INTERCEPT_THR_EXIT INTERCEPT_FUNCTION(thr_exit)
+#  define LSAN_MAYBE_INTERCEPT_THR_EXIT INTERCEPT_FUNCTION(thr_exit)
 #else
 #define LSAN_MAYBE_INTERCEPT_THR_EXIT
 #endif
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
index 19f8bfa45..1759debd9 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
@@ -108,9 +108,7 @@ int internal_dlinfo(void *handle, int request, void *p) {
 
 // In contrast to POSIX, on Windows GetCurrentThreadId()
 // returns a system-unique identifier.
-thid_t GetTid() {
-  return GetCurrentThreadId();
-}
+thid_t GetTid() { return GetCurrentThreadId(); }
 
 uptr GetThreadSelf() {
   return GetTid();
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index d53f9ad8a..bc36048e2 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -2893,7 +2893,7 @@ TSAN_INTERCEPTOR(void, thr_exit, thid_t *state) {
   DestroyThreadState();
   REAL(thr_exit(state));
 }
-#define TSAN_MAYBE_INTERCEPT_THR_EXIT TSAN_INTERCEPT(thr_exit)
+#  define TSAN_MAYBE_INTERCEPT_THR_EXIT TSAN_INTERCEPT(thr_exit)
 #else
 #define TSAN_MAYBE_INTERCEPT_THR_EXIT
 #endif

``````````

</details>


https://github.com/llvm/llvm-project/pull/149011


More information about the llvm-commits mailing list