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
9#include "clang/Basic/CodeGenOptions.h"
10#include <string.h>
11
12namespace clang {
13
14CodeGenOptions::CodeGenOptions() {
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(dest: CoverageVersion, src: "408*", n: 4);
21}
22
23void 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(dest: CoverageVersion, src: "408*", n: 4);
58}
59
60} // end namespace clang
61

source code of clang/lib/Basic/CodeGenOptions.cpp