[tblgen] Disable lsan weak hook when building with msvc

This change is to fix a link time error when building llvm with msvc.

MSVC's implementation does not support weak hook or lsan so this change
disables lsan's weak hook definition.
Only GCC supports LSan.

Tested with visual studio 2019 v16.9.6

Reviewed By: aaron.ballman, rnk

Differential Revision: https://reviews.llvm.org/D118162
This commit is contained in:
Pierre Gousseau 2022-01-28 09:50:41 +00:00
parent 1f08b08674
commit 14e8bedc98
1 changed files with 2 additions and 1 deletions

View File

@ -289,7 +289,8 @@ int main(int argc, char **argv) {
#define __has_feature(x) 0
#endif
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) || \
#if __has_feature(address_sanitizer) || \
(defined(__SANITIZE_ADDRESS__) && defined(__GNUC__)) || \
__has_feature(leak_sanitizer)
#include <sanitizer/lsan_interface.h>