15ffd83dbSDimitry Andric //===-- utilities.h ---------------------------------------------*- C++ -*-===// 25ffd83dbSDimitry Andric // 35ffd83dbSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 45ffd83dbSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 55ffd83dbSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65ffd83dbSDimitry Andric // 75ffd83dbSDimitry Andric //===----------------------------------------------------------------------===// 85ffd83dbSDimitry Andric 9e8d8bef9SDimitry Andric #ifndef GWP_ASAN_UTILITIES_H_ 10e8d8bef9SDimitry Andric #define GWP_ASAN_UTILITIES_H_ 11e8d8bef9SDimitry Andric 125ffd83dbSDimitry Andric #include "gwp_asan/definitions.h" 135ffd83dbSDimitry Andric 145ffd83dbSDimitry Andric #include <stddef.h> 155ffd83dbSDimitry Andric 165ffd83dbSDimitry Andric namespace gwp_asan { 17e8d8bef9SDimitry Andric // Terminates in a platform-specific way with `Message`. 18e8d8bef9SDimitry Andric void die(const char *Message); 19e8d8bef9SDimitry Andric 20e8d8bef9SDimitry Andric // Checks that `Condition` is true, otherwise dies with `Message`. check(bool Condition,const char * Message)21*0fca6ea1SDimitry AndricGWP_ASAN_ALWAYS_INLINE void check(bool Condition, const char *Message) { 22e8d8bef9SDimitry Andric if (Condition) 23e8d8bef9SDimitry Andric return; 24e8d8bef9SDimitry Andric die(Message); 25e8d8bef9SDimitry Andric } 265ffd83dbSDimitry Andric } // namespace gwp_asan 27e8d8bef9SDimitry Andric 28e8d8bef9SDimitry Andric #endif // GWP_ASAN_UTILITIES_H_ 29