WPILibC++ 2023.4.3-108-ge5452e3
Compiler.h File Reference
#include <stddef.h>

Go to the source code of this file.

Macros

#define __has_feature(x)   0
 
#define __has_extension(x)   0
 
#define __has_attribute(x)   0
 
#define __has_builtin(x)   0
 
#define LLVM_HAS_CPP_ATTRIBUTE(x)   0
 
#define LLVM_GNUC_PREREQ(maj, min, patch)   0
 \macro LLVM_GNUC_PREREQ Extend the default __GNUC_PREREQ even if glibc's features.h isn't available. More...
 
#define LLVM_MSC_PREREQ(version)   0
 \macro LLVM_MSC_PREREQ Is the compiler MSVC of at least the specified version? The common More...
 
#define LLVM_HAS_RVALUE_REFERENCE_THIS   1
 Does the compiler support ref-qualifiers for *this? More...
 
#define LLVM_LVALUE_FUNCTION   &
 Expands to '&' if ref-qualifiers for *this are supported. More...
 
#define LLVM_LIBRARY_VISIBILITY
 LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library, then the class should be private to the library and not accessible from outside it. More...
 
#define LLVM_EXTERNAL_VISIBILITY
 
#define LLVM_PREFETCH(addr, rw, locality)
 
#define LLVM_ATTRIBUTE_USED
 
#define LLVM_NODISCARD
 LLVM_NODISCARD - Warn if a type or return value is discarded. More...
 
#define LLVM_ATTRIBUTE_REINITIALIZES
 
#define LLVM_ATTRIBUTE_UNUSED
 
#define LLVM_ATTRIBUTE_WEAK
 
#define LLVM_READNONE
 
#define LLVM_READONLY
 
#define LLVM_ATTRIBUTE_MINSIZE
 
#define LLVM_LIKELY(EXPR)   (EXPR)
 
#define LLVM_UNLIKELY(EXPR)   (EXPR)
 
#define LLVM_ATTRIBUTE_NOINLINE
 LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so, mark a method "not for inlining". More...
 
#define LLVM_ATTRIBUTE_ALWAYS_INLINE   inline
 LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always inline" because it is performance sensitive. More...
 
#define LLVM_ATTRIBUTE_NODEBUG
 LLVM_ATTRIBUTE_NO_DEBUG - On compilers where we have a directive to do so, mark a method "no debug" because debug info makes the debugger experience worse. More...
 
#define LLVM_ATTRIBUTE_RETURNS_NONNULL
 
#define LLVM_ATTRIBUTE_RETURNS_NOALIAS
 \macro LLVM_ATTRIBUTE_RETURNS_NOALIAS Used to mark a function as returning a pointer that does not alias any other valid pointer. More...
 
#define LLVM_FALLTHROUGH
 LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements. More...
 
#define LLVM_REQUIRE_CONSTANT_INITIALIZATION
 LLVM_REQUIRE_CONSTANT_INITIALIZATION - Apply this to globals to ensure that they are constant initialized. More...
 
#define LLVM_GSL_OWNER
 LLVM_GSL_OWNER - Apply this to owning classes like SmallVector to enable lifetime warnings. More...
 
#define LLVM_GSL_POINTER
 LLVM_GSL_POINTER - Apply this to non-owning classes like std::string_view to enable lifetime warnings. More...
 
#define LLVM_EXTENSION
 LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics. More...
 
#define LLVM_ATTRIBUTE_DEPRECATED(decl, message)   [[deprecated(message)]] decl
 
#define LLVM_BUILTIN_UNREACHABLE
 LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands to an expression which states that it is undefined behavior for the compiler to reach this point. More...
 
#define LLVM_BUILTIN_TRAP   *(volatile int*)0x11 = 0
 LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression which causes the program to exit abnormally. More...
 
#define LLVM_BUILTIN_DEBUGTRAP
 LLVM_BUILTIN_DEBUGTRAP - On compilers which support it, expands to an expression which causes the program to break while running under a debugger. More...
 
#define LLVM_ASSUME_ALIGNED(p, a)    (((uintptr_t(p) % (a)) == 0) ? (p) : (LLVM_BUILTIN_UNREACHABLE, (p)))
 \macro LLVM_ASSUME_ALIGNED Returns a pointer with an assumed alignment. More...
 
#define LLVM_PACKED(d)   d __attribute__((packed))
 \macro LLVM_PACKED Used to specify a packed structure. More...
 
#define LLVM_PACKED_START   _Pragma("pack(push, 1)")
 
#define LLVM_PACKED_END   _Pragma("pack(pop)")
 
