Coverage Report

Created: 2022-05-21 09:15

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Basic/LangOptions.h
Line
Count
Source (jump to first uncovered line)
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
17
#include "clang/Basic/CommentOptions.h"
18
#include "clang/Basic/LLVM.h"
19
#include "clang/Basic/LangStandard.h"
20
#include "clang/Basic/ObjCRuntime.h"
21
#include "clang/Basic/Sanitizers.h"
22
#include "clang/Basic/TargetCXXABI.h"
23
#include "clang/Basic/Visibility.h"
24
#include "llvm/ADT/FloatingPointMode.h"
25
#include "llvm/ADT/StringRef.h"
26
#include "llvm/ADT/Triple.h"
27
#include <string>
28
#include <vector>
29
30
namespace clang {
31
32
/// Bitfields of LangOptions, split out from LangOptions in order to ensure that
33
/// this large collection of bitfields is a trivial class type.
34
class LangOptionsBase {
35
  friend class CompilerInvocation;
36
37
public:
38
  // Define simple language options (with no accessors).
39
#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits;
40
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description)
41
#include "clang/Basic/LangOptions.def"
42
43
protected:
44
  // Define language options of enumeration type. These are private, and will
45
  // have accessors (below).
46
#define LANGOPT(Name, Bits, Default, Description)
47
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
48
  unsigned Name : Bits;
49
#include "clang/Basic/LangOptions.def"
50
};
51
52
/// In the Microsoft ABI, this controls the placement of virtual displacement
53
/// members used to implement virtual inheritance.
54
enum class MSVtorDispMode { Never, ForVBaseOverride, ForVFTable };
55
56
/// Shader programs run in specific pipeline stages.
57
enum class ShaderStage {
58
  Pixel = 0,
59
  Vertex,
60
  Geometry,
61
  Hull,
62
  Domain,
63
  Compute,
64
  Library,
65
  RayGeneration,
66
  Intersection,
67
  AnyHit,
68
  ClosestHit,
69
  Miss,
70
  Callable,
71
  Mesh,
72
  Amplification,
73
  Invalid,
74
};
75
76
/// Keeps track of the various options that can be
77
/// enabled, which controls the dialect of C or C++ that is accepted.
78
class LangOptions : public LangOptionsBase {
79
public:
80
  using Visibility = clang::Visibility;
81
  using RoundingMode = llvm::RoundingMode;
82
83
  enum GCMode { NonGC, GCOnly, HybridGC };
84
  enum StackProtectorMode { SSPOff, SSPOn, SSPStrong, SSPReq };
85
86
  // Automatic variables live on the stack, and when trivial they're usually
87
  // uninitialized because it's undefined behavior to use them without
88
  // initializing them.
89
  enum class TrivialAutoVarInitKind { Uninitialized, Zero, Pattern };
90
91
  enum SignedOverflowBehaviorTy {
92
    // Default C standard behavior.
93
    SOB_Undefined,
94
95
    // -fwrapv
96
    SOB_Defined,
97
98
    // -ftrapv
99
    SOB_Trapping
100
  };
101
102
  // FIXME: Unify with TUKind.
103
  enum CompilingModuleKind {
104
    /// Not compiling a module interface at all.
105
    CMK_None,
106
107
    /// Compiling a module from a module map.
108
    CMK_ModuleMap,
109
110
    /// Compiling a module from a list of header files.
111
    CMK_HeaderModule,
112
113
    /// Compiling a module header unit.
114
    CMK_HeaderUnit,
115
116
    /// Compiling a C++ modules TS module interface unit.
117
    CMK_ModuleInterface,
118
  };
119
120
  enum PragmaMSPointersToMembersKind {
121
    PPTMK_BestCase,
122
    PPTMK_FullGeneralitySingleInheritance,
123
    PPTMK_FullGeneralityMultipleInheritance,
124
    PPTMK_FullGeneralityVirtualInheritance
125
  };
126
127
  using MSVtorDispMode = clang::MSVtorDispMode;
128
129
  enum DefaultCallingConvention {
130
    DCC_None,
131
    DCC_CDecl,
132
    DCC_FastCall,
133
    DCC_StdCall,
134
    DCC_VectorCall,
135
    DCC_RegCall
136
  };
137
138
  enum AddrSpaceMapMangling { ASMM_Target, ASMM_On, ASMM_Off };
139
140
  // Corresponds to _MSC_VER
141
  enum MSVCMajorVersion {
142
    MSVC2010 = 1600,
143
    MSVC2012 = 1700,
144
    MSVC2013 = 1800,
145
    MSVC2015 = 1900,
146
    MSVC2017 = 1910,
147
    MSVC2017_5 = 1912,
148
    MSVC2017_7 = 1914,
149
    MSVC2019 = 1920,
150
    MSVC2019_5 = 1925,
151
    MSVC2019_8 = 1928,
152
  };
153
154
  enum SYCLMajorVersion {
155
    SYCL_None,
156
    SYCL_2017,
157
    SYCL_2020,
158
    // The "default" SYCL version to be used when none is specified on the
159
    // frontend command line.
160
    SYCL_Default = SYCL_2020
161
  };
162
163
  enum HLSLLangStd {
164
    HLSL_Unset = 0,
165
    HLSL_2015 = 2015,
166
    HLSL_2016 = 2016,
167
    HLSL_2017 = 2017,
168
    HLSL_2018 = 2018,
169
    HLSL_2021 = 2021,
170
    HLSL_202x = 2029,
171
  };
172
173
  /// Clang versions with different platform ABI conformance.
174
  enum class ClangABI {
175
    /// Attempt to be ABI-compatible with code generated by Clang 3.8.x
176
    /// (SVN r257626). This causes <1 x long long> to be passed in an
177
    /// integer register instead of an SSE register on x64_64.
178
    Ver3_8,
179
180
    /// Attempt to be ABI-compatible with code generated by Clang 4.0.x
181
    /// (SVN r291814). This causes move operations to be ignored when
182
    /// determining whether a class type can be passed or returned directly.
183
    Ver4,
184
185
    /// Attempt to be ABI-compatible with code generated by Clang 6.0.x
186
    /// (SVN r321711). This causes determination of whether a type is
187
    /// standard-layout to ignore collisions between empty base classes
188
    /// and between base classes and member subobjects, which affects
189
    /// whether we reuse base class tail padding in some ABIs.
190
    Ver6,
191
192
    /// Attempt to be ABI-compatible with code generated by Clang 7.0.x
193
    /// (SVN r338536). This causes alignof (C++) and _Alignof (C11) to be
194
    /// compatible with __alignof (i.e., return the preferred alignment)
195
    /// rather than returning the required alignment.
196
    Ver7,
197
198
    /// Attempt to be ABI-compatible with code generated by Clang 9.0.x
199
    /// (SVN r351319). This causes vectors of __int128 to be passed in memory
200
    /// instead of passing in multiple scalar registers on x86_64 on Linux and
201
    /// NetBSD.
202
    Ver9,
203
204
    /// Attempt to be ABI-compatible with code generated by Clang 11.0.x
205
    /// (git 2e10b7a39b93). This causes clang to pass unions with a 256-bit
206
    /// vector member on the stack instead of using registers, to not properly
207
    /// mangle substitutions for template names in some cases, and to mangle
208
    /// declaration template arguments without a cast to the parameter type
209
    /// even when that can lead to mangling collisions.
210
    Ver11,
211
212
    /// Attempt to be ABI-compatible with code generated by Clang 12.0.x
213
    /// (git 8e464dd76bef). This causes clang to mangle lambdas within
214
    /// global-scope inline variables incorrectly.
215
    Ver12,
216
217
    /// Attempt to be ABI-compatible with code generated by Clang 13.0.x.
218
    /// This causes clang to not pack non-POD members of packed structs.
219
    Ver13,
220
221
    /// Attempt to be ABI-compatible with code generated by Clang 14.0.x.
222
    /// This causes clang to mangle dependent nested names incorrectly.
223
    Ver14,
224
225
    /// Conform to the underlying platform's C and C++ ABIs as closely
226
    /// as we can.
227
    Latest
228
  };
229
230
  enum class CoreFoundationABI {
231
    /// No interoperability ABI has been specified
232
    Unspecified,
233
    /// CoreFoundation does not have any language interoperability
234
    Standalone,
235
    /// Interoperability with the ObjectiveC runtime
236
    ObjectiveC,
237
    /// Interoperability with the latest known version of the Swift runtime
238
    Swift,
239
    /// Interoperability with the Swift 5.0 runtime
240
    Swift5_0,
241
    /// Interoperability with the Swift 4.2 runtime
242
    Swift4_2,
243
    /// Interoperability with the Swift 4.1 runtime
244
    Swift4_1,
245
  };
246
247
  enum FPModeKind {
248
    // Disable the floating point pragma
249
    FPM_Off,
250
251
    // Enable the floating point pragma
252
    FPM_On,
253
254
    // Aggressively fuse FP ops (E.g. FMA) disregarding pragmas.
255
    FPM_Fast,
256
257
    // Aggressively fuse FP ops and honor pragmas.
258
    FPM_FastHonorPragmas
259
  };
260
261
  /// Alias for RoundingMode::NearestTiesToEven.
262
  static constexpr unsigned FPR_ToNearest =
263
      static_cast<unsigned>(llvm::RoundingMode::NearestTiesToEven);
264
265
  /// Possible floating point exception behavior.
266
  enum FPExceptionModeKind {
267
    /// Assume that floating-point exceptions are masked.
268
    FPE_Ignore,
269
    /// Transformations do not cause new exceptions but may hide some.
270
    FPE_MayTrap,
271
    /// Strictly preserve the floating-point exception semantics.
272
    FPE_Strict
273
  };
274
275
  /// Possible float expression evaluation method choices.
276
  enum FPEvalMethodKind {
277
    /// The evaluation method cannot be determined or is inconsistent for this
278
    /// target.
279
    FEM_Indeterminable = -1,
280
    /// Use the declared type for fp arithmetic.
281
    FEM_Source = 0,
282
    /// Use the type double for fp arithmetic.
283
    FEM_Double = 1,
284
    /// Use extended type for fp arithmetic.
285
    FEM_Extended = 2,
286
    /// Used only for FE option processing; this is only used to indicate that
287
    /// the user did not specify an explicit evaluation method on the command
288
    /// line and so the target should be queried for its default evaluation
289
    /// method instead.
290
    FEM_UnsetOnCommandLine = 3
291
  };
292
293
  /// Possible exception handling behavior.
294
  enum class ExceptionHandlingKind { None, SjLj, WinEH, DwarfCFI, Wasm };
295
296
  enum class LaxVectorConversionKind {
297
    /// Permit no implicit vector bitcasts.
298
    None,
299
    /// Permit vector bitcasts between integer vectors with different numbers
300
    /// of elements but the same total bit-width.
301
    Integer,
302
    /// Permit vector bitcasts between all vectors with the same total
303
    /// bit-width.
304
    All,
305
  };
306
307
  enum class AltivecSrcCompatKind {
308
    // All vector compares produce scalars except vector pixel and vector bool.
309
    // The types vector pixel and vector bool return vector results.
310
    Mixed,
311
    // All vector compares produce vector results as in GCC.
312
    GCC,
313
    // All vector compares produce scalars as in XL.
314
    XL,
315
    // Default clang behaviour.
316
    Default = Mixed,
317
  };
318
319
  enum class SignReturnAddressScopeKind {
320
    /// No signing for any function.
321
    None,
322
    /// Sign the return address of functions that spill LR.
323
    NonLeaf,
324
    /// Sign the return address of all functions,
325
    All
326
  };
327
328
  enum class SignReturnAddressKeyKind {
329
    /// Return address signing uses APIA key.
330
    AKey,
331
    /// Return address signing uses APIB key.
332
    BKey
333
  };
334
335
  enum class ThreadModelKind {
336
    /// POSIX Threads.
337
    POSIX,
338
    /// Single Threaded Environment.
339
    Single
340
  };
341
342
  enum class ExtendArgsKind {
343
    /// Integer arguments are sign or zero extended to 32/64 bits
344
    /// during default argument promotions.
345
    ExtendTo32,
346
    ExtendTo64
347
  };
348
349
  enum class GPUDefaultStreamKind {
350
    /// Legacy default stream
351
    Legacy,
352
    /// Per-thread default stream
353
    PerThread,
354
  };
355
356
public:
357
  /// The used language standard.
358
  LangStandard::Kind LangStd;
359
360
  /// Set of enabled sanitizers.
361
  SanitizerSet Sanitize;
362
  /// Is at least one coverage instrumentation type enabled.
363
  bool SanitizeCoverage = false;
364
365
  /// Paths to files specifying which objects
366
  /// (files, functions, variables) should not be instrumented.
367
  std::vector<std::string> NoSanitizeFiles;
368
369
  /// Paths to the XRay "always instrument" files specifying which
370
  /// objects (files, functions, variables) should be imbued with the XRay
371
  /// "always instrument" attribute.
372
  /// WARNING: This is a deprecated field and will go away in the future.
373
  std::vector<std::string> XRayAlwaysInstrumentFiles;
374
375
  /// Paths to the XRay "never instrument" files specifying which
376
  /// objects (files, functions, variables) should be imbued with the XRay
377
  /// "never instrument" attribute.
378
  /// WARNING: This is a deprecated field and will go away in the future.
379
  std::vector<std::string> XRayNeverInstrumentFiles;
380
381
  /// Paths to the XRay attribute list files, specifying which objects
382
  /// (files, functions, variables) should be imbued with the appropriate XRay
383
  /// attribute(s).
384
  std::vector<std::string> XRayAttrListFiles;
385
386
  /// Paths to special case list files specifying which entities
387
  /// (files, functions) should or should not be instrumented.
388
  std::vector<std::string> ProfileListFiles;
389
390
  clang::ObjCRuntime ObjCRuntime;
391
392
  CoreFoundationABI CFRuntime = CoreFoundationABI::Unspecified;
393
394
  std::string ObjCConstantStringClass;
395
396
  /// The name of the handler function to be called when -ftrapv is
397
  /// specified.
398
  ///
399
  /// If none is specified, abort (GCC-compatible behaviour).
400
  std::string OverflowHandler;
401
402
  /// The module currently being compiled as specified by -fmodule-name.
403
  std::string ModuleName;
404
405
  /// The name of the current module, of which the main source file
406
  /// is a part. If CompilingModule is set, we are compiling the interface
407
  /// of this module, otherwise we are compiling an implementation file of
408
  /// it. This starts as ModuleName in case -fmodule-name is provided and
409
  /// changes during compilation to reflect the current module.
410
  std::string CurrentModule;
411
412
  /// The names of any features to enable in module 'requires' decls
413
  /// in addition to the hard-coded list in Module.cpp and the target features.
414
  ///
415
  /// This list is sorted.
416
  std::vector<std::string> ModuleFeatures;
417
418
  /// Options for parsing comments.
419
  CommentOptions CommentOpts;
420
421
  /// A list of all -fno-builtin-* function names (e.g., memset).
422
  std::vector<std::string> NoBuiltinFuncs;
423
424
  /// A prefix map for __FILE__, __BASE_FILE__ and __builtin_FILE().
425
  std::map<std::string, std::string, std::greater<std::string>> MacroPrefixMap;
426
427
  /// Triples of the OpenMP targets that the host code codegen should
428
  /// take into account in order to generate accurate offloading descriptors.
429
  std::vector<llvm::Triple> OMPTargetTriples;
430
431
  /// Name of the IR file that contains the result of the OpenMP target
432
  /// host code generation.
433
  std::string OMPHostIRFile;
434
435
  /// The user provided compilation unit ID, if non-empty. This is used to
436
  /// externalize static variables which is needed to support accessing static
437
  /// device variables in host code for single source offloading languages
438
  /// like CUDA/HIP.
439
  std::string CUID;
440
441
  /// C++ ABI to compile with, if specified by the frontend through -fc++-abi=.
442
  /// This overrides the default ABI used by the target.
443
  llvm::Optional<TargetCXXABI::Kind> CXXABI;
444
445
  /// Indicates whether the front-end is explicitly told that the
446
  /// input is a header file (i.e. -x c-header).
447
  bool IsHeaderFile = false;
448
449
  /// The default stream kind used for HIP kernel launching.
450
  GPUDefaultStreamKind GPUDefaultStream;
451
452
  /// The seed used by the randomize structure layout feature.
453
  std::string RandstructSeed;
454
455
  /// Indicates whether the __FILE__ macro should use the target's
456
  /// platform-specific file separator or whether it should use the build
457
  /// environment's platform-specific file separator.
458
  ///
459
  /// The plaform-specific path separator is the backslash(\) for Windows and
460
  /// forward slash (/) elsewhere.
461
  bool UseTargetPathSeparator = false;
462
463
  LangOptions();
464
465
  /// Set language defaults for the given input language and
466
  /// language standard in the given LangOptions object.
467
  ///
468
  /// \param Opts - The LangOptions object to set up.
469
  /// \param Lang - The input language.
470
  /// \param T - The target triple.
471
  /// \param Includes - If the language requires extra headers to be implicitly
472
  ///                   included, they will be appended to this list.
473
  /// \param LangStd - The input language standard.
474
  static void
475
  setLangDefaults(LangOptions &Opts, Language Lang, const llvm::Triple &T,
476
                  std::vector<std::string> &Includes,
477
                  LangStandard::Kind LangStd = LangStandard::lang_unspecified);
478
479
  // Define accessors/mutators for language options of enumeration type.
480
#define LANGOPT(Name, Bits, Default, Description)
481
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
482
227M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getLaxVectorConversions() const
Line
Count
Source
482
406k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getAltivecSrcCompat() const
Line
Count
Source
482
7.22M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getExceptionHandling() const
Line
Count
Source
482
831k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getCompilingModule() const
Line
Count
Source
482
162M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getMSPointerToMemberRepresentationMethod() const
Line
Count
Source
482
123k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getDefaultCallingConv() const
Line
Count
Source
482
24.0M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getHLSLVersion() const
Line
Count
Source
482
36.2k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getSYCLVersion() const
Line
Count
Source
482
36.2k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getDefaultFPContractMode() const
Line
Count
Source
482
1.96M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getFPRoundingMode() const
Line
Count
Source
482
2.26M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getFPExceptionMode() const
Line
Count
Source
482
2.61M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getFPEvalMethod() const
Line
Count
Source
482
96.6k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getAddressSpaceMapMangling() const
Line
Count
Source
482
131k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getGC() const
Line
Count
Source
482
9.30M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getValueVisibilityMode() const
Line
Count
Source
482
901k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getTypeVisibilityMode() const
Line
Count
Source
482
215k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getDLLExportVisibility() const
Line
Count
Source
482
36.1k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getNoDLLStorageClassVisibility() const
Line
Count
Source
482
36.1k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getExternDeclDLLImportVisibility() const
Line
Count
Source
482
36.1k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getExternDeclNoDLLStorageClassVisibility() const
Line
Count
Source
482
36.1k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getStackProtector() const
Line
Count
Source
482
1.03M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getTrivialAutoVarInit() const
Line
Count
Source
482
273k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getSignedOverflowBehavior() const
Line
Count
Source
482
403k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getThreadModel() const
Line
Count
Source
482
121k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getVtorDispMode() const
Line
Count
Source
482
1.22M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getClangABICompat() const
Line
Count
Source
482
10.5M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getSignReturnAddressScope() const
Line
Count
Source
482
328k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getSignReturnAddressKey() const
Line
Count
Source
482
180k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::LangOptions::getExtendIntArgs() const
Line
Count
Source
482
113k
  Type get##Name() const { return static_cast<Type>(Name); } \
483
323M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setLaxVectorConversions(clang::LangOptions::LaxVectorConversionKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setAltivecSrcCompat(clang::LangOptions::AltivecSrcCompatKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setExceptionHandling(clang::LangOptions::ExceptionHandlingKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setCompilingModule(clang::LangOptions::CompilingModuleKind)
Line
Count
Source
483
11.2M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setMSPointerToMemberRepresentationMethod(clang::LangOptions::PragmaMSPointersToMembersKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setDefaultCallingConv(clang::LangOptions::DefaultCallingConvention)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setHLSLVersion(clang::LangOptions::HLSLLangStd)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setSYCLVersion(clang::LangOptions::SYCLMajorVersion)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setDefaultFPContractMode(clang::LangOptions::FPModeKind)
Line
Count
Source
483
11.2M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setFPRoundingMode(llvm::RoundingMode)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setFPExceptionMode(clang::LangOptions::FPExceptionModeKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setFPEvalMethod(clang::LangOptions::FPEvalMethodKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setAddressSpaceMapMangling(clang::LangOptions::AddrSpaceMapMangling)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setGC(clang::LangOptions::GCMode)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setValueVisibilityMode(clang::Visibility)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setTypeVisibilityMode(clang::Visibility)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setDLLExportVisibility(clang::Visibility)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setNoDLLStorageClassVisibility(clang::Visibility)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setExternDeclDLLImportVisibility(clang::Visibility)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setExternDeclNoDLLStorageClassVisibility(clang::Visibility)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setStackProtector(clang::LangOptions::StackProtectorMode)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setTrivialAutoVarInit(clang::LangOptions::TrivialAutoVarInitKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setSignedOverflowBehavior(clang::LangOptions::SignedOverflowBehaviorTy)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setThreadModel(clang::LangOptions::ThreadModelKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setVtorDispMode(clang::MSVtorDispMode)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setClangABICompat(clang::LangOptions::ClangABI)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setSignReturnAddressScope(clang::LangOptions::SignReturnAddressScopeKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setSignReturnAddressKey(clang::LangOptions::SignReturnAddressKeyKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::LangOptions::setExtendIntArgs(clang::LangOptions::ExtendArgsKind)
Line
Count
Source
483
11.1M
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
484
#include "clang/Basic/LangOptions.def"
485
486
  /// Are we compiling a module interface (.cppm or module map)?
487
162M
  bool isCompilingModule() const {
488
162M
    return getCompilingModule() != CMK_None;
489
162M
  }
490
491
  /// Do we need to track the owning module for a local declaration?
492
142M
  bool trackLocalOwningModule() const {
493
142M
    return isCompilingModule() || 
ModulesLocalVisibility131M
;
494
142M
  }
495
496
103k
  bool isSignedOverflowDefined() const {
497
103k
    return getSignedOverflowBehavior() == SOB_Defined;
498
103k
  }
499
500
591
  bool isSubscriptPointerArithmetic() const {
501
591
    return ObjCRuntime.isSubscriptPointerArithmetic() &&
502
591
           
!ObjCSubscriptingLegacyRuntime17
;
503
591
  }
504
505
103k
  bool isCompatibleWithMSVC(MSVCMajorVersion MajorVersion) const {
506
103k
    return MSCompatibilityVersion >= MajorVersion * 100000U;
507
103k
  }
508
509
  /// Reset all of the options that are not considered when building a
510
  /// module.
511
  void resetNonModularOptions();
512
513
  /// Is this a libc/libm function that is no longer recognized as a
514
  /// builtin because a -fno-builtin-* option has been specified?
515
  bool isNoBuiltinFunc(StringRef Name) const;
516
517
  /// True if any ObjC types may have non-trivial lifetime qualifiers.
518
6.29M
  bool allowsNonTrivialObjCLifetimeQualifiers() const {
519
6.29M
    return ObjCAutoRefCount || 
ObjCWeak6.25M
;
520
6.29M
  }
521
522
720k
  bool assumeFunctionsAreConvergent() const {
523
720k
    return ConvergentFunctions;
524
720k
  }
525
526
  /// Return the OpenCL C or C++ version as a VersionTuple.
527
  VersionTuple getOpenCLVersionTuple() const;
528
529
  /// Return the OpenCL version that kernel language is compatible with
530
  unsigned getOpenCLCompatibleVersion() const;
531
532
  /// Return the OpenCL C or C++ for OpenCL language name and version
533
  /// as a string.
534
  std::string getOpenCLVersionString() const;
535
536
  /// Returns true if functions without prototypes or functions with an
537
  /// identifier list (aka K&R C functions) are not allowed.
538
133M
  bool requiresStrictPrototypes() const {
539
133M
    return CPlusPlus || 
C2x76.3M
||
DisableKNRFunctions76.3M
;
540
133M
  }
541
542
  /// Returns true if implicit function declarations are allowed in the current
543
  /// language mode.
544
5.17k
  bool implicitFunctionsAllowed() const {
545
5.17k
    return !requiresStrictPrototypes() && 
!OpenCL1.06k
;
546
5.17k
  }
547
548
  /// Returns true if implicit int is part of the language requirements.
549
2.77M
  bool isImplicitIntRequired() const { return !CPlusPlus && 
!C991.76M
; }
550
551
  /// Returns true if implicit int is supported at all.
552
1.92k
  bool isImplicitIntAllowed() const { return !CPlusPlus && 
!C2x505
; }
553
554
  /// Check if return address signing is enabled.
555
7.37k
  bool hasSignReturnAddress() const {
556
7.37k
    return getSignReturnAddressScope() != SignReturnAddressScopeKind::None;
557
7.37k
  }
558
559
  /// Check if return address signing uses AKey.
560
3.11k
  bool isSignReturnAddressWithAKey() const {
561
3.11k
    return getSignReturnAddressKey() == SignReturnAddressKeyKind::AKey;
562
3.11k
  }
563
564
  /// Check if leaf functions are also signed.
565
3.12k
  bool isSignReturnAddressScopeAll() const {
566
3.12k
    return getSignReturnAddressScope() == SignReturnAddressScopeKind::All;
567
3.12k
  }
568
569
186k
  bool hasSjLjExceptions() const {
570
186k
    return getExceptionHandling() == ExceptionHandlingKind::SjLj;
571
186k
  }
572
573
186k
  bool hasSEHExceptions() const {
574
186k
    return getExceptionHandling() == ExceptionHandlingKind::WinEH;
575
186k
  }
576
577
185k
  bool hasDWARFExceptions() const {
578
185k
    return getExceptionHandling() == ExceptionHandlingKind::DwarfCFI;
579
185k
  }
580
581
95.2k
  bool hasWasmExceptions() const {
582
95.2k
    return getExceptionHandling() == ExceptionHandlingKind::Wasm;
583
95.2k
  }
584
585
17.8M
  bool isSYCL() const { return SYCLIsDevice || 
SYCLIsHost17.8M
; }
586
587
  /// Remap path prefix according to -fmacro-prefix-path option.
588
  void remapPathPrefix(SmallVectorImpl<char> &Path) const;
589
};
590
591
/// Floating point control options
592
class FPOptionsOverride;
593
class FPOptions {
594
public:
595
  // We start by defining the layout.
596
  using storage_type = uint16_t;
597
598
  using RoundingMode = llvm::RoundingMode;
599
600
  static constexpr unsigned StorageBitSize = 8 * sizeof(storage_type);
601
602
  // Define a fake option named "First" so that we have a PREVIOUS even for the
603
  // real first option.
604
  static constexpr storage_type FirstShift = 0, FirstWidth = 0;
605
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS)                                    \
606
  static constexpr storage_type NAME##Shift =                                  \
607
      PREVIOUS##Shift + PREVIOUS##Width;                                       \
608
  static constexpr storage_type NAME##Width = WIDTH;                           \
609
  static constexpr storage_type NAME##Mask = ((1 << NAME##Width) - 1)          \
610
                                             << NAME##Shift;
611
#include "clang/Basic/FPOptions.def"
612
613
  static constexpr storage_type TotalWidth = 0
614
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) +WIDTH
615
#include "clang/Basic/FPOptions.def"
616
      ;
617
  static_assert(TotalWidth <= StorageBitSize, "Too short type for FPOptions");
618
619
private:
620
  storage_type Value;
621
622
public:
623
83.9M
  FPOptions() : Value(0) {
624
83.9M
    setFPContractMode(LangOptions::FPM_Off);
625
83.9M
    setRoundingMode(static_cast<RoundingMode>(LangOptions::FPR_ToNearest));
626
83.9M
    setFPExceptionMode(LangOptions::FPE_Ignore);
627
83.9M
  }
628
1.94M
  explicit FPOptions(const LangOptions &LO) {
629
1.94M
    Value = 0;
630
    // The language fp contract option FPM_FastHonorPragmas has the same effect
631
    // as FPM_Fast in frontend. For simplicity, use FPM_Fast uniformly in
632
    // frontend.
633
1.94M
    auto LangOptContractMode = LO.getDefaultFPContractMode();
634
1.94M
    if (LangOptContractMode == LangOptions::FPM_FastHonorPragmas)
635
568
      LangOptContractMode = LangOptions::FPM_Fast;
636
1.94M
    setFPContractMode(LangOptContractMode);
637
1.94M
    setRoundingMode(LO.getFPRoundingMode());
638
1.94M
    setFPExceptionMode(LO.getFPExceptionMode());
639
1.94M
    setAllowFPReassociate(LO.AllowFPReassoc);
640
1.94M
    setNoHonorNaNs(LO.NoHonorNaNs);
641
1.94M
    setNoHonorInfs(LO.NoHonorInfs);
642
1.94M
    setNoSignedZero(LO.NoSignedZero);
643
1.94M
    setAllowReciprocal(LO.AllowRecip);
644
1.94M
    setAllowApproxFunc(LO.ApproxFunc);
645
1.94M
    if (getFPContractMode() == LangOptions::FPM_On &&
646
1.94M
        
getRoundingMode() == llvm::RoundingMode::Dynamic809k
&&
647
1.94M
        
getFPExceptionMode() == LangOptions::FPE_Strict0
)
648
      // If the FP settings are set to the "strict" model, then
649
      // FENV access is set to true. (ffp-model=strict)
650
0
      setAllowFEnvAccess(true);
651
1.94M
    else
652
1.94M
      setAllowFEnvAccess(LangOptions::FPM_Off);
653
1.94M
  }
654
655
6.06k
  bool allowFPContractWithinStatement() const {
656
6.06k
    return getFPContractMode() == LangOptions::FPM_On;
657
6.06k
  }
658
0
  void setAllowFPContractWithinStatement() {
659
0
    setFPContractMode(LangOptions::FPM_On);
660
0
  }
661
662
318k
  bool allowFPContractAcrossStatement() const {
663
318k
    return getFPContractMode() == LangOptions::FPM_Fast;
664
318k
  }
665
0
  void setAllowFPContractAcrossStatement() {
666
0
    setFPContractMode(LangOptions::FPM_Fast);
667
0
  }
668
669
29.7M
  bool isFPConstrained() const {
670
29.7M
    return getRoundingMode() != llvm::RoundingMode::NearestTiesToEven ||
671
29.7M
           
getFPExceptionMode() != LangOptions::FPE_Ignore29.7M
||
672
29.7M
           
getAllowFEnvAccess()29.5M
;
673
29.7M
  }
674
675
39.2M
  bool operator==(FPOptions other) const { return Value == other.Value; }
676
677
  /// Return the default value of FPOptions that's used when trailing
678
  /// storage isn't required.
679
  static FPOptions defaultWithoutTrailingStorage(const LangOptions &LO);
680
681
1.62M
  storage_type getAsOpaqueInt() const { return Value; }
682
83.2M
  static FPOptions getFromOpaqueInt(storage_type Value) {
683
83.2M
    FPOptions Opts;
684
83.2M
    Opts.Value = Value;
685
83.2M
    return Opts;
686
83.2M
  }
687
688
  // We can define most of the accessors automatically:
689
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS)                                    \
690
103M
  TYPE get##NAME() const {                                                     \
691
103M
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
103M
  }                                                                            \
clang::FPOptions::getFPContractMode() const
Line
Count
Source
690
2.26M
  TYPE get##NAME() const {                                                     \
691
2.26M
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
2.26M
  }                                                                            \
clang::FPOptions::getRoundingMode() const
Line
Count
Source
690
30.5M
  TYPE get##NAME() const {                                                     \
691
30.5M
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
30.5M
  }                                                                            \
clang::FPOptions::getFPExceptionMode() const
Line
Count
Source
690
29.7M
  TYPE get##NAME() const {                                                     \
691
29.7M
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
29.7M
  }                                                                            \
clang::FPOptions::getAllowFEnvAccess() const
Line
Count
Source
690
29.5M
  TYPE get##NAME() const {                                                     \
691
29.5M
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
29.5M
  }                                                                            \
clang::FPOptions::getAllowFPReassociate() const
Line
Count
Source
690
321k
  TYPE get##NAME() const {                                                     \
691
321k
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
321k
  }                                                                            \
clang::FPOptions::getNoHonorNaNs() const
Line
Count
Source
690
320k
  TYPE get##NAME() const {                                                     \
691
320k
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
320k
  }                                                                            \
clang::FPOptions::getNoHonorInfs() const
Line
Count
Source
690
320k
  TYPE get##NAME() const {                                                     \
691
320k
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
320k
  }                                                                            \
