[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / support / asan_testing.h
blob6171d0beebb3ee9ea1d6a41b20b72d1a2826eec1
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef ASAN_TESTING_H
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;
24 return true;
27 #else
28 template <typename T, typename Alloc>
29 bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &)
31 return true;
33 #endif
36 #endif // ASAN_TESTING_H