| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_SHARED_ASAN_HELPER_H_ | 5 #ifndef SRC_SHARED_ASAN_HELPER_H_ |
| 6 #define SRC_SHARED_ASAN_HELPER_H_ | 6 #define SRC_SHARED_ASAN_HELPER_H_ |
| 7 | 7 |
| 8 #if defined(__has_feature) | 8 #if defined(__has_feature) |
| 9 #if __has_feature(address_sanitizer) | 9 #if __has_feature(address_sanitizer) |
| 10 | 10 |
| 11 #include <sanitizer/lsan_interface.h> | 11 #include <sanitizer/lsan_interface.h> |
| 12 | 12 |
| 13 #define ADDRESS_SANITIZER_SUPPORT | 13 #define ADDRESS_SANITIZER_SUPPORT |
| 14 | 14 |
| 15 #if defined(FLETCH_ASAN) && defined(FLETCH_CLANG) | 15 #if defined(DARTINO_ASAN) && defined(DARTINO_CLANG) |
| 16 #define USING_ADDRESS_SANITIZER | 16 #define USING_ADDRESS_SANITIZER |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 // NOTE: We don't have defines for the host/target operating system, but the | 19 // NOTE: We don't have defines for the host/target operating system, but the |
| 20 // leak sanitizer seems to be only enabled on Linux 64-bit. | 20 // leak sanitizer seems to be only enabled on Linux 64-bit. |
| 21 // Since we can't distinguish between MacOS/Linux, we use PROBABLY_* | 21 // Since we can't distinguish between MacOS/Linux, we use PROBABLY_* |
| 22 #if defined(FLETCH_ASAN) && defined(FLETCH_CLANG) && defined(FLETCH_TARGET_X64) | 22 #if defined(DARTINO_ASAN) && defined(DARTINO_CLANG) && \ |
| 23 defined(DARTINO_TARGET_X64) |
| 23 #define PROBABLY_USING_LEAK_SANITIZER | 24 #define PROBABLY_USING_LEAK_SANITIZER |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 #endif // __has_feature(address_sanitizer) | 27 #endif // __has_feature(address_sanitizer) |
| 27 #endif // defined(__has_feature) | 28 #endif // defined(__has_feature) |
| 28 | 29 |
| 29 #if defined(FLETCH_ASAN) && defined(FLETCH_CLANG) && \ | 30 #if defined(DARTINO_ASAN) && defined(DARTINO_CLANG) && \ |
| 30 defined(FLETCH_TARGET_X64) && !defined(USING_ADDRESS_SANITIZER) | 31 defined(DARTINO_TARGET_X64) && !defined(USING_ADDRESS_SANITIZER) |
| 31 #error "Expected to use ASAN in asan-clang-x64 configuration." | 32 #error "Expected to use ASAN in asan-clang-x64 configuration." |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 #endif // SRC_SHARED_ASAN_HELPER_H_ | 35 #endif // SRC_SHARED_ASAN_HELPER_H_ |
| OLD | NEW |