Path: blob/main/contrib/llvm-project/clang/lib/Basic/CodeGenOptions.cpp
35232 views
//===--- CodeGenOptions.cpp -----------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "clang/Basic/CodeGenOptions.h"9#include <string.h>1011namespace clang {1213CodeGenOptions::CodeGenOptions() {14#define CODEGENOPT(Name, Bits, Default) Name = Default;15#define ENUM_CODEGENOPT(Name, Type, Bits, Default) set##Name(Default);16#include "clang/Basic/CodeGenOptions.def"1718RelocationModel = llvm::Reloc::PIC_;19memcpy(CoverageVersion, "408*", 4);20}2122void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {23// First reset all CodeGen options only. The Debug options are handled later.24#define DEBUGOPT(Name, Bits, Default)25#define VALUE_DEBUGOPT(Name, Bits, Default)26#define ENUM_DEBUGOPT(Name, Type, Bits, Default)27#define CODEGENOPT(Name, Bits, Default) Name = Default;28#define ENUM_CODEGENOPT(Name, Type, Bits, Default) set##Name(Default);29// Do not reset AST affecting code generation options.30#define AFFECTING_VALUE_CODEGENOPT(Name, Bits, Default)31#include "clang/Basic/CodeGenOptions.def"3233// Next reset all debug options that can always be reset, because they never34// affect the PCM.35#define DEBUGOPT(Name, Bits, Default)36#define VALUE_DEBUGOPT(Name, Bits, Default)37#define ENUM_DEBUGOPT(Name, Type, Bits, Default)38#define BENIGN_DEBUGOPT(Name, Bits, Default) Name = Default;39#define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default) Name = Default;40#define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default) set##Name(Default);41#include "clang/Basic/DebugOptions.def"4243// Conditionally reset debug options that only matter when the debug info is44// emitted into the PCM (-gmodules).45if (ModuleFormat == "raw" && !DebugTypeExtRefs) {46#define DEBUGOPT(Name, Bits, Default) Name = Default;47#define VALUE_DEBUGOPT(Name, Bits, Default) Name = Default;48#define ENUM_DEBUGOPT(Name, Type, Bits, Default) set##Name(Default);49#define BENIGN_DEBUGOPT(Name, Bits, Default)50#define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default)51#define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default)52#include "clang/Basic/DebugOptions.def"53}5455RelocationModel = llvm::Reloc::PIC_;56memcpy(CoverageVersion, "408*", 4);57}5859} // end namespace clang606162