clang::FPOptions::getNoSignedZero() const
Line
Count
Source
690
321k
  TYPE get##NAME() const {                                                     \
691
321k
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
321k
  }                                                                            \
clang::FPOptions::getAllowReciprocal() const
Line
Count
Source
690
318k
  TYPE get##NAME() const {                                                     \
691
318k
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
318k
  }                                                                            \
clang::FPOptions::getAllowApproxFunc() const
Line
Count
Source
690
318k
  TYPE get##NAME() const {                                                     \
691
318k
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
318k
  }                                                                            \
clang::FPOptions::getFPEvalMethod() const
Line
Count
Source
690
9.49M
  TYPE get##NAME() const {                                                     \
691
9.49M
    return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift);             \
692
9.49M
  }                                                                            \
693
271M
  void set##NAME(TYPE value) {                                                 \
694
271M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
271M
  }
clang::FPOptions::setFPContractMode(clang::LangOptions::FPModeKind)
Line
Count
Source
693
85.8M
  void set##NAME(TYPE value) {                                                 \
694
85.8M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
85.8M
  }
clang::FPOptions::setRoundingMode(llvm::RoundingMode)
Line
Count
Source
693
85.8M
  void set##NAME(TYPE value) {                                                 \
694
85.8M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
85.8M
  }
