brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 98d0fa4 Raw
45 lines · c
1//===-------- Debug.h ---- Debug utilities ------------------------ 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-exception6//7//===----------------------------------------------------------------------===//8//9//10//===----------------------------------------------------------------------===//11 12#ifndef OMPTARGET_DEVICERTL_DEBUG_H13#define OMPTARGET_DEVICERTL_DEBUG_H14 15#include "Configuration.h"16#include "LibC.h"17 18/// Assertion19///20/// {21extern "C" {22void __assert_assume(bool condition);23void __assert_fail(const char *expr, const char *file, unsigned line,24                   const char *function);25void __assert_fail_internal(const char *expr, const char *msg, const char *file,26                            unsigned line, const char *function);27}28 29#define ASSERT(expr, msg)                                                      \30  {                                                                            \31    if (config::isDebugMode(DeviceDebugKind::Assertion) && !(expr))            \32      __assert_fail_internal(#expr, msg, __FILE__, __LINE__,                   \33                             __PRETTY_FUNCTION__);                             \34    else                                                                       \35      __assert_assume(expr);                                                   \36  }37#define UNREACHABLE(msg)                                                       \38  printf(msg);                                                                 \39  __builtin_trap();                                                            \40  __builtin_unreachable();41 42///}43 44#endif45