[NFC][opt] Improve help message (#97805)
[llvm-project.git] / offload / DeviceRTL / include / Debug.h
blob22998f44a5bea5d36d41ebdc6babf313f69504bb
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 //
10 //===----------------------------------------------------------------------===//
12 #ifndef OMPTARGET_DEVICERTL_DEBUG_H
13 #define OMPTARGET_DEVICERTL_DEBUG_H
15 #include "Configuration.h"
16 #include "LibC.h"
18 /// Assertion
19 ///
20 /// {
21 extern "C" {
22 void __assert_assume(bool condition);
23 void __assert_fail(const char *expr, const char *file, unsigned line,
24 const char *function);
25 void __assert_fail_internal(const char *expr, const char *msg, const char *file,
26 unsigned line, const char *function);
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); \
37 #define UNREACHABLE(msg) \
38 PRINT(msg); \
39 __builtin_trap(); \
40 __builtin_unreachable();
42 ///}
44 #define PRINTF(fmt, ...) (void)printf(fmt, ##__VA_ARGS__);
45 #define PRINT(str) PRINTF("%s", str)
47 ///}
49 #endif