clang::FPOptions::setFPExceptionMode(clang::LangOptions::FPExceptionModeKind)
Line
Count
Source
693
85.8M
  void set##NAME(TYPE value) {                                                 \
694
85.8M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
85.8M
  }
clang::FPOptions::setAllowFEnvAccess(bool)
Line
Count
Source
693
1.94M
  void set##NAME(TYPE value) {                                                 \
694
1.94M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
1.94M
  }
clang::FPOptions::setAllowFPReassociate(bool)
Line
Count
Source
693
1.94M
  void set##NAME(TYPE value) {                                                 \
694
1.94M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
1.94M
  }
clang::FPOptions::setNoHonorNaNs(bool)
Line
Count
Source
693
1.94M
  void set##NAME(TYPE value) {                                                 \
694
1.94M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
1.94M
  }
clang::FPOptions::setNoHonorInfs(bool)
Line
Count
Source
693
1.94M
  void set##NAME(TYPE value) {                                                 \
694
1.94M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
1.94M
  }
clang::FPOptions::setNoSignedZero(bool)
Line
Count
Source
693
1.94M
  void set##NAME(TYPE value) {                                                 \
694
1.94M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
1.94M
  }
clang::FPOptions::setAllowReciprocal(bool)
Line
Count
Source
693
1.94M
  void set##NAME(TYPE value) {                                                 \
