2014-11-11 00:22:12 +00:00
|
|
|
//===--- CodeGenOptions.cpp -----------------------------------------------===//
|
|
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-11-11 00:22:12 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2018-12-11 03:18:39 +00:00
|
|
|
#include "clang/Basic/CodeGenOptions.h"
|
2014-11-11 00:22:12 +00:00
|
|
|
|
|
|
|
|
namespace clang {
|
2020-09-02 10:35:42 -07:00
|
|
|
|
|
|
|
|
CodeGenOptions::CodeGenOptions() {
|
2025-07-07 09:02:56 -07:00
|
|
|
#define CODEGENOPT(Name, Bits, Default, Compatibility) Name = Default;
|
|
|
|
|
#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
|
|
|
|
|
set##Name(Default);
|
2018-12-11 03:18:39 +00:00
|
|
|
#include "clang/Basic/CodeGenOptions.def"
|
2014-11-11 00:22:12 +00:00
|
|
|
|
2018-01-18 00:20:03 +00:00
|
|
|
RelocationModel = llvm::Reloc::PIC_;
|
2014-11-11 00:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
2023-12-05 08:31:21 -08:00
|
|
|
void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
|
2025-07-07 09:02:56 -07:00
|
|
|
// FIXME: Replace with C++20 `using enum CodeGenOptions::CompatibilityKind`.
|
|
|
|
|
using CK = CompatibilityKind;
|
|
|
|
|
|
|
|
|
|
// First reset benign codegen and debug options.
|
|
|
|
|
#define CODEGENOPT(Name, Bits, Default, Compatibility) \
|
|
|
|
|
if constexpr (CK::Compatibility == CK::Benign) \
|
|
|
|
|
Name = Default;
|
|
|
|
|
#define ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility) \
|
|
|
|
|
if constexpr (CK::Compatibility == CK::Benign) \
|
|
|
|
|
set##Name(Default);
|
2023-12-05 08:31:21 -08:00
|
|
|
#include "clang/Basic/CodeGenOptions.def"
|
|
|
|
|
|
|
|
|
|
// Conditionally reset debug options that only matter when the debug info is
|
|
|
|
|
// emitted into the PCM (-gmodules).
|
|
|
|
|
if (ModuleFormat == "raw" && !DebugTypeExtRefs) {
|
2025-07-07 09:02:56 -07:00
|
|
|
#define DEBUGOPT(Name, Bits, Default, Compatibility) \
|
2025-07-15 12:45:09 -07:00
|
|
|
if constexpr (CK::Compatibility != CK::Benign) \
|
2025-07-07 09:02:56 -07:00
|
|
|
Name = Default;
|
|
|
|
|
#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility) \
|
2025-07-15 12:45:09 -07:00
|
|
|
if constexpr (CK::Compatibility != CK::Benign) \
|
2025-07-07 09:02:56 -07:00
|
|
|
Name = Default;
|
|
|
|
|
#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility) \
|
2025-07-15 12:45:09 -07:00
|
|
|
if constexpr (CK::Compatibility != CK::Benign) \
|
2025-07-07 09:02:56 -07:00
|
|
|
set##Name(Default);
|
2023-12-05 08:31:21 -08:00
|
|
|
#include "clang/Basic/DebugOptions.def"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RelocationModel = llvm::Reloc::PIC_;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-11 00:22:12 +00:00
|
|
|
} // end namespace clang
|