[llvm] 14e8bed - [tblgen] Disable lsan weak hook when building with msvc

Pierre Gousseau via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 28 02:03:26 PST 2022


Author: Pierre Gousseau
Date: 2022-01-28T10:02:52Z
New Revision: 14e8bedc98071b0c159345b472807c011d7b3f8a

URL: https://github.com/llvm/llvm-project/commit/14e8bedc98071b0c159345b472807c011d7b3f8a
DIFF: https://github.com/llvm/llvm-project/commit/14e8bedc98071b0c159345b472807c011d7b3f8a.diff

LOG: [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

Added: 
    

Modified: 
    llvm/utils/TableGen/TableGen.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/TableGen.cpp b/llvm/utils/TableGen/TableGen.cpp
index 24c11c8bc8313..2d4a45f889be6 100644
--- a/llvm/utils/TableGen/TableGen.cpp
+++ b/llvm/utils/TableGen/TableGen.cpp
@@ -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>


        


More information about the llvm-commits mailing list