694
1.94M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
1.94M
  }
clang::FPOptions::setAllowApproxFunc(bool)
Line
Count
Source
693
1.94M
  void set##NAME(TYPE value) {                                                 \
694
1.94M
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
1.94M
  }
clang::FPOptions::setFPEvalMethod(clang::LangOptions::FPEvalMethodKind)
Line
Count
Source
693
87.1k
  void set##NAME(TYPE value) {                                                 \
694
87.1k
    Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift);      \
695
87.1k
  }
696
#include "clang/Basic/FPOptions.def"
697
  LLVM_DUMP_METHOD void dump();
698
};
699
700
/// Represents difference between two FPOptions values.
701
///
702
/// The effect of language constructs changing the set of floating point options
703
/// is usually a change of some FP properties while leaving others intact. This
704
/// class describes such changes by keeping information about what FP options
705
/// are overridden.
706
///
707
/// The integral set of FP options, described by the class FPOptions, may be
708
/// represented as a default FP option set, defined by language standard and
709
/// command line options, with the overrides introduced by pragmas.
710
///
711
/// The is implemented as a value of the new FPOptions plus a mask showing which
712
/// fields are actually set in it.
713
class FPOptionsOverride {
714
  FPOptions Options = FPOptions::getFromOpaqueInt(0);
715
  FPOptions::storage_type OverrideMask = 0;
716
717
public:
718
  using RoundingMode = llvm::RoundingMode;
719
720
  /// The type suitable for storing values of FPOptionsOverride. Must be twice
721
  /// as wide as bit size of FPOption.
722
  using storage_type = uint32_t;
723
  static_assert(sizeof(storage_type) >= 2 * sizeof(FPOptions::storage_type),
724
                "Too short type for FPOptionsOverride");
725
726
  /// Bit mask selecting bits of OverrideMask in serialized representation of
727
  /// FPOptionsOverride.
728
  static constexpr storage_type OverrideMaskBits =
729
      (static_cast<storage_type>(1) << FPOptions::StorageBitSize) - 1;
730
731
82.4M
  FPOptionsOverride() {}
732
  FPOptionsOverride(const LangOptions &LO)
733
0
      : Options(LO), OverrideMask(OverrideMaskBits) {}
734
  FPOptionsOverride(FPOptions FPO)
735
0
      : Options(FPO), OverrideMask(OverrideMaskBits) {}
736
737
84.9M
  bool requiresTrailingStorage() const { return OverrideMask != 0; }
738
739
106
  void setAllowFPContractWithinStatement() {
740
106
    setFPContractModeOverride(LangOptions::FPM_On);
741
106
  }
742
743
115
  void setAllowFPContractAcrossStatement() {
744
115
    setFPContractModeOverride(LangOptions::FPM_Fast);
745
115
  }
746
747
10
  void setDisallowFPContract() {
748
10
    setFPContractModeOverride(LangOptions::FPM_Off);
749
10
  }
750
751
180
  void setFPPreciseEnabled(bool Value) {
752
180
    setAllowFPReassociateOverride(!Value);
753
180
    setNoHonorNaNsOverride(!Value);
754
180
    setNoHonorInfsOverride(!Value);
755
180
    setNoSignedZeroOverride(!Value);
756
180
    setAllowReciprocalOverride(!Value);
757
180
    setAllowApproxFuncOverride(!Value);
758
180
    if (Value)
759
      /* Precise mode implies fp_contract=on and disables ffast-math */
760
75
      setAllowFPContractWithinStatement();
761
105
    else
762
      /* Precise mode disabled sets fp_contract=fast and enables ffast-math */
763
105
      setAllowFPContractAcrossStatement();
764
180
  }
765
766
9.08k
  storage_type getAsOpaqueInt() const {
767
9.08k
    return (static_cast<storage_type>(Options.getAsOpaqueInt())
768
9.08k
            << FPOptions::StorageBitSize) |
769
9.08k
           OverrideMask;
770
9.08k
  }
771
8.37k
  static FPOptionsOverride getFromOpaqueInt(storage_type I) {
772
8.37k
    FPOptionsOverride Opts;
773
8.37k
    Opts.OverrideMask = I & OverrideMaskBits;
774
8.37k
    Opts.Options = FPOptions::getFromOpaqueInt(I >> FPOptions::StorageBitSize);
775
8.37k
    return Opts;
776
8.37k
  }
777
778
806k
  FPOptions applyOverrides(FPOptions Base) {
779
806k
    FPOptions Result =
780
806k
        FPOptions::getFromOpaqueInt((Base.getAsOpaqueInt() & ~OverrideMask) |
781
806k
                                     (Options.getAsOpaqueInt() & OverrideMask));
782
806k
    return Result;
783
806k
  }
784
785
806k
  FPOptions applyOverrides(const LangOptions &LO) {
786
806k
    return applyOverrides(FPOptions(LO));
787
806k
  }
788
789
38.9M
  bool operator==(FPOptionsOverride other) const {
790
38.9M
    return Options == other.Options && 
OverrideMask == other.OverrideMask38.5M
;
791
38.9M
  }
792
38.9M
  bool operator!=(FPOptionsOverride other) const { return !(*this == other); }
793
794
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS)                                    \
795
1.05k
  bool has##NAME##Override() const {                                           \
