1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 #define ASAN_TESTING_H
12 #include "test_macros.h"
14 #if TEST_HAS_FEATURE(address_sanitizer)
15 extern "C" int __sanitizer_verify_contiguous_container
16 ( const void *beg
, const void *mid
, const void *end
);
18 template <typename T
, typename Alloc
>
19 bool is_contiguous_container_asan_correct ( const std::vector
<T
, Alloc
> &c
)
21 if ( std::is_same
<Alloc
, std::allocator
<T
> >::value
&& c
.data() != NULL
)
22 return __sanitizer_verify_contiguous_container (
23 c
.data(), c
.data() + c
.size(), c
.data() + c
.capacity()) != 0;
28 template <typename T
, typename Alloc
>
29 bool is_contiguous_container_asan_correct ( const std::vector
<T
, Alloc
> &)
36 #endif // ASAN_TESTING_H