WPILibC++ 2024.3.2
Compiler.h
Go to the documentation of this file.
1//===-- llvm/Support/Compiler.h - Compiler abstraction support --*- 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 defines several macros, based on the current compiler. This allows
10// use of compiler-specific features in a way that remains portable. This header
11// can be included from either C or C++.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef WPIUTIL_WPI_COMPILER_H
16#define WPIUTIL_WPI_COMPILER_H
17
18
19#include <stddef.h>
20
21#if defined(_MSC_VER)
22#include <sal.h>
23#endif
24
25#ifndef __has_feature
26# define __has_feature(x) 0
27#endif
28
29#ifndef __has_extension
30# define __has_extension(x) 0
31#endif
32
33#ifndef __has_attribute
34# define __has_attribute(x) 0
35#endif
36
37#ifndef __has_builtin
38# define __has_builtin(x) 0
39#endif
40
41#ifndef __has_include
42# define __has_include(x) 0
43#endif
44
45// Only use __has_cpp_attribute in C++ mode. GCC defines __has_cpp_attribute in
46// C mode, but the :: in __has_cpp_attribute(scoped::attribute) is invalid.
47#ifndef LLVM_HAS_CPP_ATTRIBUTE
48#if defined(__cplusplus) && defined(__has_cpp_attribute)
49# define LLVM_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
50#else
51# define LLVM_HAS_CPP_ATTRIBUTE(x) 0
52#endif
53#endif
54
55/// \macro LLVM_GNUC_PREREQ
56/// Extend the default __GNUC_PREREQ even if glibc's features.h isn't
57/// available.
58#ifndef LLVM_GNUC_PREREQ
59# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
60# define LLVM_GNUC_PREREQ(maj, min, patch) \
61 ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >= \
62 ((maj) << 20) + ((min) << 10) + (patch))
63# elif defined(__GNUC__) && defined(__GNUC_MINOR__)
64# define LLVM_GNUC_PREREQ(maj, min, patch) \
65 ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10))
66# else
67# define LLVM_GNUC_PREREQ(maj, min, patch) 0
68# endif
69#endif
70
71/// \macro LLVM_MSC_PREREQ
72/// Is the compiler MSVC of at least the specified version?
73/// The common \param version values to check for are:
74/// * 1910: VS2017, version 15.1 & 15.2
75/// * 1911: VS2017, version 15.3 & 15.4
76/// * 1912: VS2017, version 15.5
77/// * 1913: VS2017, version 15.6
78/// * 1914: VS2017, version 15.7
79/// * 1915: VS2017, version 15.8
80/// * 1916: VS2017, version 15.9
81/// * 1920: VS2019, version 16.0
82/// * 1921: VS2019, version 16.1
83/// * 1922: VS2019, version 16.2
84/// * 1923: VS2019, version 16.3
85/// * 1924: VS2019, version 16.4
86/// * 1925: VS2019, version 16.5
87/// * 1926: VS2019, version 16.6
88/// * 1927: VS2019, version 16.7
89/// * 1928: VS2019, version 16.8 + 16.9
90/// * 1929: VS2019, version 16.10 + 16.11
91/// * 1930: VS2022, version 17.0
92#ifndef LLVM_MSC_PREREQ
93#ifdef _MSC_VER
94#define LLVM_MSC_PREREQ(version) (_MSC_VER >= (version))
95
96// We require at least VS 2019.
97#if !defined(LLVM_FORCE_USE_OLD_TOOLCHAIN)
98#if !LLVM_MSC_PREREQ(1920)
99#error LLVM requires at least VS 2019.
100#endif
101#endif
102
103#else
104#define LLVM_MSC_PREREQ(version) 0
105#endif
106#endif
107
108/// LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked
109/// into a shared library, then the class should be private to the library and
110/// not accessible from outside it. Can also be used to mark variables and
111/// functions, making them private to any shared library they are linked into.
112/// On PE/COFF targets, library visibility is the default, so this isn't needed.
113///
114/// LLVM_EXTERNAL_VISIBILITY - classes, functions, and variables marked with
115/// this attribute will be made public and visible outside of any shared library
116/// they are linked in to.
117
118#if LLVM_HAS_CPP_ATTRIBUTE(gnu::visibility)
119#define LLVM_ATTRIBUTE_VISIBILITY_HIDDEN [[gnu::visibility("hidden")]]
120#define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT [[gnu::visibility("default")]]
121#elif __has_attribute(visibility)
122#define LLVM_ATTRIBUTE_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
123#define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT __attribute__((visibility("default")))
124#else
125#define LLVM_ATTRIBUTE_VISIBILITY_HIDDEN
126#define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
127#endif
128
129
130#if (!(defined(_WIN32) || defined(__CYGWIN__)) || \
131 (defined(__MINGW32__) && defined(__clang__)))
132#define LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_HIDDEN
133#if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
134#define LLVM_EXTERNAL_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
135#else
136#define LLVM_EXTERNAL_VISIBILITY
137#endif
138#else
139#define LLVM_LIBRARY_VISIBILITY
140#define LLVM_EXTERNAL_VISIBILITY
141#endif
142
143#ifndef LLVM_PREFETCH
144#if defined(__GNUC__)
145#define LLVM_PREFETCH(addr, rw, locality) __builtin_prefetch(addr, rw, locality)
146#else
147#define LLVM_PREFETCH(addr, rw, locality)
148#endif
149#endif
150
151#ifndef LLVM_ATTRIBUTE_USED
152#if __has_attribute(used)
153#define LLVM_ATTRIBUTE_USED __attribute__((__used__))
154#else
155#define LLVM_ATTRIBUTE_USED
156#endif
157#endif
158
159#if defined(__clang__)
160#define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
161#else
162#define LLVM_DEPRECATED(MSG, FIX) [[deprecated(MSG)]]
163#endif
164
165// Indicate that a non-static, non-const C++ member function reinitializes
166// the entire object to a known state, independent of the previous state of
167// the object.
168//
169// The clang-tidy check bugprone-use-after-move recognizes this attribute as a
170// marker that a moved-from object has left the indeterminate state and can be
171// reused.
172#if LLVM_HAS_CPP_ATTRIBUTE(clang::reinitializes)
173#define LLVM_ATTRIBUTE_REINITIALIZES [[clang::reinitializes]]
174#else
175#define LLVM_ATTRIBUTE_REINITIALIZES
176#endif
177
178// Some compilers warn about unused functions. When a function is sometimes
179// used or not depending on build settings (e.g. a function only called from
180// within "assert"), this attribute can be used to suppress such warnings.
181//
182// However, it shouldn't be used for unused *variables*, as those have a much
183// more portable solution:
184// (void)unused_var_name;
185// Prefer cast-to-void wherever it is sufficient.
186#ifndef LLVM_ATTRIBUTE_UNUSED
187#if __has_attribute(unused)
188#define LLVM_ATTRIBUTE_UNUSED __attribute__((__unused__))
189#else
190#define LLVM_ATTRIBUTE_UNUSED
191#endif
192#endif
193
194// FIXME: Provide this for PE/COFF targets.
195#if __has_attribute(weak) && !defined(__MINGW32__) && !defined(__CYGWIN__) && \
196 !defined(_WIN32)
197#define LLVM_ATTRIBUTE_WEAK __attribute__((__weak__))
198#else
199#define LLVM_ATTRIBUTE_WEAK
200#endif
201
202#ifndef LLVM_READNONE
203// Prior to clang 3.2, clang did not accept any spelling of
204// __has_attribute(const), so assume it is supported.
205#if defined(__clang__) || defined(__GNUC__)
206// aka 'CONST' but following LLVM Conventions.
207#define LLVM_READNONE __attribute__((__const__))
208#else
209#define LLVM_READNONE
210#endif
211#endif
212
213#ifndef LLVM_READONLY
214#if __has_attribute(pure) || defined(__GNUC__)
215// aka 'PURE' but following LLVM Conventions.
216#define LLVM_READONLY __attribute__((__pure__))
217#else
218#define LLVM_READONLY
219#endif
220#endif
221
222#if __has_attribute(minsize)
223#define LLVM_ATTRIBUTE_MINSIZE __attribute__((minsize))
224#else
225#define LLVM_ATTRIBUTE_MINSIZE
226#endif
227
228#ifndef LLVM_LIKELY
229#if __has_builtin(__builtin_expect) || defined(__GNUC__)
230#define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true)
231#define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false)
232#else
233#define LLVM_LIKELY(EXPR) (EXPR)
234#define LLVM_UNLIKELY(EXPR) (EXPR)
235#endif
236#endif
237
238/// LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so,
239/// mark a method "not for inlining".
240#ifndef LLVM_ATTRIBUTE_NOINLINE
241#if __has_attribute(noinline)
242#define LLVM_ATTRIBUTE_NOINLINE __attribute__((noinline))
243#elif defined(_MSC_VER)
244#define LLVM_ATTRIBUTE_NOINLINE __declspec(noinline)
245#else
246#define LLVM_ATTRIBUTE_NOINLINE
247#endif
248#endif
249
250/// LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do
251/// so, mark a method "always inline" because it is performance sensitive.
252#ifndef LLVM_ATTRIBUTE_ALWAYS_INLINE
253#if __has_attribute(always_inline)
254#define LLVM_ATTRIBUTE_ALWAYS_INLINE inline __attribute__((always_inline))
255#elif defined(_MSC_VER)
256#define LLVM_ATTRIBUTE_ALWAYS_INLINE __forceinline
257#else
258#define LLVM_ATTRIBUTE_ALWAYS_INLINE inline
259#endif
260#endif
261
262/// LLVM_ATTRIBUTE_NO_DEBUG - On compilers where we have a directive to do
263/// so, mark a method "no debug" because debug info makes the debugger
264/// experience worse.
265#if __has_attribute(nodebug)
266#define LLVM_ATTRIBUTE_NODEBUG __attribute__((nodebug))
267#else
268#define LLVM_ATTRIBUTE_NODEBUG
269#endif
270
271#ifndef LLVM_ATTRIBUTE_RETURNS_NONNULL
272#if __has_attribute(returns_nonnull)
273#define LLVM_ATTRIBUTE_RETURNS_NONNULL __attribute__((returns_nonnull))
274#elif defined(_MSC_VER)
275#define LLVM_ATTRIBUTE_RETURNS_NONNULL _Ret_notnull_
276#else
277#define LLVM_ATTRIBUTE_RETURNS_NONNULL
278#endif
279#endif
280
281/// \macro LLVM_ATTRIBUTE_RETURNS_NOALIAS Used to mark a function as returning a
282/// pointer that does not alias any other valid pointer.
283#ifndef LLVM_ATTRIBUTE_RETURNS_NOALIAS
284#ifdef __GNUC__
285#define LLVM_ATTRIBUTE_RETURNS_NOALIAS __attribute__((__malloc__))
286#elif defined(_MSC_VER)
287#define LLVM_ATTRIBUTE_RETURNS_NOALIAS __declspec(restrict)
288#else
289#define LLVM_ATTRIBUTE_RETURNS_NOALIAS
290#endif
291#endif
292
293/// LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
294#ifndef LLVM_FALLTHROUGH
295#if defined(__cplusplus) && __cplusplus > 201402L && LLVM_HAS_CPP_ATTRIBUTE(fallthrough)
296#define LLVM_FALLTHROUGH [[fallthrough]]
297#elif LLVM_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
298#define LLVM_FALLTHROUGH [[gnu::fallthrough]]
299#elif __has_attribute(fallthrough)
300#define LLVM_FALLTHROUGH __attribute__((fallthrough))
301#elif LLVM_HAS_CPP_ATTRIBUTE(clang::fallthrough)
302#define LLVM_FALLTHROUGH [[clang::fallthrough]]
303#else
304#define LLVM_FALLTHROUGH
305#endif
306#endif
307
308/// LLVM_REQUIRE_CONSTANT_INITIALIZATION - Apply this to globals to ensure that
309/// they are constant initialized.
310#if LLVM_HAS_CPP_ATTRIBUTE(clang::require_constant_initialization)
311#define LLVM_REQUIRE_CONSTANT_INITIALIZATION \
312 [[clang::require_constant_initialization]]
313#else
314#define LLVM_REQUIRE_CONSTANT_INITIALIZATION
315#endif
316
317/// LLVM_GSL_OWNER - Apply this to owning classes like SmallVector to enable
318/// lifetime warnings.
319#if LLVM_HAS_CPP_ATTRIBUTE(gsl::Owner)
320#define LLVM_GSL_OWNER [[gsl::Owner]]
321#else
322#define LLVM_GSL_OWNER
323#endif
324
325/// LLVM_GSL_POINTER - Apply this to non-owning classes like
326/// std::string_view to enable lifetime warnings.
327#if LLVM_HAS_CPP_ATTRIBUTE(gsl::Pointer)
328#define LLVM_GSL_POINTER [[gsl::Pointer]]
329#else
330#define LLVM_GSL_POINTER
331#endif
332
333/// LLVM_EXTENSION - Support compilers where we have a keyword to suppress
334/// pedantic diagnostics.
335#ifndef LLVM_EXTENSION
336#ifdef __GNUC__
337#define LLVM_EXTENSION __extension__
338#else
339#define LLVM_EXTENSION
340#endif
341#endif
342
343/// LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands
344/// to an expression which states that it is undefined behavior for the
345/// compiler to reach this point. Otherwise is not defined.
346///
347/// '#else' is intentionally left out so that other macro logic (e.g.,
348/// LLVM_ASSUME_ALIGNED and wpi_unreachable()) can detect whether
349/// LLVM_BUILTIN_UNREACHABLE has a definition.
350#ifndef LLVM_BUILTIN_UNREACHABLE
351#if __has_builtin(__builtin_unreachable) || defined(__GNUC__)
352# define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
353#elif defined(_MSC_VER)
354# define LLVM_BUILTIN_UNREACHABLE __assume(false)
355#endif
356#endif
357
358/// LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression
359/// which causes the program to exit abnormally.
360#ifndef LLVM_BUILTIN_TRAP
361#if __has_builtin(__builtin_trap) || defined(__GNUC__)
362# define LLVM_BUILTIN_TRAP __builtin_trap()
363#elif defined(_MSC_VER)
364// The __debugbreak intrinsic is supported by MSVC, does not require forward
365// declarations involving platform-specific typedefs (unlike RaiseException),
366// results in a call to vectored exception handlers, and encodes to a short
367// instruction that still causes the trapping behavior we want.
368# define LLVM_BUILTIN_TRAP __debugbreak()
369#else
370# define LLVM_BUILTIN_TRAP *(volatile int*)0x11 = 0
371#endif
372#endif
373
374/// LLVM_BUILTIN_DEBUGTRAP - On compilers which support it, expands to
375/// an expression which causes the program to break while running
376/// under a debugger.
377#ifndef LLVM_BUILTIN_DEBUGTRAP
378#if __has_builtin(__builtin_debugtrap)
379# define LLVM_BUILTIN_DEBUGTRAP __builtin_debugtrap()
380#elif defined(_MSC_VER)
381// The __debugbreak intrinsic is supported by MSVC and breaks while
382// running under the debugger, and also supports invoking a debugger
383// when the OS is configured appropriately.
384# define LLVM_BUILTIN_DEBUGTRAP __debugbreak()
385#else
386// Just continue execution when built with compilers that have no
387// support. This is a debugging aid and not intended to force the
388// program to abort if encountered.
389# define LLVM_BUILTIN_DEBUGTRAP
390#endif
391#endif
392
393/// \macro LLVM_ASSUME_ALIGNED
394/// Returns a pointer with an assumed alignment.
395#ifndef LLVM_ASSUME_ALIGNED
396#if __has_builtin(__builtin_assume_aligned) || defined(__GNUC__)
397# define LLVM_ASSUME_ALIGNED(p, a) __builtin_assume_aligned(p, a)
398#elif defined(LLVM_BUILTIN_UNREACHABLE)
399# define LLVM_ASSUME_ALIGNED(p, a) \
400 (((uintptr_t(p) % (a)) == 0) ? (p) : (LLVM_BUILTIN_UNREACHABLE, (p)))
401#else
402# define LLVM_ASSUME_ALIGNED(p, a) (p)
403#endif
404#endif
405
406/// \macro LLVM_PACKED
407/// Used to specify a packed structure.
408/// LLVM_PACKED(
409/// struct A {
410/// int i;
411/// int j;
412/// int k;
413/// long long l;
414/// });
415///
416/// LLVM_PACKED_START
417/// struct B {
418/// int i;
419/// int j;
420/// int k;
421/// long long l;
422/// };
423/// LLVM_PACKED_END
424#ifndef LLVM_PACKED
425#ifdef _MSC_VER
426# define LLVM_PACKED(d) __pragma(pack(push, 1)) d __pragma(pack(pop))
427# define LLVM_PACKED_START __pragma(pack(push, 1))
428# define LLVM_PACKED_END __pragma(pack(pop))
429#else
430# define LLVM_PACKED(d) d __attribute__((packed))
431# define LLVM_PACKED_START _Pragma("pack(push, 1)")
432# define LLVM_PACKED_END _Pragma("pack(pop)")
433#endif
434#endif
435
436/// \macro LLVM_MEMORY_SANITIZER_BUILD
437/// Whether LLVM itself is built with MemorySanitizer instrumentation.
438#if __has_feature(memory_sanitizer)
439# define LLVM_MEMORY_SANITIZER_BUILD 1
440# include <sanitizer/msan_interface.h>
441# define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE __attribute__((no_sanitize_memory))
442#else
443# define LLVM_MEMORY_SANITIZER_BUILD 0
444# define __msan_allocated_memory(p, size)
445# define __msan_unpoison(p, size)
446# define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE
447#endif
448
449/// \macro LLVM_ADDRESS_SANITIZER_BUILD
450/// Whether LLVM itself is built with AddressSanitizer instrumentation.
451#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
452# define LLVM_ADDRESS_SANITIZER_BUILD 1
453#if __has_include(<sanitizer/asan_interface.h>)
454# include <sanitizer/asan_interface.h>
455#else
456// These declarations exist to support ASan with MSVC. If MSVC eventually ships
457// asan_interface.h in their headers, then we can remove this.
458#ifdef __cplusplus
459extern "C" {
460#endif
461void __asan_poison_memory_region(void const volatile *addr, size_t size);
462void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
463#ifdef __cplusplus
464} // extern "C"
465#endif
466#endif
467#else
468# define LLVM_ADDRESS_SANITIZER_BUILD 0
469# define __asan_poison_memory_region(p, size)
470# define __asan_unpoison_memory_region(p, size)
471#endif
472
473/// \macro LLVM_HWADDRESS_SANITIZER_BUILD
474/// Whether LLVM itself is built with HWAddressSanitizer instrumentation.
475#if __has_feature(hwaddress_sanitizer)
476#define LLVM_HWADDRESS_SANITIZER_BUILD 1
477#else
478#define LLVM_HWADDRESS_SANITIZER_BUILD 0
479#endif
480
481/// \macro LLVM_THREAD_SANITIZER_BUILD
482/// Whether LLVM itself is built with ThreadSanitizer instrumentation.
483#if __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)
484# define LLVM_THREAD_SANITIZER_BUILD 1
485#else
486# define LLVM_THREAD_SANITIZER_BUILD 0
487#endif
488
489#if LLVM_THREAD_SANITIZER_BUILD
490// Thread Sanitizer is a tool that finds races in code.
491// See http://code.google.com/p/data-race-test/wiki/DynamicAnnotations .
492// tsan detects these exact functions by name.
493#ifdef __cplusplus
494extern "C" {
495#endif
496void AnnotateHappensAfter(const char *file, int line, const volatile void *cv);
497void AnnotateHappensBefore(const char *file, int line, const volatile void *cv);
498void AnnotateIgnoreWritesBegin(const char *file, int line);
499void AnnotateIgnoreWritesEnd(const char *file, int line);
500#ifdef __cplusplus
501}
502#endif
503
504// This marker is used to define a happens-before arc. The race detector will
505// infer an arc from the begin to the end when they share the same pointer
506// argument.
507# define TsanHappensBefore(cv) AnnotateHappensBefore(__FILE__, __LINE__, cv)
508
509// This marker defines the destination of a happens-before arc.
510# define TsanHappensAfter(cv) AnnotateHappensAfter(__FILE__, __LINE__, cv)
511
512// Ignore any races on writes between here and the next TsanIgnoreWritesEnd.
513# define TsanIgnoreWritesBegin() AnnotateIgnoreWritesBegin(__FILE__, __LINE__)
514
515// Resume checking for racy writes.
516# define TsanIgnoreWritesEnd() AnnotateIgnoreWritesEnd(__FILE__, __LINE__)
517#else
518# define TsanHappensBefore(cv)
519# define TsanHappensAfter(cv)
520# define TsanIgnoreWritesBegin()
521# define TsanIgnoreWritesEnd()
522#endif
523
524/// \macro LLVM_NO_SANITIZE
525/// Disable a particular sanitizer for a function.
526#ifndef LLVM_NO_SANITIZE
527#if __has_attribute(no_sanitize)
528#define LLVM_NO_SANITIZE(KIND) __attribute__((no_sanitize(KIND)))
529#else
530#define LLVM_NO_SANITIZE(KIND)
531#endif
532#endif
533
534/// Mark debug helper function definitions like dump() that should not be
535/// stripped from debug builds.
536/// Note that you should also surround dump() functions with
537/// `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` so they do always
538/// get stripped in release builds.
539// FIXME: Move this to a private config.h as it's not usable in public headers.
540#ifndef LLVM_DUMP_METHOD
541#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
542#define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE LLVM_ATTRIBUTE_USED
543#else
544#define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE
545#endif
546#endif
547
548/// \macro LLVM_PRETTY_FUNCTION
549/// Gets a user-friendly looking function signature for the current scope
550/// using the best available method on each platform. The exact format of the
551/// resulting string is implementation specific and non-portable, so this should
552/// only be used, for example, for logging or diagnostics.
553#ifndef LLVM_PRETTY_FUNCTION
554#if defined(_MSC_VER)
555#define LLVM_PRETTY_FUNCTION __FUNCSIG__
556#elif defined(__GNUC__) || defined(__clang__)
557#define LLVM_PRETTY_FUNCTION __PRETTY_FUNCTION__
558#else
559#define LLVM_PRETTY_FUNCTION __func__
560#endif
561#endif
562
563/// \macro LLVM_THREAD_LOCAL
564/// A thread-local storage specifier which can be used with globals,
565/// extern globals, and static globals.
566///
567/// This is essentially an extremely restricted analog to C++11's thread_local
568/// support. It uses thread_local if available, falling back on gcc __thread
569/// if not. __thread doesn't support many of the C++11 thread_local's
570/// features. You should only use this for PODs that you can statically
571/// initialize to some constant value. In almost all circumstances this is most
572/// appropriate for use with a pointer, integer, or small aggregation of
573/// pointers and integers.
574#if __has_feature(cxx_thread_local) || defined(_MSC_VER)
575#define LLVM_THREAD_LOCAL thread_local
576#else
577// Clang, GCC, and other compatible compilers used __thread prior to C++11 and
578// we only need the restricted functionality that provides.
579#define LLVM_THREAD_LOCAL __thread
580#endif
581
582/// \macro LLVM_ENABLE_EXCEPTIONS
583/// Whether LLVM is built with exception support.
584#if __has_feature(cxx_exceptions)
585#define LLVM_ENABLE_EXCEPTIONS 1
586#elif defined(__GNUC__) && defined(__EXCEPTIONS)
587#define LLVM_ENABLE_EXCEPTIONS 1
588#elif defined(_MSC_VER) && defined(_CPPUNWIND)
589#define LLVM_ENABLE_EXCEPTIONS 1
590#endif
591
592/// \macro LLVM_NO_PROFILE_INSTRUMENT_FUNCTION
593/// Disable the profile instrument for a function.
594#if __has_attribute(no_profile_instrument_function)
595#define LLVM_NO_PROFILE_INSTRUMENT_FUNCTION \
596 __attribute__((no_profile_instrument_function))
597#else
598#define LLVM_NO_PROFILE_INSTRUMENT_FUNCTION
599#endif
600
601#endif
#define __asan_poison_memory_region(p, size)
Definition: Compiler.h:469
#define __asan_unpoison_memory_region(p, size)
Definition: Compiler.h:470
then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file
Definition: ThirdPartyNotices.txt:192
Definition: VisionPipeline.h:7