796
1.05k
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
1.05k
  }                                                                            \
clang::FPOptionsOverride::hasFPContractModeOverride() const
Line
Count
Source
795
124
  bool has##NAME##Override() const {                                           \
796
124
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
124
  }                                                                            \
clang::FPOptionsOverride::hasRoundingModeOverride() const
Line
Count
Source
795
140
  bool has##NAME##Override() const {                                           \
796
140
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
140
  }                                                                            \
clang::FPOptionsOverride::hasFPExceptionModeOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
clang::FPOptionsOverride::hasAllowFEnvAccessOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
clang::FPOptionsOverride::hasAllowFPReassociateOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
clang::FPOptionsOverride::hasNoHonorNaNsOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
clang::FPOptionsOverride::hasNoHonorInfsOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
clang::FPOptionsOverride::hasNoSignedZeroOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
clang::FPOptionsOverride::hasAllowReciprocalOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
clang::FPOptionsOverride::hasAllowApproxFuncOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
clang::FPOptionsOverride::hasFPEvalMethodOverride() const
Line
Count
Source
795
88
  bool has##NAME##Override() const {                                           \
796
88
    return OverrideMask & FPOptions::NAME##Mask;                               \
797
88
  }                                                                            \
798
88
  TYPE get##NAME##Override() const {                                           \
