diff options
| author | Kostya Serebryany <kcc@google.com> | 2013-01-22 06:39:20 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2013-01-22 06:39:20 +0000 |
| commit | 4184b64094e119aef139a56532223022a8ca24fe (patch) | |
| tree | 325bec67a3e4badc40d85e12f3ada63c993b9789 /compiler-rt/lib/asan/tests/asan_test_utils.h | |
| parent | be39b10ee1047ffb4eacde30d79b1fa614c5d550 (diff) | |
| download | bcm5719-llvm-4184b64094e119aef139a56532223022a8ca24fe.tar.gz bcm5719-llvm-4184b64094e119aef139a56532223022a8ca24fe.zip | |
[asan] split asan_test.cc to speedup parallel build (most important if building with a debug clang, which takes a couple of minutes on this large file with templates). More splits to follow
llvm-svn: 173129
Diffstat (limited to 'compiler-rt/lib/asan/tests/asan_test_utils.h')
| -rw-r--r-- | compiler-rt/lib/asan/tests/asan_test_utils.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/tests/asan_test_utils.h b/compiler-rt/lib/asan/tests/asan_test_utils.h index 6ed9f90df90..d10c1cc2cc8 100644 --- a/compiler-rt/lib/asan/tests/asan_test_utils.h +++ b/compiler-rt/lib/asan/tests/asan_test_utils.h @@ -21,9 +21,59 @@ #endif #include "sanitizer_common/tests/sanitizer_test_utils.h" +#include <stdio.h> +#include <signal.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <pthread.h> +#include <stdint.h> +#include <setjmp.h> +#include <assert.h> +#include <algorithm> +#include <sys/mman.h> + +#ifdef __linux__ +# include <sys/prctl.h> +# include <sys/types.h> +# include <sys/stat.h> +# include <fcntl.h> +#include <unistd.h> +#endif + +#if defined(__i386__) || defined(__x86_64__) +#include <emmintrin.h> +#endif + +#ifndef __APPLE__ +#include <malloc.h> +#endif // Check that pthread_create/pthread_join return success. #define PTHREAD_CREATE(a, b, c, d) ASSERT_EQ(0, pthread_create(a, b, c, d)) #define PTHREAD_JOIN(a, b) ASSERT_EQ(0, pthread_join(a, b)) +#if ASAN_HAS_EXCEPTIONS +# define ASAN_THROW(x) throw (x) +#else +# define ASAN_THROW(x) +#endif + +typedef uint8_t U1; +typedef uint16_t U2; +typedef uint32_t U4; +typedef uint64_t U8; + +static const int kPageSize = 4096; + +const size_t kLargeMalloc = 1 << 24; + +extern void free_aaa(void *p); +extern void *malloc_aaa(size_t size); + +template<typename T> +NOINLINE void asan_write(T *a) { + *a = 0; +} + #endif // ASAN_TEST_UTILS_H |

