clang 24.0.0git
LangOptions.h
Go to the documentation of this file.
1//===- LangOptions.h - C Language Family Language Options -------*- 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/// \file
10/// Defines the clang::LangOptions interface.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_BASIC_LANGOPTIONS_H
15#define LLVM_CLANG_BASIC_LANGOPTIONS_H
16
19#include "clang/Basic/LLVM.h"
25#include "llvm/ADT/FloatingPointMode.h"
26#include "llvm/ADT/StringRef.h"
27#include "llvm/BinaryFormat/DXContainer.h"
28#include "llvm/Frontend/OpenMP/OMPVersion.h"
29#include "llvm/Support/AllocToken.h"
30#include "llvm/TargetParser/Triple.h"
31#include <optional>
32#include <string>
33#include <vector>
34
35namespace clang {
36
37/// In the Microsoft ABI, this controls the placement of virtual displacement
38/// members used to implement virtual inheritance.
40
41/// Shader programs run in specific pipeline stages.
42/// The order of these values matters, and must be kept in sync with the
43/// Triple Environment enum in llvm::Triple. The ordering is enforced in
44/// static_asserts in Triple.cpp and in clang/Basic/HLSLRuntime.h.
63
70
71/// Bitfields of LangOptions, split out from LangOptions in order to ensure that
72/// this large collection of bitfields is a trivial class type.
74 friend class CompilerInvocation;
76
77public:
79 using RoundingMode = llvm::RoundingMode;
81
82 /// For ASTs produced with different option value, signifies their level of
83 /// compatibility.
84 enum class CompatibilityKind {
85 /// Does affect the construction of the AST in a way that does prevent
86 /// module interoperability.
88 /// Does affect the construction of the AST in a way that doesn't prevent
89 /// interoperability (that is, the value can be different between an
90 /// explicit module and the user of that module).
92 /// Does not affect the construction of the AST in any way (that is, the
93 /// value can be different between an implicit module and the user of that
94 /// module).
96 };
97
100
101 // Automatic variables live on the stack, and when trivial they're usually
102 // uninitialized because it's undefined behavior to use them without
103 // initializing them.
105
107 // Default C standard behavior.
109
110 // -fwrapv
112
113 // -ftrapv
115 };
116
117 // Used by __attribute__((overflow_behavior())) to describe overflow behavior
118 // on a per-type basis.
120 // Default C standard behavior (type dependent).
122
123 // __attribute__((overflow_behavior("wrap")))
125
126 // __attribute__((overflow_behavior("trap")))
128
129 // Signed types defined as wrapping via -fwrapv can still be instrumented
130 // by sanitizers (PR82432). This field is needed to disambiguate canonical
131 // wrapping type behaviors from -fwrapv behaviors.
132 // -fwrapv
134 };
135
136 // FIXME: Unify with TUKind.
138 /// Not compiling a module interface at all.
140
141 /// Compiling a module from a module map.
143
144 /// Compiling a module header unit.
146
147 /// Compiling a C++ modules interface unit.
149 };
150
157
159
169
171
172 // Corresponds to _MSC_VER
174 MSVC2010 = 1600,
175 MSVC2012 = 1700,
176 MSVC2013 = 1800,
177 MSVC2015 = 1900,
178 MSVC2017 = 1910,
182 MSVC2019 = 1920,
187 };
188
193 // The "default" SYCL version to be used when none is specified on the
194 // frontend command line.
196 };
197
200 HLSL_2015 = 2015,
201 HLSL_2016 = 2016,
202 HLSL_2017 = 2017,
203 HLSL_2018 = 2018,
204 HLSL_2021 = 2021,
205 HLSL_202x = 2028,
206 HLSL_202y = 2029,
207 };
208
209 /// Clang versions with different platform ABI conformance.
210 enum class ClangABI {
211#define ABI_VER_MAJOR_MINOR(Major, Minor) Ver##Major##_##Minor,
212#define ABI_VER_MAJOR(Major) Ver##Major,
213#define ABI_VER_LATEST(Latest) Latest
214#include "clang/Basic/ABIVersions.def"
215 };
216
217 enum class CoreFoundationABI {
218 /// No interoperability ABI has been specified
220 /// CoreFoundation does not have any language interoperability
222 /// Interoperability with the ObjectiveC runtime
224 /// Interoperability with the latest known version of the Swift runtime
226 /// Interoperability with the Swift 5.0 runtime
228 /// Interoperability with the Swift 4.2 runtime
230 /// Interoperability with the Swift 4.1 runtime
232 };
233
235 // Disable the floating point pragma
237
238 // Enable the floating point pragma
240
241 // Aggressively fuse FP ops (E.g. FMA) disregarding pragmas.
243
244 // Aggressively fuse FP ops and honor pragmas.
246 };
247
248 /// Possible floating point exception behavior.
250 /// Assume that floating-point exceptions are masked.
252 /// Transformations do not cause new exceptions but may hide some.
254 /// Strictly preserve the floating-point exception semantics.
256 /// Used internally to represent initial unspecified value.
258 };
259
260 /// Possible float expression evaluation method choices.
261 enum FPEvalMethodKind : unsigned {
262 /// Use the declared type for fp arithmetic.
264 /// Use the type double for fp arithmetic.
266 /// Use extended type for fp arithmetic.
268 /// Used only for FE option processing; this is only used to indicate that
269 /// the user did not specify an explicit evaluation method on the command
270 /// line and so the target should be queried for its default evaluation
271 /// method instead.
273 };
274
275 enum class MatrixMemoryLayout : unsigned {
276 // Use column-major layout for matrices
278 // Use row-major layout for matrices
280 };
281
283
285 /// Permit no implicit vector bitcasts.
287 /// Permit vector bitcasts between integer vectors with different numbers
288 /// of elements but the same total bit-width.
290 /// Permit vector bitcasts between all vectors with the same total
291 /// bit-width.
293 };
294
296 // All vector compares produce scalars except vector pixel and vector bool.
297 // The types vector pixel and vector bool return vector results.
299 // All vector compares produce vector results as in GCC.
301 // All vector compares produce scalars as in XL.
303 // Default clang behaviour.
305 };
306
308 /// No signing for any function.
310 /// Sign the return address of functions that spill LR.
312 /// Sign the return address of all functions,
314 };
315
317 /// Return address signing uses APIA key.
319 /// Return address signing uses APIB key.
321 };
322
324 /// Regular return address signing.
326 /// Hardened return address signing with load from the return address.
328 };
329
330 enum class ThreadModelKind {
331 /// POSIX Threads.
333 /// Single Threaded Environment.
335 };
336
337 enum class ExtendArgsKind {
338 /// Integer arguments are sign or zero extended to 32/64 bits
339 /// during default argument promotions.
342 };
343
345 /// Legacy default stream
347 /// Per-thread default stream
349 };
350
351 /// Exclude certain code patterns from being instrumented by arithmetic
352 /// overflow sanitizers
354 /// Don't exclude any overflow patterns from sanitizers
355 None = 1 << 0,
356 /// Exclude all overflow patterns (below)
357 All = 1 << 1,
358 /// if (a + b < a)
360 /// if (a + b < a)
362 /// -1UL
364 /// while (count--)
366 };
367
370 /// map only explicit default visibilities to exported
372 /// map all default visibilities to exported
374 };
375
377 /// Force hidden visibility
379 /// Force protected visibility
381 /// Force default visibility
383 /// Don't alter the visibility
385 };
386
388 /// Keep the IR-gen assigned visibility.
390 /// Override the IR-gen assigned visibility with default visibility.
392 /// Override the IR-gen assigned visibility with hidden visibility.
394 /// Override the IR-gen assigned visibility with protected visibility.
396 };
397
399 /// Any trailing array member is a FAM.
401 /// Any trailing array member of undefined, 0, or 1 size is a FAM.
403 /// Any trailing array member of undefined or 0 size is a FAM.
405 /// Any trailing array member of undefined size is a FAM.
407 };
408
409 /// Controls the various implementations for complex multiplication and
410 // division.
412 /// Implementation of complex division and multiplication using a call to
413 /// runtime library functions(generally the case, but the BE might
414 /// sometimes replace the library call if it knows enough about the
415 /// potential range of the inputs). Overflow and non-finite values are
416 /// handled by the library implementation. This is the default value.
418
419 /// Implementation of complex division offering an improved handling
420 /// for overflow in intermediate calculations with no special handling for
421 /// NaN and infinite values.
423
424 /// Implementation of complex division using algebraic formulas at
425 /// higher precision. Overflow is handled. Non-finite values are handled in
426 /// some cases. If the target hardware does not have native support for a
427 /// higher precision data type, an implementation for the complex operation
428 /// will be used to provide improved guards against intermediate overflow,
429 /// but overflow and underflow may still occur in some cases. NaN and
430 /// infinite values are not handled.
432
433 /// Implementation of complex division and multiplication using
434 /// algebraic formulas at source precision. No special handling to avoid
435 /// overflow. NaN and infinite values are not handled.
437
438 /// No range rule is enabled.
440 };
441
442 /// Controls which variables have static destructors registered.
444 /// Register static destructors for all variables.
446 /// Register static destructors only for thread-local variables.
448 /// Don't register static destructors for any variables.
450 };
451
453 /// Use default layout rules of the target.
455 /// Use Itanium rules for bit-field layout and fundamental types alignment.
457 /// Use Microsoft C++ ABI rules for bit-field layout and fundamental types
458 /// alignment.
460 };
461
462 // Define simple language options (with no accessors).
463#define LANGOPT(Name, Bits, Default, Compatibility, Description) \
464 unsigned Name : Bits;
465#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description)
466#include "clang/Basic/LangOptions.def"
467
468protected:
469 // Define language options of enumeration type. These are private, and will
470 // have accessors (below).
471#define LANGOPT(Name, Bits, Default, Compatibility, Description)
472#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description) \
473 LLVM_PREFERRED_TYPE(Type) \
474 unsigned Name : Bits;
475#include "clang/Basic/LangOptions.def"
476};
477
478/// Keeps track of the various options that can be
479/// enabled, which controls the dialect of C or C++ that is accepted.
481public:
482 /// The used language standard.
484
485 /// Set of enabled sanitizers.
487 /// Is at least one coverage instrumentation type enabled.
488 bool SanitizeCoverage = false;
489 /// Set of (UBSan) sanitizers that when enabled do not cause
490 /// `__has_feature(undefined_behavior_sanitizer)` to evaluate true.
492
493 /// Paths to files specifying which objects
494 /// (files, functions, variables) should not be instrumented.
495 std::vector<std::string> NoSanitizeFiles;
496
497 /// Paths to the XRay "always instrument" files specifying which
498 /// objects (files, functions, variables) should be imbued with the XRay
499 /// "always instrument" attribute.
500 /// WARNING: This is a deprecated field and will go away in the future.
501 std::vector<std::string> XRayAlwaysInstrumentFiles;
502
503 /// Paths to the XRay "never instrument" files specifying which
504 /// objects (files, functions, variables) should be imbued with the XRay
505 /// "never instrument" attribute.
506 /// WARNING: This is a deprecated field and will go away in the future.
507 std::vector<std::string> XRayNeverInstrumentFiles;
508
509 /// Paths to the XRay attribute list files, specifying which objects
510 /// (files, functions, variables) should be imbued with the appropriate XRay
511 /// attribute(s).
512 std::vector<std::string> XRayAttrListFiles;
513
514 /// Paths to special case list files specifying which entities
515 /// (files, functions) should or should not be instrumented.
516 std::vector<std::string> ProfileListFiles;
517
519
521
528
529 /// The name of the handler function to be called when -ftrapv is
530 /// specified.
531 ///
532 /// If none is specified, abort (GCC-compatible behaviour).
533 std::string OverflowHandler;
534
535 /// The module currently being compiled as specified by -fmodule-name.
536 std::string ModuleName;
537
538 /// The name of the current module, of which the main source file
539 /// is a part. If CompilingModule is set, we are compiling the interface
540 /// of this module, otherwise we are compiling an implementation file of
541 /// it. This starts as ModuleName in case -fmodule-name is provided and
542 /// changes during compilation to reflect the current module.
543 std::string CurrentModule;
544
545 /// The names of any features to enable in module 'requires' decls
546 /// in addition to the hard-coded list in Module.cpp and the target features.
547 ///
548 /// This list is sorted.
549 std::vector<std::string> ModuleFeatures;
550
551 /// Options for parsing comments.
553
554 /// A list of all -fno-builtin-* function names (e.g., memset).
555 std::vector<std::string> NoBuiltinFuncs;
556
557 /// A prefix map for __FILE__, __BASE_FILE__ and __builtin_FILE().
558 std::map<std::string, std::string, std::greater<std::string>> MacroPrefixMap;
559
560 /// Macro name to use in lifetimebound fix-it suggestions.
562
563 /// Triples of the OpenMP targets that the host code codegen should
564 /// take into account in order to generate accurate offloading descriptors.
565 std::vector<llvm::Triple> OMPTargetTriples;
566
567 /// Name of the IR file that contains the result of the OpenMP target
568 /// host code generation.
569 std::string OMPHostIRFile;
570
571 /// The user provided compilation unit ID, if non-empty. This is used to
572 /// externalize static variables which is needed to support accessing static
573 /// device variables in host code for single source offloading languages
574 /// like CUDA/HIP.
575 std::string CUID;
576
577 /// C++ ABI to compile with, if specified by the frontend through -fc++-abi=.
578 /// This overrides the default ABI used by the target.
579 std::optional<TargetCXXABI::Kind> CXXABI;
580
581 /// Indicates whether the front-end is explicitly told that the
582 /// input is a header file (i.e. -x c-header).
583 bool IsHeaderFile = false;
584
585 /// The default stream kind used for HIP kernel launching.
587
588 /// Which overflow patterns should be excluded from sanitizer instrumentation
590
591 std::vector<std::string> OverflowPatternExclusionValues;
592
593 /// The seed used by the randomize structure layout feature.
594 std::string RandstructSeed;
595
596 /// Indicates whether to use target's platform-specific file separator when
597 /// __FILE__ macro is used and when concatenating filename with directory or
598 /// to use build environment environment's platform-specific file separator.
599 ///
600 /// The plaform-specific path separator is the backslash(\‍) for Windows and
601 /// forward slash (/) elsewhere.
603
604 // Indicates whether we should keep all nullptr checks for pointers
605 // received as a result of a standard operator new (-fcheck-new)
606 bool CheckNew = false;
607
608 /// The HLSL root signature version for dxil.
609 llvm::dxbc::RootSignatureVersion HLSLRootSigVer;
610
611 /// The HLSL root signature that will be used to overide the root signature
612 /// used for the shader entry point.
614
615 // Indicates if the wasm-opt binary must be ignored in the case of a
616 // WebAssembly target.
617 bool NoWasmOpt = false;
618
619 /// Atomic code-generation options.
620 /// These flags are set directly from the command-line options.
621 bool AtomicRemoteMemory = false;
624
625 /// Maximum number of allocation tokens (0 = target SIZE_MAX), nullopt if none
626 /// set (use target SIZE_MAX).
627 std::optional<uint64_t> AllocTokenMax;
628
629 /// The allocation token mode.
630 std::optional<llvm::AllocTokenMode> AllocTokenMode;
631
632 /// Name of the literal encoding to convert the internal encoding to.
633 std::string LiteralEncoding;
634
635 LangOptions();
636
637 /// Set language defaults for the given input language and
638 /// language standard in the given LangOptions object.
639 ///
640 /// \param Opts - The LangOptions object to set up.
641 /// \param Lang - The input language.
642 /// \param T - The target triple.
643 /// \param Includes - If the language requires extra headers to be implicitly
644 /// included, they will be appended to this list.
645 /// \param LangStd - The input language standard.
646 static void
647 setLangDefaults(LangOptions &Opts, Language Lang, const llvm::Triple &T,
648 std::vector<std::string> &Includes,
650
651 // Define accessors/mutators for language options of enumeration type.
652#define LANGOPT(Name, Bits, Default, Compatibility, Description)
653#define ENUM_LANGOPT(Name, Type, Bits, Default, Compatibility, Description) \
654 Type get##Name() const { return static_cast<Type>(Name); } \
655 void set##Name(Type Value) { \
656 assert(static_cast<unsigned>(Value) < (1u << Bits)); \
657 Name = static_cast<unsigned>(Value); \
658 }
659#include "clang/Basic/LangOptions.def"
660
661 /// Are we compiling a module?
662 bool isCompilingModule() const {
663 return getCompilingModule() != CMK_None;
664 }
665
666 /// Are we compiling a module implementation?
668 return !isCompilingModule() && !ModuleName.empty();
669 }
670
671 /// Do we need to track the owning module for a local declaration?
673 return isCompilingModule() || ModulesLocalVisibility;
674 }
675
677 return getSignedOverflowBehavior() == SOB_Defined;
678 }
679
681 return ObjCRuntime.isSubscriptPointerArithmetic() &&
682 !ObjCSubscriptingLegacyRuntime;
683 }
684
685 bool isCompatibleWith(ClangABI Version) const {
686 return getClangABICompat() <= Version;
687 }
688
689 bool isCompatibleWithMSVC() const { return MSCompatibilityVersion > 0; }
690
691 bool isCompatibleWithMSVC(MSVCMajorVersion MajorVersion) const {
692 return MSCompatibilityVersion >= MajorVersion * 100000U;
693 }
694
702
703 /// Reset all of the options that are not considered when building a
704 /// module.
706
707 /// Is this a libc/libm function that is no longer recognized as a
708 /// builtin because a -fno-builtin-* option has been specified?
709 bool isNoBuiltinFunc(StringRef Name) const;
710
711 /// True if any ObjC types may have non-trivial lifetime qualifiers.
713 return ObjCAutoRefCount || ObjCWeak;
714 }
715
717 return ConvergentFunctions;
718 }
719
720 /// Return true if using -fbounds-safety in full or attribute-only mode.
721 /// Attribute-only mode exists only downstream, where this predicate gates
722 /// behavior that diverges from upstream. It is kept here to minimize that
723 /// divergence.
724 // TODO: Remove this once upstream and downstream no longer diverge and
725 // attribute-only mode is deprecated downstream.
726 bool hasBoundsSafetyAttributes() const { return BoundsSafety; }
727
728 /// Return true if atomicrmw operations targeting allocations in private
729 /// memory are undefined.
731 // Should be false for OpenMP.
732 // TODO: Should this be true for SYCL?
733 return OpenCL || CUDA;
734 }
735
736 /// Return the OpenCL C or C++ version as a VersionTuple.
737 VersionTuple getOpenCLVersionTuple() const;
738
739 /// Return the OpenCL version that kernel language is compatible with
740 unsigned getOpenCLCompatibleVersion() const;
741
742 /// Return the OpenCL C or C++ for OpenCL language name and version
743 /// as a string.
744 std::string getOpenCLVersionString() const;
745
746 /// Returns true if functions without prototypes or functions with an
747 /// identifier list (aka K&R C functions) are not allowed.
749 return CPlusPlus || C23 || DisableKNRFunctions;
750 }
751
752 /// Returns true if implicit function declarations are allowed in the current
753 /// language mode.
755 return !requiresStrictPrototypes() && !OpenCL;
756 }
757
758 /// Returns true if the language supports calling the 'atexit' function.
759 bool hasAtExit() const { return !(OpenMP && OpenMPIsTargetDevice); }
760
761 /// Returns true if implicit int is part of the language requirements.
762 bool isImplicitIntRequired() const { return !CPlusPlus && !C99; }
763
764 /// Returns true if implicit int is supported at all.
765 bool isImplicitIntAllowed() const { return !CPlusPlus && !C23; }
766
767 /// Check if return address signing is enabled.
768 bool hasSignReturnAddress() const {
769 return getSignReturnAddressScope() != SignReturnAddressScopeKind::None;
770 }
771
772 /// Check if return address signing uses AKey.
774 return getSignReturnAddressKey() == SignReturnAddressKeyKind::AKey;
775 }
776
777 /// Check if leaf functions are also signed.
779 return getSignReturnAddressScope() == SignReturnAddressScopeKind::All;
780 }
781
782 /// Check if return address authentication hardening is enabled
784 return getSignReturnAddressHardening() !=
786 }
787
788 bool isSYCL() const { return SYCLIsDevice || SYCLIsHost; }
789
791 return getDefaultVisibilityExportMapping() !=
793 }
794
796 return getDefaultVisibilityExportMapping() ==
798 }
799
801 return getDefaultVisibilityExportMapping() ==
803 }
804
806 return getGlobalAllocationFunctionVisibility() !=
808 }
809
811 return getGlobalAllocationFunctionVisibility() ==
813 }
814
816 return getGlobalAllocationFunctionVisibility() ==
818 }
819
821 return getGlobalAllocationFunctionVisibility() ==
823 }
824
825 bool allowArrayReturnTypes() const { return HLSL; }
826
827 /// Remap path prefix according to -fmacro-prefix-path option.
828 void remapPathPrefix(SmallVectorImpl<char> &Path) const;
829
831 return RoundingMath ? RoundingMode::Dynamic
832 : RoundingMode::NearestTiesToEven;
833 }
834
836 FPExceptionModeKind EM = getFPExceptionMode();
839 return EM;
840 }
841
842 /// True when compiling for an offloading target device.
843 bool isTargetDevice() const {
844 return OpenMPIsTargetDevice || CUDAIsDevice || SYCLIsDevice;
845 }
846
847 /// Return the OpenMP version.
848 llvm::omp::Version getOpenMPVersion() const {
849 return llvm::omp::Version(OpenMP);
850 }
851
852 /// Returns the most applicable C standard-compliant language version code.
853 /// If none could be determined, returns \ref std::nullopt.
854 std::optional<uint32_t> getCLangStd() const;
855
856 /// Returns the most applicable C++ standard-compliant language
857 /// version code.
858 /// If none could be determined, returns \ref std::nullopt.
859 std::optional<uint32_t> getCPlusPlusLangStd() const;
860};
861
862/// Floating point control options
863class FPOptionsOverride;
865public:
866 // We start by defining the layout.
868
869 using RoundingMode = llvm::RoundingMode;
870
871 static constexpr unsigned StorageBitSize = 8 * sizeof(storage_type);
872
873 // Define a fake option named "First" so that we have a PREVIOUS even for the
874 // real first option.
875 static constexpr storage_type FirstShift = 0, FirstWidth = 0;
876#define FP_OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
877 static constexpr storage_type NAME##Shift = \
878 PREVIOUS##Shift + PREVIOUS##Width; \
879 static constexpr storage_type NAME##Width = WIDTH; \
880 static constexpr storage_type NAME##Mask = ((1 << NAME##Width) - 1) \
881 << NAME##Shift;
882#include "clang/Basic/FPOptions.def"
883
884 static constexpr storage_type TotalWidth = 0
885#define FP_OPTION(NAME, TYPE, WIDTH, PREVIOUS) +WIDTH
886#include "clang/Basic/FPOptions.def"
887 ;
888 static_assert(TotalWidth <= StorageBitSize, "Too short type for FPOptions");
889
890private:
891 storage_type Value;
892
893 FPOptionsOverride getChangesSlow(const FPOptions &Base) const;
894
895public:
896 FPOptions() : Value(0) {
897 setFPContractMode(LangOptions::FPM_Off);
898 setConstRoundingMode(RoundingMode::Dynamic);
899 setSpecifiedExceptionMode(LangOptions::FPE_Default);
900 }
901 explicit FPOptions(const LangOptions &LO) {
902 Value = 0;
903 // The language fp contract option FPM_FastHonorPragmas has the same effect
904 // as FPM_Fast in frontend. For simplicity, use FPM_Fast uniformly in
905 // frontend.
906 auto LangOptContractMode = LO.getDefaultFPContractMode();
907 if (LangOptContractMode == LangOptions::FPM_FastHonorPragmas)
908 LangOptContractMode = LangOptions::FPM_Fast;
909 setFPContractMode(LangOptContractMode);
910 setRoundingMath(LO.RoundingMath);
911 setConstRoundingMode(LangOptions::RoundingMode::Dynamic);
912 setSpecifiedExceptionMode(LO.getFPExceptionMode());
913 setAllowFPReassociate(LO.AllowFPReassoc);
914 setNoHonorNaNs(LO.NoHonorNaNs);
915 setNoHonorInfs(LO.NoHonorInfs);
916 setNoSignedZero(LO.NoSignedZero);
917 setAllowReciprocal(LO.AllowRecip);
918 setAllowApproxFunc(LO.ApproxFunc);
919 if (getFPContractMode() == LangOptions::FPM_On &&
920 getRoundingMode() == llvm::RoundingMode::Dynamic &&
922 // If the FP settings are set to the "strict" model, then
923 // FENV access is set to true. (ffp-model=strict)
924 setAllowFEnvAccess(true);
925 else
926 setAllowFEnvAccess(LangOptions::FPM_Off);
927 setComplexRange(LO.getComplexRange());
928 }
929
931 return getFPContractMode() == LangOptions::FPM_On;
932 }
934 setFPContractMode(LangOptions::FPM_On);
935 }
936
938 return getFPContractMode() == LangOptions::FPM_Fast;
939 }
941 setFPContractMode(LangOptions::FPM_Fast);
942 }
943
944 bool isFPConstrained() const {
945 return getRoundingMode() != llvm::RoundingMode::NearestTiesToEven ||
947 getAllowFEnvAccess();
948 }
949
951 RoundingMode RM = getConstRoundingMode();
952 if (RM == RoundingMode::Dynamic) {
953 // C23: 7.6.2p3 If the FE_DYNAMIC mode is specified and FENV_ACCESS is
954 // "off", the translator may assume that the default rounding mode is in
955 // effect.
956 if (!getAllowFEnvAccess() && !getRoundingMath())
957 RM = RoundingMode::NearestTiesToEven;
958 }
959 return RM;
960 }
961
963 LangOptions::FPExceptionModeKind EM = getSpecifiedExceptionMode();
965 if (getAllowFEnvAccess())
967 else
969 }
970 return EM;
971 }
972
973 bool operator==(FPOptions other) const { return Value == other.Value; }
974
975 /// Return the default value of FPOptions that's used when trailing
976 /// storage isn't required.
978
979 storage_type getAsOpaqueInt() const { return Value; }
981 FPOptions Opts;
982 Opts.Value = Value;
983 return Opts;
984 }
985
986 /// Return difference with the given option set.
988
990
991 // We can define most of the accessors automatically:
992 // TODO: consider enforcing the assertion that value fits within bits
993 // statically.
994#define FP_OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
995 TYPE get##NAME() const { \
996 return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift); \
997 } \
998 void set##NAME(TYPE value) { \
999 assert(storage_type(value) < (1u << WIDTH)); \
1000 Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift); \
1001 }
1002#include "clang/Basic/FPOptions.def"
1003 LLVM_DUMP_METHOD void dump();
1004};
1005
1006/// Represents difference between two FPOptions values.
1007///
1008/// The effect of language constructs changing the set of floating point options
1009/// is usually a change of some FP properties while leaving others intact. This
1010/// class describes such changes by keeping information about what FP options
1011/// are overridden.
1012///
1013/// The integral set of FP options, described by the class FPOptions, may be
1014/// represented as a default FP option set, defined by language standard and
1015/// command line options, with the overrides introduced by pragmas.
1016///
1017/// The is implemented as a value of the new FPOptions plus a mask showing which
1018/// fields are actually set in it.
1019///
1020/// NOTE: This type is serialized into the AST format (e.g. for defaulted
1021/// functions). When adding a new field here or in FPOptions, ensure that the
1022/// AST VERSION_MAJOR is bumped if it changes the layout or size.
1025 FPOptions::storage_type OverrideMask = 0;
1026
1027public:
1028 using RoundingMode = llvm::RoundingMode;
1029
1030 /// The type suitable for storing values of FPOptionsOverride. Must be twice
1031 /// as wide as bit size of FPOption.
1032 using storage_type = uint64_t;
1033 static_assert(sizeof(storage_type) >= 2 * sizeof(FPOptions::storage_type),
1034 "Too short type for FPOptionsOverride");
1035
1036 /// Bit mask selecting bits of OverrideMask in serialized representation of
1037 /// FPOptionsOverride.
1039 (static_cast<storage_type>(1) << FPOptions::StorageBitSize) - 1;
1040
1043 : Options(LO), OverrideMask(OverrideMaskBits) {}
1045 : Options(FPO), OverrideMask(OverrideMaskBits) {}
1047 : Options(FPO), OverrideMask(Mask) {}
1048
1049 bool requiresTrailingStorage() const { return OverrideMask != 0; }
1050
1052 setFPContractModeOverride(LangOptions::FPM_On);
1053 }
1054
1056 setFPContractModeOverride(LangOptions::FPM_Fast);
1057 }
1058
1060 setFPContractModeOverride(LangOptions::FPM_Off);
1061 }
1062
1064 setAllowFPReassociateOverride(!Value);
1065 setNoHonorNaNsOverride(!Value);
1066 setNoHonorInfsOverride(!Value);
1067 setNoSignedZeroOverride(!Value);
1068 setAllowReciprocalOverride(!Value);
1069 setAllowApproxFuncOverride(!Value);
1070 setMathErrnoOverride(Value);
1071 if (Value)
1072 /* Precise mode implies fp_contract=on and disables ffast-math */
1074 else
1075 /* Precise mode disabled sets fp_contract=fast and enables ffast-math */
1077 }
1078
1080
1082 return (static_cast<storage_type>(Options.getAsOpaqueInt())
1084 OverrideMask;
1085 }
1087 FPOptionsOverride Opts;
1088 Opts.OverrideMask = I & OverrideMaskBits;
1090 return Opts;
1091 }
1092
1095 FPOptions::getFromOpaqueInt((Base.getAsOpaqueInt() & ~OverrideMask) |
1096 (Options.getAsOpaqueInt() & OverrideMask));
1097 return Result;
1098 }
1099
1101 return applyOverrides(FPOptions(LO));
1102 }
1103
1104 bool operator==(FPOptionsOverride other) const {
1105 return Options == other.Options && OverrideMask == other.OverrideMask;
1106 }
1107 bool operator!=(FPOptionsOverride other) const { return !(*this == other); }
1108
1109#define FP_OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
1110 bool has##NAME##Override() const { \
1111 return OverrideMask & FPOptions::NAME##Mask; \
1112 } \
1113 TYPE get##NAME##Override() const { \
1114 assert(has##NAME##Override()); \
1115 return Options.get##NAME(); \
1116 } \
1117 void clear##NAME##Override() { \
1118 /* Clear the actual value so that we don't have spurious differences when \
1119 * testing equality. */ \
1120 Options.set##NAME(TYPE(0)); \
1121 OverrideMask &= ~FPOptions::NAME##Mask; \
1122 } \
1123 void set##NAME##Override(TYPE value) { \
1124 Options.set##NAME(value); \
1125 OverrideMask |= FPOptions::NAME##Mask; \
1126 }
1127#include "clang/Basic/FPOptions.def"
1128 LLVM_DUMP_METHOD void dump();
1129};
1132 if (Value == Base.Value)
1133 return FPOptionsOverride();
1134 return getChangesSlow(Base);
1135}
1138 *this = FPO.applyOverrides(*this);
1139}
1140
1141// The three atomic code-generation options.
1142// The canonical (positive) names are:
1143// "remote_memory", "fine_grained_memory", and "ignore_denormal_mode".
1144// In attribute or command-line parsing, a token prefixed with "no_" inverts its
1145// value.
1147 RemoteMemory, // enable remote memory.
1148 FineGrainedMemory, // enable fine-grained memory.
1149 IgnoreDenormalMode, // ignore floating-point denormals.
1151};
1153struct AtomicOptions {
1154 // Bitfields for each option.
1155 unsigned remote_memory : 1;
1157 unsigned ignore_denormal_mode : 1;
1162 AtomicOptions(const LangOptions &LO)
1163 : remote_memory(LO.AtomicRemoteMemory),
1164 fine_grained_memory(LO.AtomicFineGrainedMemory),
1165 ignore_denormal_mode(LO.AtomicIgnoreDenormalMode) {}
1167 bool getOption(AtomicOptionKind Kind) const {
1168 switch (Kind) {
1170 return remote_memory;
1172 return fine_grained_memory;
1174 return ignore_denormal_mode;
1175 }
1176 llvm_unreachable("Invalid AtomicOptionKind");
1177 }
1179 void setOption(AtomicOptionKind Kind, bool Value) {
1180 switch (Kind) {
1183 return;
1186 return;
1189 return;
1190 }
1191 llvm_unreachable("Invalid AtomicOptionKind");
1192 }
1194 LLVM_DUMP_METHOD void dump() const {
1195 llvm::errs() << "\n remote_memory: " << remote_memory
1196 << "\n fine_grained_memory: " << fine_grained_memory
1197 << "\n ignore_denormal_mode: " << ignore_denormal_mode << "\n";
1198 }
1199};
1200
1201/// Describes the kind of translation unit being processed.
1203 /// The translation unit is a complete translation unit.
1205
1206 /// The translation unit is a prefix to a translation unit, and is
1207 /// not complete.
1208 TU_Prefix,
1209
1210 /// The translation unit is a clang module.
1212
1213 /// The translation unit is a is a complete translation unit that we might
1214 /// incrementally extend later.
1216};
1217
1218} // namespace clang
1219
1220#endif // LLVM_CLANG_BASIC_LANGOPTIONS_H
Defines the clang::CommentOptions interface.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines types useful for describing an Objective-C runtime.
Defines the clang::SanitizerKind enum.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
Defines the clang::Visibility enumeration and various utility functions.
Represents difference between two FPOptions values.
static FPOptionsOverride getFromOpaqueInt(storage_type I)
bool operator!=(FPOptionsOverride other) const
FPOptionsOverride(FPOptions FPO)
LLVM_DUMP_METHOD void dump()
void setFPPreciseEnabled(bool Value)
FPOptionsOverride(FPOptions FPO, FPOptions::storage_type Mask)
FPOptions applyOverrides(FPOptions Base)
bool operator==(FPOptionsOverride other) const
llvm::RoundingMode RoundingMode
static constexpr storage_type OverrideMaskBits
Bit mask selecting bits of OverrideMask in serialized representation of FPOptionsOverride.
storage_type getAsOpaqueInt() const
FPOptions applyOverrides(const LangOptions &LO)
uint64_t storage_type
The type suitable for storing values of FPOptionsOverride.
FPOptionsOverride(const LangOptions &LO)
bool requiresTrailingStorage() const
void applyChanges(FPOptionsOverride FPO)
bool isFPConstrained() const
static constexpr storage_type FirstShift
FPOptionsOverride getChangesFrom(const FPOptions &Base) const
Return difference with the given option set.
storage_type getAsOpaqueInt() const
static constexpr storage_type TotalWidth
LangOptions::FPExceptionModeKind getExceptionMode() const
FPOptions(const LangOptions &LO)
static constexpr storage_type FirstWidth
void setAllowFPContractWithinStatement()
static FPOptions defaultWithoutTrailingStorage(const LangOptions &LO)
Return the default value of FPOptions that's used when trailing storage isn't required.
static FPOptions getFromOpaqueInt(storage_type Value)
bool allowFPContractAcrossStatement() const
uint32_t storage_type
bool operator==(FPOptions other) const
bool allowFPContractWithinStatement() const
LLVM_DUMP_METHOD void dump()
void setAllowFPContractAcrossStatement()
static constexpr unsigned StorageBitSize
llvm::RoundingMode RoundingMode
RoundingMode getRoundingMode() const
Bitfields of LangOptions, split out from LangOptions in order to ensure that this large collection of...
Definition LangOptions.h:73
@ LoadReturnAddress
Hardened return address signing with load from the return address.
FPEvalMethodKind
Possible float expression evaluation method choices.
@ FEM_Extended
Use extended type for fp arithmetic.
@ FEM_Double
Use the type double for fp arithmetic.
@ FEM_UnsetOnCommandLine
Used only for FE option processing; this is only used to indicate that the user did not specify an ex...
@ FEM_Source
Use the declared type for fp arithmetic.
@ NonLeaf
Sign the return address of functions that spill LR.
@ All
Sign the return address of all functions,.
@ CMK_None
Not compiling a module interface at all.
@ CMK_HeaderUnit
Compiling a module header unit.
@ CMK_ModuleMap
Compiling a module from a module map.
@ CMK_ModuleInterface
Compiling a C++ modules interface unit.
ComplexRangeKind
Controls the various implementations for complex multiplication and.
@ CX_Full
Implementation of complex division and multiplication using a call to runtime library functions(gener...
@ CX_Basic
Implementation of complex division and multiplication using algebraic formulas at source precision.
@ CX_Promoted
Implementation of complex division using algebraic formulas at higher precision.
@ CX_None
No range rule is enabled.
@ CX_Improved
Implementation of complex division offering an improved handling for overflow in intermediate calcula...
@ Swift5_0
Interoperability with the Swift 5.0 runtime.
@ ObjectiveC
Interoperability with the ObjectiveC runtime.
@ Standalone
CoreFoundation does not have any language interoperability.
@ Unspecified
No interoperability ABI has been specified.
@ Swift
Interoperability with the latest known version of the Swift runtime.
@ Swift4_2
Interoperability with the Swift 4.2 runtime.
@ Swift4_1
Interoperability with the Swift 4.1 runtime.
llvm::RoundingMode RoundingMode
Definition LangOptions.h:79
clang::MSVtorDispMode MSVtorDispMode
@ PerThread
Per-thread default stream.
@ ForceProtected
Force protected visibility.
@ BKey
Return address signing uses APIB key.
@ AKey
Return address signing uses APIA key.
@ ExtendTo32
Integer arguments are sign or zero extended to 32/64 bits during default argument promotions.
@ Single
Single Threaded Environment.
@ Integer
Permit vector bitcasts between integer vectors with different numbers of elements but the same total ...
@ ZeroOrIncomplete
Any trailing array member of undefined or 0 size is a FAM.
@ OneZeroOrIncomplete
Any trailing array member of undefined, 0, or 1 size is a FAM.
@ IncompleteOnly
Any trailing array member of undefined size is a FAM.
@ Microsoft
Use Microsoft C++ ABI rules for bit-field layout and fundamental types alignment.
@ Itanium
Use Itanium rules for bit-field layout and fundamental types alignment.
friend class CompilerInvocationBase
Definition LangOptions.h:75
OverflowPatternExclusionKind
Exclude certain code patterns from being instrumented by arithmetic overflow sanitizers.
@ None
Don't exclude any overflow patterns from sanitizers.
@ AddUnsignedOverflowTest
if (a + b < a)
@ All
Exclude all overflow patterns (below)
@ AddSignedOverflowTest
if (a + b < a)
@ PostDecrInWhile
while (count–)
clang::Visibility Visibility
Definition LangOptions.h:78
@ Explicit
map only explicit default visibilities to exported
@ All
map all default visibilities to exported
CompatibilityKind
For ASTs produced with different option value, signifies their level of compatibility.
Definition LangOptions.h:84
@ NotCompatible
Does affect the construction of the AST in a way that does prevent module interoperability.
Definition LangOptions.h:87
@ Compatible
Does affect the construction of the AST in a way that doesn't prevent interoperability (that is,...
Definition LangOptions.h:91
@ Benign
Does not affect the construction of the AST in any way (that is, the value can be different between a...
Definition LangOptions.h:95
FPExceptionModeKind
Possible floating point exception behavior.
@ FPE_Default
Used internally to represent initial unspecified value.
@ FPE_Strict
Strictly preserve the floating-point exception semantics.
@ FPE_MayTrap
Transformations do not cause new exceptions but may hide some.
@ FPE_Ignore
Assume that floating-point exceptions are masked.
clang::CFBranchLabelSchemeKind CFBranchLabelSchemeKind
Definition LangOptions.h:80
friend class CompilerInvocation
Definition LangOptions.h:74
@ Protected
Override the IR-gen assigned visibility with protected visibility.
@ Hidden
Override the IR-gen assigned visibility with hidden visibility.
ClangABI
Clang versions with different platform ABI conformance.
RegisterStaticDestructorsKind
Controls which variables have static destructors registered.
@ ThreadLocal
Register static destructors only for thread-local variables.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
SanitizerSet UBSanFeatureIgnoredSanitize
Set of (UBSan) sanitizers that when enabled do not cause __has_feature(undefined_behavior_sanitizer) ...
bool isSignReturnAddressWithAKey() const
Check if return address signing uses AKey.
void resetNonModularOptions()
Reset all of the options that are not considered when building a module.
std::vector< std::string > OverflowPatternExclusionValues
std::optional< TargetCXXABI::Kind > CXXABI
C++ ABI to compile with, if specified by the frontend through -fc++-abi=.
bool isCompatibleWithMSVC(MSVCMajorVersion MajorVersion) const
std::vector< std::string > NoBuiltinFuncs
A list of all -fno-builtin-* function names (e.g., memset).
std::string ModuleName
The module currently being compiled as specified by -fmodule-name.
std::vector< std::string > XRayNeverInstrumentFiles
Paths to the XRay "never instrument" files specifying which objects (files, functions,...
FPExceptionModeKind getDefaultExceptionMode() const
bool requiresStrictPrototypes() const
Returns true if functions without prototypes or functions with an identifier list (aka K&R C function...
bool isImplicitIntAllowed() const
Returns true if implicit int is supported at all.
bool isCompilingModuleImplementation() const
Are we compiling a module implementation?
bool isNoBuiltinFunc(StringRef Name) const
Is this a libc/libm function that is no longer recognized as a builtin because a -fno-builtin-* optio...
bool hasBoundsSafetyAttributes() const
Return true if using -fbounds-safety in full or attribute-only mode.
clang::ObjCRuntime ObjCRuntime
CoreFoundationABI CFRuntime
std::string getOpenCLVersionString() const
Return the OpenCL C or C++ for OpenCL language name and version as a string.
unsigned OverflowPatternExclusionMask
Which overflow patterns should be excluded from sanitizer instrumentation.
bool IsHeaderFile
Indicates whether the front-end is explicitly told that the input is a header file (i....
bool hasDefaultVisibilityExportMapping() const
llvm::omp::Version getOpenMPVersion() const
Return the OpenMP version.
SanitizerSet Sanitize
Set of enabled sanitizers.
std::string LiteralEncoding
Name of the literal encoding to convert the internal encoding to.
std::optional< llvm::AllocTokenMode > AllocTokenMode
The allocation token mode.
CommentOptions CommentOpts
Options for parsing comments.
bool isExplicitDefaultVisibilityExportMapping() const
std::vector< std::string > XRayAlwaysInstrumentFiles
Paths to the XRay "always instrument" files specifying which objects (files, functions,...
bool hasAtExit() const
Returns true if the language supports calling the 'atexit' function.
bool trackLocalOwningModule() const
Do we need to track the owning module for a local declaration?
bool isAllDefaultVisibilityExportMapping() const
bool isSubscriptPointerArithmetic() const
bool UseTargetPathSeparator
Indicates whether to use target's platform-specific file separator when FILE macro is used and when c...
std::string ObjCConstantIntegerNumberClass
bool isSignedOverflowDefined() const
bool hasDefaultGlobalAllocationFunctionVisibility() const
bool hasGlobalAllocationFunctionVisibility() const
VersionTuple getOpenCLVersionTuple() const
Return the OpenCL C or C++ version as a VersionTuple.
std::string ObjCConstantDoubleNumberClass
bool implicitFunctionsAllowed() const
Returns true if implicit function declarations are allowed in the current language mode.
bool hasSignReturnAddress() const
Check if return address signing is enabled.
std::string LifetimeSafetyLifetimeBoundMacro
Macro name to use in lifetimebound fix-it suggestions.
bool hasSignReturnAddressHardening() const
Check if return address authentication hardening is enabled.
static void setLangDefaults(LangOptions &Opts, Language Lang, const llvm::Triple &T, std::vector< std::string > &Includes, LangStandard::Kind LangStd=LangStandard::lang_unspecified)
Set language defaults for the given input language and language standard in the given LangOptions obj...
bool isCompatibleWith(ClangABI Version) const
bool isCompatibleWithMSVC() const
bool assumeFunctionsAreConvergent() const
std::string OMPHostIRFile
Name of the IR file that contains the result of the OpenMP target host code generation.
bool allowsNonTrivialObjCLifetimeQualifiers() const
True if any ObjC types may have non-trivial lifetime qualifiers.
bool isOverflowPatternExcluded(OverflowPatternExclusionKind Kind) const
bool allowArrayReturnTypes() const
std::string OverflowHandler
The name of the handler function to be called when -ftrapv is specified.
std::string HLSLRootSigOverride
The HLSL root signature that will be used to overide the root signature used for the shader entry poi...
bool hasHiddenGlobalAllocationFunctionVisibility() const
std::string RandstructSeed
The seed used by the randomize structure layout feature.
std::map< std::string, std::string, std::greater< std::string > > MacroPrefixMap
A prefix map for FILE, BASE_FILE and __builtin_FILE().
std::vector< std::string > ProfileListFiles
Paths to special case list files specifying which entities (files, functions) should or should not be...
void remapPathPrefix(SmallVectorImpl< char > &Path) const
Remap path prefix according to -fmacro-prefix-path option.
bool isTargetDevice() const
True when compiling for an offloading target device.
std::optional< uint64_t > AllocTokenMax
Maximum number of allocation tokens (0 = target SIZE_MAX), nullopt if none set (use target SIZE_MAX).
bool hasProtectedGlobalAllocationFunctionVisibility() const
std::optional< uint32_t > getCPlusPlusLangStd() const
Returns the most applicable C++ standard-compliant language version code.
LangStandard::Kind LangStd
The used language standard.
llvm::dxbc::RootSignatureVersion HLSLRootSigVer
The HLSL root signature version for dxil.
std::optional< uint32_t > getCLangStd() const
Returns the most applicable C standard-compliant language version code.
RoundingMode getDefaultRoundingMode() const
bool isCompilingModule() const
Are we compiling a module?
bool isImplicitIntRequired() const
Returns true if implicit int is part of the language requirements.
bool isSignReturnAddressScopeAll() const
Check if leaf functions are also signed.
bool isSYCL() const
std::string ObjCConstantArrayClass
std::string ObjCConstantStringClass
std::string CUID
The user provided compilation unit ID, if non-empty.
unsigned getOpenCLCompatibleVersion() const
Return the OpenCL version that kernel language is compatible with.
std::string ObjCConstantDictionaryClass
std::string ObjCConstantFloatNumberClass
GPUDefaultStreamKind GPUDefaultStream
The default stream kind used for HIP kernel launching.
bool AtomicRemoteMemory
Atomic code-generation options.
bool threadPrivateMemoryAtomicsAreUndefined() const
Return true if atomicrmw operations targeting allocations in private memory are undefined.
std::vector< std::string > XRayAttrListFiles
Paths to the XRay attribute list files, specifying which objects (files, functions,...
bool SanitizeCoverage
Is at least one coverage instrumentation type enabled.
std::vector< llvm::Triple > OMPTargetTriples
Triples of the OpenMP targets that the host code codegen should take into account in order to generat...
std::vector< std::string > NoSanitizeFiles
Paths to files specifying which objects (files, functions, variables) should not be instrumented.
std::string CurrentModule
The name of the current module, of which the main source file is a part.
std::vector< std::string > ModuleFeatures
The names of any features to enable in module 'requires' decls in addition to the hard-coded list in ...
The basic abstraction for the target Objective-C runtime.
Definition ObjCRuntime.h:28
Top level wrappers for InstallAPI frontend operations.
@ CPlusPlus
Language
The language for the input, used to select and validate the language standard and possible actions.
@ Result
The result type of a method or function.
Definition TypeBase.h:906
const FunctionProtoType * T
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
Definition LangOptions.h:39
ShaderStage
Shader programs run in specific pipeline stages.
Definition LangOptions.h:45
TranslationUnitKind
Describes the kind of translation unit being processed.
@ TU_Incremental
The translation unit is a is a complete translation unit that we might incrementally extend later.
@ TU_Complete
The translation unit is a complete translation unit.
@ TU_ClangModule
The translation unit is a clang module.
@ TU_Prefix
The translation unit is a prefix to a translation unit, and is not complete.
PointerAuthenticationMode
Definition LangOptions.h:64
Visibility
Describes the different kinds of visibility that a declaration may have.
Definition Visibility.h:34
void setOption(AtomicOptionKind Kind, bool Value)
LLVM_DUMP_METHOD void dump() const
unsigned ignore_denormal_mode
bool getOption(AtomicOptionKind Kind) const
Options for controlling comment parsing.