799
88
    assert(has##NAME##Override());                                             \
800
88
    return Options.get##NAME();                                                \
801
88
  }                                                                            \
clang::FPOptionsOverride::getFPContractModeOverride() const
Line
Count
Source
798
36
  TYPE get##NAME##Override() const {                                           \
799
36
    assert(has##NAME##Override());                                             \
800
36
    return Options.get##NAME();                                                \
801
36
  }                                                                            \
clang::FPOptionsOverride::getRoundingModeOverride() const
Line
Count
Source
798
52
  TYPE get##NAME##Override() const {                                           \
799
52
    assert(has##NAME##Override());                                             \
800
52
    return Options.get##NAME();                                                \
801
52
  }                                                                            \
Unexecuted instantiation: clang::FPOptionsOverride::getFPExceptionModeOverride() const
Unexecuted instantiation: clang::FPOptionsOverride::getAllowFEnvAccessOverride() const
Unexecuted instantiation: clang::FPOptionsOverride::getAllowFPReassociateOverride() const
Unexecuted instantiation: clang::FPOptionsOverride::getNoHonorNaNsOverride() const
Unexecuted instantiation: clang::FPOptionsOverride::getNoHonorInfsOverride() const
Unexecuted instantiation: clang::FPOptionsOverride::getNoSignedZeroOverride() const
Unexecuted instantiation: clang::FPOptionsOverride::getAllowReciprocalOverride() const
Unexecuted instantiation: clang::FPOptionsOverride::getAllowApproxFuncOverride() const
Unexecuted instantiation: clang::FPOptionsOverride::getFPEvalMethodOverride() const
802
0
  void clear##NAME##Override() {                                               \
