1//===--- Debug.cpp -------- 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// This file contains debug utilities
10//
11//===----------------------------------------------------------------------===//
12
13#include "Shared/Environment.h"
14
15#include "Configuration.h"
16#include "Debug.h"
17#include "Interface.h"
18#include "Mapping.h"
19#include "State.h"
20#include "Types.h"
21
22using namespace ompx;
23
24#pragma omp begin declare target device_type(nohost)
25
26extern "C" {
27void __assert_assume(bool condition) { __builtin_assume(condition); }
28
29void __assert_fail(const char *expr, const char *file, unsigned line,
30 const char *function) {
31 __assert_fail_internal(expr, nullptr, file, line, function);
32}
33void __assert_fail_internal(const char *expr, const char *msg, const char *file,
34 unsigned line, const char *function) {
35 if (msg) {
36 PRINTF("%s:%u: %s: Assertion %s (`%s`) failed.\n", file, line, function,
37 msg, expr);
38 } else {
39 PRINTF("%s:%u: %s: Assertion `%s` failed.\n", file, line, function, expr);
40 }
41 __builtin_trap();
42}
43}
44
45#pragma omp end declare target
46

source code of offload/DeviceRTL/src/Debug.cpp