#define LLVM_PTR_SIZE   sizeof(void *)
 \macro LLVM_PTR_SIZE A constant integer equivalent to the value of sizeof(void*). More...
 
#define LLVM_MEMORY_SANITIZER_BUILD   0
 \macro LLVM_MEMORY_SANITIZER_BUILD Whether LLVM itself is built with MemorySanitizer instrumentation. More...
 
#define __msan_allocated_memory(p, size)
 
#define __msan_unpoison(p, size)
 
#define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE
 
#define LLVM_ADDRESS_SANITIZER_BUILD   0
 \macro LLVM_ADDRESS_SANITIZER_BUILD Whether LLVM itself is built with AddressSanitizer instrumentation. More...
 
#define __asan_poison_memory_region(p, size)
 
#define __asan_unpoison_memory_region(p, size)
 
#define LLVM_THREAD_SANITIZER_BUILD   0
 \macro LLVM_THREAD_SANITIZER_BUILD Whether LLVM itself is built with ThreadSanitizer instrumentation. More...
 
#define TsanHappensBefore(cv)
 
#define TsanHappensAfter(cv)
 
#define TsanIgnoreWritesBegin()
 
#define TsanIgnoreWritesEnd()
 
#define LLVM_NO_SANITIZE(KIND)
 \macro LLVM_NO_SANITIZE Disable a particular sanitizer for a function. More...
 
#define LLVM_DUMP_METHOD   LLVM_ATTRIBUTE_NOINLINE LLVM_ATTRIBUTE_USED
 Mark debug helper function definitions like dump() that should not be stripped from debug builds. More...
 
#define LLVM_PRETTY_FUNCTION   __func__
 \macro LLVM_PRETTY_FUNCTION Gets a user-friendly looking function signature for the current scope using the best available method on each platform. More...
 
#define LLVM_THREAD_LOCAL   __thread
 \macro LLVM_THREAD_LOCAL A thread-local storage specifier which can be used with globals, extern globals, and static globals. More...
 
#define LLVM_NO_PROFILE_INSTRUMENT_FUNCTION
 \macro LLVM_ENABLE_EXCEPTIONS Whether LLVM is built with exception support. More...
 

Macro Definition Documentation

◆ __asan_poison_memory_region

#define __asan_poison_memory_region (   p,
  size 
)

◆ __asan_unpoison_memory_region

#define __asan_unpoison_memory_region (   p,
  size 
)

◆ __has_attribute

#define __has_attribute (   x)    0

◆ __has_builtin

#define __has_builtin (   x)    0

◆ __has_extension

#define __has_extension (   x)    0

◆ __has_feature

#define __has_feature (   x)    0

◆ __msan_allocated_memory

#define __msan_allocated_memory (   p,
  size 
)

◆ __msan_unpoison

#define __msan_unpoison (   p,
  size 
)

◆ LLVM_ADDRESS_SANITIZER_BUILD

#define LLVM_ADDRESS_SANITIZER_BUILD   0

\macro LLVM_ADDRESS_SANITIZER_BUILD Whether LLVM itself is built with AddressSanitizer instrumentation.

◆ LLVM_ASSUME_ALIGNED

#define LLVM_ASSUME_ALIGNED (   p,
 
)     (((uintptr_t(p) % (a)) == 0) ? (p) : (LLVM_BUILTIN_UNREACHABLE, (p)))

\macro LLVM_ASSUME_ALIGNED Returns a pointer with an assumed alignment.

◆ LLVM_ATTRIBUTE_ALWAYS_INLINE

#define LLVM_ATTRIBUTE_ALWAYS_INLINE   inline

LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always inline" because it is performance sensitive.

◆ LLVM_ATTRIBUTE_DEPRECATED

#define LLVM_ATTRIBUTE_DEPRECATED (   decl,
  message 
)    [[deprecated(message)]] decl

◆ LLVM_ATTRIBUTE_MINSIZE

#define LLVM_ATTRIBUTE_MINSIZE

◆ LLVM_ATTRIBUTE_NODEBUG

#define LLVM_ATTRIBUTE_NODEBUG

LLVM_ATTRIBUTE_NO_DEBUG - On compilers where we have a directive to do so, mark a method "no debug" because debug info makes the debugger experience worse.

◆ LLVM_ATTRIBUTE_NOINLINE

#define LLVM_ATTRIBUTE_NOINLINE

LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so, mark a method "not for inlining".

◆ LLVM_ATTRIBUTE_REINITIALIZES

#define LLVM_ATTRIBUTE_REINITIALIZES

◆ LLVM_ATTRIBUTE_RETURNS_NOALIAS

