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 12 namespace clang { 13 14 CodeGenOptions::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(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 #include "clang/Basic/CodeGenOptions.def" 31 32 // Next reset all debug options that can always be reset, because they never 33 // affect the PCM. 34 #define DEBUGOPT(Name, Bits, Default) 35 #define VALUE_DEBUGOPT(Name, Bits, Default) 36 #define ENUM_DEBUGOPT(Name, Type, Bits, Default) 37 #define BENIGN_DEBUGOPT(Name, Bits, Default) Name = Default; 38 #define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default) Name = Default; 39 #define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default) set##Name(Default); 40 #include "clang/Basic/DebugOptions.def" 41 42 // Conditionally reset debug options that only matter when the debug info is 43 // emitted into the PCM (-gmodules). 44 if (ModuleFormat == "raw" && !DebugTypeExtRefs) { 45 #define DEBUGOPT(Name, Bits, Default) Name = Default; 46 #define VALUE_DEBUGOPT(Name, Bits, Default) Name = Default; 47 #define ENUM_DEBUGOPT(Name, Type, Bits, Default) set##Name(Default); 48 #define BENIGN_DEBUGOPT(Name, Bits, Default) 49 #define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default) 50 #define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default) 51 #include "clang/Basic/DebugOptions.def" 52 } 53 54 RelocationModel = llvm::Reloc::PIC_; 55 memcpy(CoverageVersion, "408*", 4); 56 } 57 58 } // end namespace clang 59