Path: blob/main/contrib/llvm-project/compiler-rt/lib/orc/debug.h
39566 views
//===- debug.h - Debugging output utilities ---------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of the ORC runtime support library.9//10//===----------------------------------------------------------------------===//1112#ifndef ORC_RT_DEBUG_H13#define ORC_RT_DEBUG_H1415#include <atomic>1617#ifndef NDEBUG1819namespace __orc_rt {2021extern std::atomic<const char *> DebugTypes;22extern char DebugTypesAll;23extern char DebugTypesNone;2425const char *initializeDebug();26bool debugTypeEnabled(const char *Type, const char *Types);27void printdbg(const char *format, ...);2829} // namespace __orc_rt3031#define ORC_RT_DEBUG_WITH_TYPE(TYPE, X) \32do { \33const char *Types = \34::__orc_rt::DebugTypes.load(std::memory_order_relaxed); \35if (!Types) \36Types = initializeDebug(); \37if (Types == &DebugTypesNone) \38break; \39if (Types == &DebugTypesAll || \40::__orc_rt::debugTypeEnabled(TYPE, Types)) { \41X; \42} \43} while (false)4445#else4647#define ORC_RT_DEBUG_WITH_TYPE(TYPE, X) \48do { \49} while (false)5051#endif // !NDEBUG5253#define ORC_RT_DEBUG(X) ORC_RT_DEBUG_WITH_TYPE(DEBUG_TYPE, X)5455#endif // ORC_RT_DEBUG_H565758