Bump version to 19.1.0-rc3
[llvm-project.git] / offload / DeviceRTL / src / Debug.cpp
blob4e16591cc6c5108413cb4de304edc258fe9cdff4
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
11 //===----------------------------------------------------------------------===//
13 #include "Shared/Environment.h"
15 #include "Configuration.h"
16 #include "Debug.h"
17 #include "Interface.h"
18 #include "Mapping.h"
19 #include "State.h"
20 #include "Types.h"
22 using namespace ompx;
24 #pragma omp begin declare target device_type(nohost)
26 extern "C" {
27 void __assert_assume(bool condition) { __builtin_assume(condition); }
29 [[gnu::weak]] void __assert_fail(const char *expr, const char *file,
30 unsigned line, const char *function) {
31 __assert_fail_internal(expr, nullptr, file, line, function);
33 void __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);
41 __builtin_trap();
45 #pragma omp end declare target