utilities.h 841 B

12345678910111213141516171819202122232425262728
  1. //===-- utilities.h ---------------------------------------------*- C++ -*-===//
  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. #ifndef GWP_ASAN_UTILITIES_H_
  9. #define GWP_ASAN_UTILITIES_H_
  10. #include "gwp_asan/definitions.h"
  11. #include <stddef.h>
  12. namespace gwp_asan {
  13. // Terminates in a platform-specific way with `Message`.
  14. void die(const char *Message);
  15. // Checks that `Condition` is true, otherwise dies with `Message`.
  16. GWP_ASAN_ALWAYS_INLINE void Check(bool Condition, const char *Message) {
  17. if (Condition)
  18. return;
  19. die(Message);
  20. }
  21. } // namespace gwp_asan
  22. #endif // GWP_ASAN_UTILITIES_H_