#define LLVM_ATTRIBUTE_RETURNS_NOALIAS

\macro LLVM_ATTRIBUTE_RETURNS_NOALIAS Used to mark a function as returning a pointer that does not alias any other valid pointer.

◆ LLVM_ATTRIBUTE_RETURNS_NONNULL

#define LLVM_ATTRIBUTE_RETURNS_NONNULL

◆ LLVM_ATTRIBUTE_UNUSED

#define LLVM_ATTRIBUTE_UNUSED

◆ LLVM_ATTRIBUTE_USED

#define LLVM_ATTRIBUTE_USED

◆ LLVM_ATTRIBUTE_WEAK

#define LLVM_ATTRIBUTE_WEAK

◆ LLVM_BUILTIN_DEBUGTRAP

#define LLVM_BUILTIN_DEBUGTRAP

LLVM_BUILTIN_DEBUGTRAP - On compilers which support it, expands to an expression which causes the program to break while running under a debugger.

◆ LLVM_BUILTIN_TRAP

#define LLVM_BUILTIN_TRAP   *(volatile int*)0x11 = 0

LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression which causes the program to exit abnormally.

◆ LLVM_BUILTIN_UNREACHABLE

#define LLVM_BUILTIN_UNREACHABLE

LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands to an expression which states that it is undefined behavior for the compiler to reach this point.

Otherwise is not defined.

◆ LLVM_DUMP_METHOD

#define LLVM_DUMP_METHOD   LLVM_ATTRIBUTE_NOINLINE LLVM_ATTRIBUTE_USED

Mark debug helper function definitions like dump() that should not be stripped from debug builds.

Note that you should also surround dump() functions with #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) so they do always get stripped in release builds.

◆ LLVM_EXTENSION

#define LLVM_EXTENSION

LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics.

◆ LLVM_EXTERNAL_VISIBILITY

#define LLVM_EXTERNAL_VISIBILITY

◆ LLVM_FALLTHROUGH

#define LLVM_FALLTHROUGH

LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.

◆ LLVM_GNUC_PREREQ

#define LLVM_GNUC_PREREQ (   maj,
  min,
  patch 
)    0

\macro LLVM_GNUC_PREREQ Extend the default __GNUC_PREREQ even if glibc's features.h isn't available.

◆ LLVM_GSL_OWNER

#define LLVM_GSL_OWNER

LLVM_GSL_OWNER - Apply this to owning classes like SmallVector to enable lifetime warnings.

◆ LLVM_GSL_POINTER

#define LLVM_GSL_POINTER

LLVM_GSL_POINTER - Apply this to non-owning classes like std::string_view to enable lifetime warnings.

◆ LLVM_HAS_CPP_ATTRIBUTE

#define LLVM_HAS_CPP_ATTRIBUTE (   x)    0

◆ LLVM_HAS_RVALUE_REFERENCE_THIS

#define LLVM_HAS_RVALUE_REFERENCE_THIS   1

Does the compiler support ref-qualifiers for *this?

Sadly, this is separate from just rvalue reference support because GCC and MSVC implemented this later than everything else. This appears to be corrected in MSVC 2019 but not MSVC 2017. FIXME: Remove LLVM_HAS_RVALUE_REFERENCE_THIS macro

◆ LLVM_LIBRARY_VISIBILITY

#define LLVM_LIBRARY_VISIBILITY

LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library, then the class should be private to the library and not accessible from outside it.

Can also be used to mark variables and functions, making them private to any shared library they are linked into. On PE/COFF targets, library visibility is the default, so this isn't needed.

LLVM_EXTERNAL_VISIBILITY - classes, functions, and variables marked with this attribute will be made public and visible outside of any shared library they are linked in to.

◆ LLVM_LIKELY

#define LLVM_LIKELY (   EXPR)    (EXPR)

◆ LLVM_LVALUE_FUNCTION

#define LLVM_LVALUE_FUNCTION   &

Expands to '&' if ref-qualifiers for *this are supported.

This can be used to provide lvalue/rvalue overrides of member functions. The rvalue override should be guarded by LLVM_HAS_RVALUE_REFERENCE_THIS

◆ LLVM_MEMORY_SANITIZER_BUILD

#define LLVM_MEMORY_SANITIZER_BUILD   0

\macro LLVM_MEMORY_SANITIZER_BUILD Whether LLVM itself is built with MemorySanitizer instrumentation.

◆ LLVM_MSC_PREREQ

#define LLVM_MSC_PREREQ (   version)    0

\macro LLVM_MSC_PREREQ Is the compiler MSVC of at least the specified version? The common