803
0
    /* Clear the actual value so that we don't have spurious differences when  \
804
0
     * testing equality. */                                                    \
805
0
    Options.set##NAME(TYPE(0));                                                \
806
0
    OverrideMask &= ~FPOptions::NAME##Mask;                                    \
807
0
  }                                                                            \
Unexecuted instantiation: clang::FPOptionsOverride::clearFPContractModeOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearRoundingModeOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearFPExceptionModeOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearAllowFEnvAccessOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearAllowFPReassociateOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearNoHonorNaNsOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearNoHonorInfsOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearNoSignedZeroOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearAllowReciprocalOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearAllowApproxFuncOverride()
Unexecuted instantiation: clang::FPOptionsOverride::clearFPEvalMethodOverride()
808
1.66k
  void set##NAME##Override(TYPE value) {                                       \
809
1.66k
    Options.set##NAME(value);                                                  \
810
1.66k
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
1.66k
  }
clang::FPOptionsOverride::setFPContractModeOverride(clang::LangOptions::FPModeKind)
Line
Count
Source
808
231
  void set##NAME##Override(TYPE value) {                                       \
809
231
    Options.set##NAME(value);                                                  \
810
231
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
231
  }
clang::FPOptionsOverride::setRoundingModeOverride(llvm::RoundingMode)
Line
Count
Source
808
48
  void set##NAME##Override(TYPE value) {                                       \
