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