clang  19.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 #include <string.h>
11 
12 namespace clang {
13 
15 #define CODEGENOPT(Name, Bits, Default) Name = Default;
16 #define ENUM_CODEGENOPT(Name, Type, Bits, Default) set##Name(Default);
17 #include "clang/Basic/CodeGenOptions.def"
18 
19  RelocationModel = llvm::Reloc::PIC_;
20  memcpy(CoverageVersion, "408*", 4);
21 }
22 
23 void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
24  // First reset all CodeGen options only. The Debug options are handled later.
25 #define DEBUGOPT(Name, Bits, Default)
26 #define VALUE_DEBUGOPT(Name, Bits, Default)
27 #define ENUM_DEBUGOPT(Name, Type, Bits, Default)
28 #define CODEGENOPT(Name, Bits, Default) Name = Default;
29 #define ENUM_CODEGENOPT(Name, Type, Bits, Default) set##Name(Default);
30 // Do not reset AST affecting code generation options.
31 #define AFFECTING_VALUE_CODEGENOPT(Name, Bits, Default)
32 #include "clang/Basic/CodeGenOptions.def"
33 
34  // Next reset all debug options that can always be reset, because they never
35  // affect the PCM.
36 #define DEBUGOPT(Name, Bits, Default)
37 #define VALUE_DEBUGOPT(Name, Bits, Default)
38 #define ENUM_DEBUGOPT(Name, Type, Bits, Default)
39 #define BENIGN_DEBUGOPT(Name, Bits, Default) Name = Default;
40 #define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default) Name = Default;
41 #define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default) set##Name(Default);
42 #include "clang/Basic/DebugOptions.def"
43 
44  // Conditionally reset debug options that only matter when the debug info is
45  // emitted into the PCM (-gmodules).
46  if (ModuleFormat == "raw" && !DebugTypeExtRefs) {
47 #define DEBUGOPT(Name, Bits, Default) Name = Default;
48 #define VALUE_DEBUGOPT(Name, Bits, Default) Name = Default;
49 #define ENUM_DEBUGOPT(Name, Type, Bits, Default) set##Name(Default);
50 #define BENIGN_DEBUGOPT(Name, Bits, Default)
51 #define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default)
52 #define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default)
53 #include "clang/Basic/DebugOptions.def"
54  }
55 
56  RelocationModel = llvm::Reloc::PIC_;
57  memcpy(CoverageVersion, "408*", 4);
58 }
59 
60 } // end namespace clang
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
char CoverageVersion[4]
The version string to put into coverage files.
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.