809
48
    Options.set##NAME(value);                                                  \
810
48
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
48
  }
clang::FPOptionsOverride::setFPExceptionModeOverride(clang::LangOptions::FPExceptionModeKind)
Line
Count
Source
808
138
  void set##NAME##Override(TYPE value) {                                       \
809
138
    Options.set##NAME(value);                                                  \
810
138
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
138
  }
clang::FPOptionsOverride::setAllowFEnvAccessOverride(bool)
Line
Count
Source
808
25
  void set##NAME##Override(TYPE value) {                                       \
809
25
    Options.set##NAME(value);                                                  \
810
25
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
25
  }
clang::FPOptionsOverride::setAllowFPReassociateOverride(bool)
Line
Count
Source
808
219
  void set##NAME##Override(TYPE value) {                                       \
809
219
    Options.set##NAME(value);                                                  \
810
219
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
219
  }
clang::FPOptionsOverride::setNoHonorNaNsOverride(bool)
Line
Count
Source
808
180
  void set##NAME##Override(TYPE value) {                                       \
809
180
    Options.set##NAME(value);                                                  \
810
180
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
180
  }
clang::FPOptionsOverride::setNoHonorInfsOverride(bool)
Line
Count
Source
808
180
  void set##NAME##Override(TYPE value) {                                       \
809
180
    Options.set##NAME(value);                                                  \
810
180
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
180
  }
clang::FPOptionsOverride::setNoSignedZeroOverride(bool)
Line
Count
Source
808
180
  void set##NAME##Override(TYPE value) {                                       \
809
180
    Options.set##NAME(value);                                                  \
810
180
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
180
  }
clang::FPOptionsOverride::setAllowReciprocalOverride(bool)
Line
Count
Source
808
180
  void set##NAME##Override(TYPE value) {                                       \
809
180
    Options.set##NAME(value);                                                  \
810
180
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
180
  }
clang::FPOptionsOverride::setAllowApproxFuncOverride(bool)
Line
Count
Source
808
180
  void set##NAME##Override(TYPE value) {                                       \
809
180
    Options.set##NAME(value);                                                  \
810
180
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
180
  }
clang::FPOptionsOverride::setFPEvalMethodOverride(clang::LangOptions::FPEvalMethodKind)
Line
Count
Source
808
101
  void set##NAME##Override(TYPE value) {                                       \
809
101
    Options.set##NAME(value);                                                  \
810
101
    OverrideMask |= FPOptions::NAME##Mask;                                     \
811
101
  }
812
#include "clang/Basic/FPOptions.def"
813
  LLVM_DUMP_METHOD void dump();
814
};
815
816
/// Describes the kind of translation unit being processed.
817
enum TranslationUnitKind {
818
  /// The translation unit is a complete translation unit.
819
  TU_Complete,
820
821
  /// The translation unit is a prefix to a translation unit, and is
822
  /// not complete.
823
  TU_Prefix,
824
825
  /// The translation unit is a module.
826
  TU_Module,
827
828
  /// The translation unit is a is a complete translation unit that we might
829
  /// incrementally extend later.
830
  TU_Incremental
831
};
832
833
} // namespace clang
834
835
#endif // LLVM_CLANG_BASIC_LANGOPTIONS_H