clang 22.0.0git
CodeGenOptions.cpp
Go to the documentation of this file.
1//===--- CodeGenOptions.cpp -----------------------------------------------===//
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
10
11namespace clang {
12
14#define CODEGENOPT(Name, Bits, Default, Compatibility) Name = Default;
15#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
16 set##Name(Default);
17#include "clang/Basic/CodeGenOptions.def"
18
19 RelocationModel = llvm::Reloc::PIC_;
20}
21
22void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
23 // FIXME: Replace with C++20 `using enum CodeGenOptions::CompatibilityKind`.
24 using CK = CompatibilityKind;
25
26 // First reset benign codegen and debug options.
27#define CODEGENOPT(Name, Bits, Default, Compatibility) \
28 if constexpr (CK::Compatibility == CK::Benign) \
29 Name = Default;
30#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
31 if constexpr (CK::Compatibility == CK::Benign) \
32 set##Name(Default);
33#include "clang/Basic/CodeGenOptions.def"
34
35 // Conditionally reset debug options that only matter when the debug info is
36 // emitted into the PCM (-gmodules).
37 if (ModuleFormat == "raw" && !DebugTypeExtRefs) {
38#define DEBUGOPT(Name, Bits, Default, Compatibility) \
39 if constexpr (CK::Compatibility != CK::Benign) \
40 Name = Default;
41#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility) \
42 if constexpr (CK::Compatibility != CK::Benign) \
43 Name = Default;
44#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility) \
45 if constexpr (CK::Compatibility != CK::Benign) \
46 set##Name(Default);
47#include "clang/Basic/DebugOptions.def"
48 }
49
50 RelocationModel = llvm::Reloc::PIC_;
51}
52
53} // end namespace clang
CompatibilityKind
For ASTs produced with different option value, signifies their level of compatibility.
llvm::Reloc::Model RelocationModel
The name of the relocation model to use.
void resetNonModularOptions(StringRef ModuleFormat)
Reset all of the options that are not considered when building a module.
The JSON file list parser is used to communicate input to InstallAPI.