[LICM] allow MemoryAccess creation failure (#116813)
[llvm-project.git] / libc / include / __llvm-libc-common.h
blobe0e29bbbd5f87c8a56435a799ef0f419bc58e8a5
1 //===-- Common definitions for LLVM-libc public header files --------------===//
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_COMMON_H
10 #define LLVM_LIBC_COMMON_H
12 #ifdef __cplusplus
14 #undef __BEGIN_C_DECLS
15 #define __BEGIN_C_DECLS extern "C" {
17 #undef __END_C_DECLS
18 #define __END_C_DECLS }
20 // Standard C++ doesn't have C99 restrict but GNU C++ has it with __ spelling.
21 #undef __restrict
22 #ifndef __GNUC__
23 #define __restrict
24 #endif
26 #undef _Noreturn
27 #define _Noreturn [[noreturn]]
29 #undef _Alignas
30 #define _Alignas alignas
32 #undef _Static_assert
33 #define _Static_assert static_assert
35 #undef _Alignof
36 #define _Alignof alignof
38 #undef _Thread_local
39 #define _Thread_local thread_local
41 #undef __NOEXCEPT
42 #define __NOEXCEPT noexcept
44 #else // not __cplusplus
46 #undef __BEGIN_C_DECLS
47 #define __BEGIN_C_DECLS
49 #undef __END_C_DECLS
50 #define __END_C_DECLS
52 #undef __restrict
53 #define __restrict restrict // C99 and above support the restrict keyword.
55 #undef __NOEXCEPT
56 #define __NOEXCEPT
58 #endif // __cplusplus
60 #endif // LLVM_LIBC_COMMON_H