diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2025-07-07 09:02:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-07 09:02:56 -0700 |
commit | 9f1b9560e7ee542471c89b193c6aea4c674ffe23 (patch) | |
tree | c7ef26d4cd2846c64f1c62d95641469a57531e1e /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | fee168913c752b1048a2fd48b27c698094462d52 (diff) | |
download | llvm-9f1b9560e7ee542471c89b193c6aea4c674ffe23.zip llvm-9f1b9560e7ee542471c89b193c6aea4c674ffe23.tar.gz llvm-9f1b9560e7ee542471c89b193c6aea4c674ffe23.tar.bz2 |
[clang] Refactor `CodeGenOptions` to specify compatibility as X macro arg (#146910)
This is the `CodeGenOptions` counterpart to
https://github.com/llvm/llvm-project/pull/146766.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index e233821..b9f7579 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -5308,13 +5308,17 @@ std::string CompilerInvocation::getModuleHash() const { // Extend the signature with the affecting debug options. if (getHeaderSearchOpts().ModuleFormat == "obj") { -#define DEBUGOPT(Name, Bits, Default) HBuilder.add(CodeGenOpts->Name); -#define VALUE_DEBUGOPT(Name, Bits, Default) HBuilder.add(CodeGenOpts->Name); -#define ENUM_DEBUGOPT(Name, Type, Bits, Default) \ - HBuilder.add(static_cast<unsigned>(CodeGenOpts->get##Name())); -#define BENIGN_DEBUGOPT(Name, Bits, Default) -#define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default) -#define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default) + // FIXME: Replace with C++20 `using enum CodeGenOptions::CompatibilityKind`. + using CK = CodeGenOptions::CompatibilityKind; +#define DEBUGOPT(Name, Bits, Default, Compatibility) \ + if constexpr (CK::Compatibility == CK::Affecting) \ + HBuilder.add(CodeGenOpts->Name); +#define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility) \ + if constexpr (CK::Compatibility == CK::Affecting) \ + HBuilder.add(CodeGenOpts->Name); +#define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility) \ + if constexpr (CK::Compatibility == CK::Affecting) \ + HBuilder.add(static_cast<unsigned>(CodeGenOpts->get##Name())); #include "clang/Basic/DebugOptions.def" } |