[PATCH] D118162: [tblgen] Disable lsan weak hook when building with msvc

pierre gousseau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 27 04:17:53 PST 2022


pgousseau added inline comments.


================
Comment at: llvm/utils/TableGen/TableGen.cpp:293
+#if __has_feature(address_sanitizer) ||                                        \
+    (defined(__SANITIZE_ADDRESS__) && !defined(_WIN32)) ||                     \
     __has_feature(leak_sanitizer)
----------------
rnk wrote:
> It seems to me that neither GCC nor MSVC support __has_feature, but they both set `__SANITIZE_ADDRESS__`. Only GCC supports LSan. I would prefer to phrase this positively: if we are using GCC ASan, set up this LSan hook. So, I prefer the condition `(defined(__SANITIZE_ADDRESS__) && defined(__GNUC__))`. I don't know if GCC supports ASan/LSan on Windows as part of mingw, but I don't see any reason to rule it out. If we just want to opt MSVC out and use LSan with any other hypothetical non-gnu, non-MSVC compiler, we could spell this `!defined(_MSC_VER)`.
Thanks yes `!_WIN32` was wrong, I have updated to use `__GNUC__`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118162/new/

https://reviews.llvm.org/D118162



More information about the llvm-commits mailing list