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