LLDB mainline
LLDBAssert.h
Go to the documentation of this file.
1//===----------------- LLDBAssert.h ------------------------------*- 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#ifndef LLDB_UTILITY_LLDBASSERT_H
10#define LLDB_UTILITY_LLDBASSERT_H
11
12#ifndef NDEBUG
13#define lldbassert(x) assert(x)
14#else
15#if defined(__clang__)
16// __FILE_NAME__ is a Clang-specific extension that functions similar to
17// __FILE__ but only renders the last path component (the filename) instead of
18// an invocation dependent full path to that file.
19#define lldbassert(x) \
20 lldb_private::lldb_assert(static_cast<bool>(x), #x, __FUNCTION__, \
21 __FILE_NAME__, __LINE__)
22#else
23#define lldbassert(x) \
24 lldb_private::lldb_assert(static_cast<bool>(x), #x, __FUNCTION__, __FILE__, \
25 __LINE__)
26#endif
27#endif
28
29namespace lldb_private {
30void lldb_assert(bool expression, const char *expr_text, const char *func,
31 const char *file, unsigned int line);
32} // namespace lldb_private
33
34#endif // LLDB_UTILITY_LLDBASSERT_H
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
void lldb_assert(bool expression, const char *expr_text, const char *func, const char *file, unsigned int line)
Definition: LLDBAssert.cpp:22