[tblgen] Disable Leak detection for ASan/GCC and LSan/LLVM

Summary: Add support for sanitizing TableGen.cpp with ASan/GCC and LSan/LLVM.

Reviewers: fjricci, kcc, aaron.ballman, mgorny

Reviewed By: fjricci

Subscribers: jakubjelinek, llvm-commits, #llvm

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67908

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372731 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kamil Rytarowski
2019-09-24 11:22:34 +00:00
parent af87afe0d1
commit 06b4d4865a
+9 -4
View File
@@ -263,11 +263,16 @@ int main(int argc, char **argv) {
return TableGenMain(argv[0], &LLVMTableGenMain);
}
#ifdef __has_feature
#if __has_feature(address_sanitizer)
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) || \
__has_feature(leak_sanitizer)
#include <sanitizer/lsan_interface.h>
// Disable LeakSanitizer for this binary as it has too many leaks that are not
// very interesting to fix. See compiler-rt/include/sanitizer/lsan_interface.h .
LLVM_ATTRIBUTE_USED int __lsan_is_turned_off() { return 1; }
#endif // __has_feature(address_sanitizer)
#endif // defined(__has_feature)
#endif