[compiler-rt] [Sanitizers] Avoid overload ambiguity for interceptors (PR #100986)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 01:35:15 PDT 2024


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 73c72f2c6505d5bc8b47bb0420f6cba5b24270fe 256149db05b803f22e7baadbccb8c0c097c7ee27 --extensions h -- compiler-rt/lib/interception/interception_linux.h
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/lib/interception/interception_linux.h b/compiler-rt/lib/interception/interception_linux.h
index 2e01ff4457..0f0724419a 100644
--- a/compiler-rt/lib/interception/interception_linux.h
+++ b/compiler-rt/lib/interception/interception_linux.h
@@ -31,20 +31,19 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real,
 // Cast func to type of REAL(func) before casting to uptr in case it is an
 // overloaded function, which is the case for some glibc functions when
 // _FORTIFY_SOURCE is used. This disambiguates which overload to use.
-#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)            \
-  ::__interception::InterceptFunction(                       \
-      #func, (::__interception::uptr *)&REAL(func),          \
-      (::__interception::uptr)(decltype(REAL(func)))&(func), \
-      (::__interception::uptr) &TRAMPOLINE(func))
+#    define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)            \
+      ::__interception::InterceptFunction(                       \
+          #func, (::__interception::uptr *)&REAL(func),          \
+          (::__interception::uptr)(decltype(REAL(func)))&(func), \
+          (::__interception::uptr) & TRAMPOLINE(func))
 
 // dlvsym is a GNU extension supported by some other platforms.
 #if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
-#define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
-  ::__interception::InterceptFunction(                        \
-      #func, symver,                                          \
-      (::__interception::uptr *)&REAL(func),                  \
-      (::__interception::uptr)(decltype(REAL(func)))&(func),  \
-      (::__interception::uptr)&TRAMPOLINE(func))
+#      define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
+        ::__interception::InterceptFunction(                        \
+            #func, symver, (::__interception::uptr *)&REAL(func),   \
+            (::__interception::uptr)(decltype(REAL(func)))&(func),  \
+            (::__interception::uptr) & TRAMPOLINE(func))
 #else
 #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
   INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)

``````````

</details>


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


More information about the llvm-commits mailing list