| 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 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // This test ensures that we can override any hardening mode with the unchecked mode on a per-TU basis. |
| 10 | |
| 11 | // `check_assertion.h` is only available starting from C++11 and requires Unix headers and regex support. |
| 12 | // REQUIRES: has-unix-headers |
| 13 | // UNSUPPORTED: c++03, no-localization |
| 14 | // ADDITIONAL_COMPILE_FLAGS: -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE |
| 15 | |
| 16 | #include <cassert> |
| 17 | #include "check_assertion.h" |
| 18 | |
| 19 | int main(int, char**) { |
| 20 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire" ); |
| 21 | _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Also should not fire" ); |
| 22 | |
| 23 | return 0; |
| 24 | } |
| 25 | |