From e68cc2674040e6680d3314ec5e63595e0a57d880 Mon Sep 17 00:00:00 2001 From: Scott Linder Date: Tue, 2 Dec 2025 10:08:53 -0500 Subject: [PATCH] Prepare to reapply "[MC] Use a variant to hold MCCFIInstruction state (NFC)" --- llvm/include/llvm/MC/MCDwarf.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h index 9df687c282a0c..64d306140186c 100644 --- a/llvm/include/llvm/MC/MCDwarf.h +++ b/llvm/include/llvm/MC/MCDwarf.h @@ -538,10 +538,20 @@ class MCCFIInstruction { // Held in ExtraFields for most common OpTypes, exceptions follow. struct CommonFields { - unsigned Register = std::numeric_limits::max(); - int64_t Offset = 0; - unsigned Register2 = std::numeric_limits::max(); - unsigned AddressSpace = 0; + unsigned Register; + int64_t Offset; + unsigned Register2; + unsigned AddressSpace; + // FIXME: Workaround for GCC7 bug with nested class used as std::variant + // alternative where the compiler really wants a user-defined default + // constructor. Once we no longer support GCC7 these constructors can be + // replaced with default member initializers and aggregate initialization. + CommonFields(unsigned Reg, int64_t Off = 0, + unsigned Reg2 = std::numeric_limits::max(), + unsigned AddrSpace = 0) + : Register(Reg), Offset(Off), Register2(Reg2), AddressSpace(AddrSpace) { + } + CommonFields() : CommonFields(std::numeric_limits::max()) {} }; // Held in ExtraFields when OpEscape. struct EscapeFields {