[PATCH] D28596: [compiler-rt] General definition for weak functions.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 13:52:39 PST 2017


mpividori added inline comments.


================
Comment at: lib/asan/asan_allocator.cc:961
 // Provide default (no-op) implementation of malloc hooks.
-extern "C" {
-SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
-void __sanitizer_malloc_hook(void *ptr, uptr size) {
+WEAK_DEF(void, __sanitizer_malloc_hook, void *ptr, uptr size) {
   (void)ptr;
----------------
alekseyshl wrote:
> Since all we have now is this macro, can we be a bit more explicit about the fact that it's an interface function?
> SANITIZER_INTERFACE_WEAK_DEF, for example?
@alekseyshl Ok, I agree. I will change the macro.


================
Comment at: lib/sanitizer_common/sanitizer_internal_defs.h:17
 #include "sanitizer_platform.h"
+#include "sanitizer_win_defs.h"
 
----------------
alekseyshl wrote:
> It does not feel right, unconditionally including win specific header in the generic module. I realize that within sanitizer_win_defs.h there is a #if SANITIZER_WINDOWS guard, but still. Can you move it into #if SANITIZER_WINDOWS block, where it is actually needed?
@alekseyshl  Ok I can change that, but in https://reviews.llvm.org/D28525  they suggested that I simply include the header and only use `#ifdef SANITIZER_WINDOWS` inside the header, to simplify the code. Whatever you prefer is ok for me.


https://reviews.llvm.org/D28596





More information about the llvm-commits mailing list