Parameters
versionvalues to check for are:
  • 1910: VS2017, version 15.1 & 15.2
  • 1911: VS2017, version 15.3 & 15.4
  • 1912: VS2017, version 15.5
  • 1913: VS2017, version 15.6
  • 1914: VS2017, version 15.7
  • 1915: VS2017, version 15.8
  • 1916: VS2017, version 15.9
  • 1920: VS2019, version 16.0
  • 1921: VS2019, version 16.1
  • 1922: VS2019, version 16.2
  • 1923: VS2019, version 16.3
  • 1924: VS2019, version 16.4
  • 1925: VS2019, version 16.5
  • 1926: VS2019, version 16.6
  • 1927: VS2019, version 16.7
  • 1928: VS2019, version 16.8 + 16.9
  • 1929: VS2019, version 16.10 + 16.11
  • 1930: VS2022, version 17.0

◆ LLVM_NO_PROFILE_INSTRUMENT_FUNCTION

#define LLVM_NO_PROFILE_INSTRUMENT_FUNCTION

\macro LLVM_ENABLE_EXCEPTIONS Whether LLVM is built with exception support.

\macro LLVM_NO_PROFILE_INSTRUMENT_FUNCTION Disable the profile instrument for a function.

◆ LLVM_NO_SANITIZE

#define LLVM_NO_SANITIZE (   KIND)

\macro LLVM_NO_SANITIZE Disable a particular sanitizer for a function.

◆ LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE

#define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE

◆ LLVM_NODISCARD

#define LLVM_NODISCARD

LLVM_NODISCARD - Warn if a type or return value is discarded.

◆ LLVM_PACKED

#define LLVM_PACKED (   d)    d __attribute__((packed))

\macro LLVM_PACKED Used to specify a packed structure.

LLVM_PACKED( struct A { int i; int j; int k; long long l; });

LLVM_PACKED_START struct B { int i; int j; int k; long long l; }; LLVM_PACKED_END

◆ LLVM_PACKED_END

#define LLVM_PACKED_END   _Pragma("pack(pop)")

◆ LLVM_PACKED_START

#define LLVM_PACKED_START   _Pragma("pack(push, 1)")

◆ LLVM_PREFETCH

#define LLVM_PREFETCH (   addr,
  rw,
  locality 
)

◆ LLVM_PRETTY_FUNCTION

#define LLVM_PRETTY_FUNCTION   __func__

\macro LLVM_PRETTY_FUNCTION Gets a user-friendly looking function signature for the current scope using the best available method on each platform.

The exact format of the resulting string is implementation specific and non-portable, so this should only be used, for example, for logging or diagnostics.

◆ LLVM_PTR_SIZE

#define LLVM_PTR_SIZE   sizeof(void *)

\macro LLVM_PTR_SIZE A constant integer equivalent to the value of sizeof(void*).

Generally used in combination with alignas or when doing computation in the preprocessor.

◆ LLVM_READNONE

#define LLVM_READNONE

◆ LLVM_READONLY

#define LLVM_READONLY

◆ LLVM_REQUIRE_CONSTANT_INITIALIZATION

#define LLVM_REQUIRE_CONSTANT_INITIALIZATION

LLVM_REQUIRE_CONSTANT_INITIALIZATION - Apply this to globals to ensure that they are constant initialized.

◆ LLVM_THREAD_LOCAL

#define LLVM_THREAD_LOCAL   __thread

\macro LLVM_THREAD_LOCAL A thread-local storage specifier which can be used with globals, extern globals, and static globals.

This is essentially an extremely restricted analog to C++11's thread_local support. It uses thread_local if available, falling back on gcc __thread if not. __thread doesn't support many of the C++11 thread_local's features. You should only use this for PODs that you can statically initialize to some constant value. In almost all circumstances this is most appropriate for use with a pointer, integer, or small aggregation of pointers and integers.

◆ LLVM_THREAD_SANITIZER_BUILD

#define LLVM_THREAD_SANITIZER_BUILD   0

\macro LLVM_THREAD_SANITIZER_BUILD Whether LLVM itself is built with ThreadSanitizer instrumentation.

◆ LLVM_UNLIKELY

#define LLVM_UNLIKELY (   EXPR)    (EXPR)

◆ TsanHappensAfter

#define TsanHappensAfter (   cv)

◆ TsanHappensBefore

#define TsanHappensBefore (   cv)

◆ TsanIgnoreWritesBegin

#define TsanIgnoreWritesBegin ( )

◆ TsanIgnoreWritesEnd

#define TsanIgnoreWritesEnd ( )