[llvm] dec21e4 - [MCObjectFileInfo] Fix uninitialized variable warnings. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 08:14:19 PST 2019
Author: Simon Pilgrim
Date: 2019-11-05T15:15:14Z
New Revision: dec21e445142c26a68441b7c75fb75a7e03db754
URL: https://github.com/llvm/llvm-project/commit/dec21e445142c26a68441b7c75fb75a7e03db754
DIFF: https://github.com/llvm/llvm-project/commit/dec21e445142c26a68441b7c75fb75a7e03db754.diff
LOG: [MCObjectFileInfo] Fix uninitialized variable warnings. NFCI.
Added:
Modified:
llvm/include/llvm/MC/MCObjectFileInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h
index a28ddd7fa45f..4ecfac4dcc4c 100644
--- a/llvm/include/llvm/MC/MCObjectFileInfo.h
+++ b/llvm/include/llvm/MC/MCObjectFileInfo.h
@@ -27,20 +27,20 @@ class MCObjectFileInfo {
protected:
/// True if .comm supports alignment. This is a hack for as long as we
/// support 10.4 Tiger, whose assembler doesn't support alignment on comm.
- bool CommDirectiveSupportsAlignment;
+ bool CommDirectiveSupportsAlignment = false;
/// True if target object file supports a weak_definition of constant 0 for an
/// omitted EH frame.
- bool SupportsWeakOmittedEHFrame;
+ bool SupportsWeakOmittedEHFrame = false;
/// True if the target object file supports emitting a compact unwind section
/// without an associated EH frame section.
- bool SupportsCompactUnwindWithoutEHFrame;
+ bool SupportsCompactUnwindWithoutEHFrame = false;
/// OmitDwarfIfHaveCompactUnwind - True if the target object file
/// supports having some functions with compact unwind and other with
/// dwarf unwind.
- bool OmitDwarfIfHaveCompactUnwind;
+ bool OmitDwarfIfHaveCompactUnwind = false;
/// FDE CFI encoding. Controls the encoding of the begin label in the
/// .eh_frame section. Unlike the LSDA encoding, personality encoding, and
@@ -49,134 +49,134 @@ class MCObjectFileInfo {
unsigned FDECFIEncoding = 0;
/// Compact unwind encoding indicating that we should emit only an EH frame.
- unsigned CompactUnwindDwarfEHFrameOnly;
+ unsigned CompactUnwindDwarfEHFrameOnly = 0;
/// Section directive for standard text.
- MCSection *TextSection;
+ MCSection *TextSection = nullptr;
/// Section directive for standard data.
- MCSection *DataSection;
+ MCSection *DataSection = nullptr;
/// Section that is default initialized to zero.
- MCSection *BSSSection;
+ MCSection *BSSSection = nullptr;
/// Section that is readonly and can contain arbitrary initialized data.
/// Targets are not required to have a readonly section. If they don't,
/// various bits of code will fall back to using the data section for
/// constants.
- MCSection *ReadOnlySection;
+ MCSection *ReadOnlySection = nullptr;
/// If exception handling is supported by the target, this is the section the
/// Language Specific Data Area information is emitted to.
- MCSection *LSDASection;
+ MCSection *LSDASection = nullptr;
/// If exception handling is supported by the target and the target can
/// support a compact representation of the CIE and FDE, this is the section
/// to emit them into.
- MCSection *CompactUnwindSection;
+ MCSection *CompactUnwindSection = nullptr;
// Dwarf sections for debug info. If a target supports debug info, these must
// be set.
- MCSection *DwarfAbbrevSection;
- MCSection *DwarfInfoSection;
- MCSection *DwarfLineSection;
- MCSection *DwarfLineStrSection;
- MCSection *DwarfFrameSection;
- MCSection *DwarfPubTypesSection;
- const MCSection *DwarfDebugInlineSection;
- MCSection *DwarfStrSection;
- MCSection *DwarfLocSection;
- MCSection *DwarfARangesSection;
- MCSection *DwarfRangesSection;
- MCSection *DwarfMacinfoSection;
+ MCSection *DwarfAbbrevSection = nullptr;
+ MCSection *DwarfInfoSection = nullptr;
+ MCSection *DwarfLineSection = nullptr;
+ MCSection *DwarfLineStrSection = nullptr;
+ MCSection *DwarfFrameSection = nullptr;
+ MCSection *DwarfPubTypesSection = nullptr;
+ const MCSection *DwarfDebugInlineSection = nullptr;
+ MCSection *DwarfStrSection = nullptr;
+ MCSection *DwarfLocSection = nullptr;
+ MCSection *DwarfARangesSection = nullptr;
+ MCSection *DwarfRangesSection = nullptr;
+ MCSection *DwarfMacinfoSection = nullptr;
// The pubnames section is no longer generated by default. The generation
// can be enabled by a compiler flag.
- MCSection *DwarfPubNamesSection;
+ MCSection *DwarfPubNamesSection = nullptr;
/// Accelerator table sections. DwarfDebugNamesSection is the DWARF v5
/// accelerator table, while DwarfAccelNamesSection, DwarfAccelObjCSection,
/// DwarfAccelNamespaceSection, DwarfAccelTypesSection are pre-DWARF v5
/// extensions.
- MCSection *DwarfDebugNamesSection;
- MCSection *DwarfAccelNamesSection;
- MCSection *DwarfAccelObjCSection;
- MCSection *DwarfAccelNamespaceSection;
- MCSection *DwarfAccelTypesSection;
+ MCSection *DwarfDebugNamesSection = nullptr;
+ MCSection *DwarfAccelNamesSection = nullptr;
+ MCSection *DwarfAccelObjCSection = nullptr;
+ MCSection *DwarfAccelNamespaceSection = nullptr;
+ MCSection *DwarfAccelTypesSection = nullptr;
// These are used for the Fission separate debug information files.
- MCSection *DwarfInfoDWOSection;
- MCSection *DwarfTypesDWOSection;
- MCSection *DwarfAbbrevDWOSection;
- MCSection *DwarfStrDWOSection;
- MCSection *DwarfLineDWOSection;
- MCSection *DwarfLocDWOSection;
- MCSection *DwarfStrOffDWOSection;
+ MCSection *DwarfInfoDWOSection = nullptr;
+ MCSection *DwarfTypesDWOSection = nullptr;
+ MCSection *DwarfAbbrevDWOSection = nullptr;
+ MCSection *DwarfStrDWOSection = nullptr;
+ MCSection *DwarfLineDWOSection = nullptr;
+ MCSection *DwarfLocDWOSection = nullptr;
+ MCSection *DwarfStrOffDWOSection = nullptr;
/// The DWARF v5 string offset and address table sections.
- MCSection *DwarfStrOffSection;
- MCSection *DwarfAddrSection;
+ MCSection *DwarfStrOffSection = nullptr;
+ MCSection *DwarfAddrSection = nullptr;
/// The DWARF v5 range list section.
- MCSection *DwarfRnglistsSection;
+ MCSection *DwarfRnglistsSection = nullptr;
/// The DWARF v5 locations list section.
- MCSection *DwarfLoclistsSection;
+ MCSection *DwarfLoclistsSection = nullptr;
/// The DWARF v5 range list section for fission.
- MCSection *DwarfRnglistsDWOSection;
+ MCSection *DwarfRnglistsDWOSection = nullptr;
// These are for Fission DWP files.
- MCSection *DwarfCUIndexSection;
- MCSection *DwarfTUIndexSection;
+ MCSection *DwarfCUIndexSection = nullptr;
+ MCSection *DwarfTUIndexSection = nullptr;
/// Section for newer gnu pubnames.
- MCSection *DwarfGnuPubNamesSection;
+ MCSection *DwarfGnuPubNamesSection = nullptr;
/// Section for newer gnu pubtypes.
- MCSection *DwarfGnuPubTypesSection;
+ MCSection *DwarfGnuPubTypesSection = nullptr;
// Section for Swift AST
- MCSection *DwarfSwiftASTSection;
+ MCSection *DwarfSwiftASTSection = nullptr;
- MCSection *COFFDebugSymbolsSection;
- MCSection *COFFDebugTypesSection;
- MCSection *COFFGlobalTypeHashesSection;
+ MCSection *COFFDebugSymbolsSection = nullptr;
+ MCSection *COFFDebugTypesSection = nullptr;
+ MCSection *COFFGlobalTypeHashesSection = nullptr;
/// Extra TLS Variable Data section.
///
/// If the target needs to put additional information for a TLS variable,
/// it'll go here.
- MCSection *TLSExtraDataSection;
+ MCSection *TLSExtraDataSection = nullptr;
/// Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
- MCSection *TLSDataSection; // Defaults to ".tdata".
+ MCSection *TLSDataSection = nullptr; // Defaults to ".tdata".
/// Section directive for Thread Local uninitialized data.
///
/// Null if this target doesn't support a BSS section. ELF and MachO only.
- MCSection *TLSBSSSection; // Defaults to ".tbss".
+ MCSection *TLSBSSSection = nullptr; // Defaults to ".tbss".
/// StackMap section.
- MCSection *StackMapSection;
+ MCSection *StackMapSection = nullptr;
/// FaultMap section.
- MCSection *FaultMapSection;
+ MCSection *FaultMapSection = nullptr;
/// Remarks section.
- MCSection *RemarksSection;
+ MCSection *RemarksSection = nullptr;
/// EH frame section.
///
/// It is initialized on demand so it can be overwritten (with uniquing).
- MCSection *EHFrameSection;
+ MCSection *EHFrameSection = nullptr;
/// Section containing metadata on function stack sizes.
- MCSection *StackSizesSection;
+ MCSection *StackSizesSection = nullptr;
mutable DenseMap<const MCSymbol *, unsigned> StackSizesUniquing;
// ELF specific sections.
- MCSection *DataRelROSection;
- MCSection *MergeableConst4Section;
- MCSection *MergeableConst8Section;
- MCSection *MergeableConst16Section;
- MCSection *MergeableConst32Section;
+ MCSection *DataRelROSection = nullptr;
+ MCSection *MergeableConst4Section = nullptr;
+ MCSection *MergeableConst8Section = nullptr;
+ MCSection *MergeableConst16Section = nullptr;
+ MCSection *MergeableConst32Section = nullptr;
// MachO specific sections.
@@ -184,34 +184,35 @@ class MCObjectFileInfo {
///
/// Contains the source code name of the variable, visibility and a pointer to
/// the initial value (.tdata or .tbss).
- MCSection *TLSTLVSection; // Defaults to ".tlv".
+ MCSection *TLSTLVSection = nullptr; // Defaults to ".tlv".
/// Section for thread local data initialization functions.
- const MCSection *TLSThreadInitSection; // Defaults to ".thread_init_func".
-
- MCSection *CStringSection;
- MCSection *UStringSection;
- MCSection *TextCoalSection;
- MCSection *ConstTextCoalSection;
- MCSection *ConstDataSection;
- MCSection *DataCoalSection;
- MCSection *ConstDataCoalSection;
- MCSection *DataCommonSection;
- MCSection *DataBSSSection;
- MCSection *FourByteConstantSection;
- MCSection *EightByteConstantSection;
- MCSection *SixteenByteConstantSection;
- MCSection *LazySymbolPointerSection;
- MCSection *NonLazySymbolPointerSection;
- MCSection *ThreadLocalPointerSection;
+ // Defaults to ".thread_init_func".
+ const MCSection *TLSThreadInitSection = nullptr;
+
+ MCSection *CStringSection = nullptr;
+ MCSection *UStringSection = nullptr;
+ MCSection *TextCoalSection = nullptr;
+ MCSection *ConstTextCoalSection = nullptr;
+ MCSection *ConstDataSection = nullptr;
+ MCSection *DataCoalSection = nullptr;
+ MCSection *ConstDataCoalSection = nullptr;
+ MCSection *DataCommonSection = nullptr;
+ MCSection *DataBSSSection = nullptr;
+ MCSection *FourByteConstantSection = nullptr;
+ MCSection *EightByteConstantSection = nullptr;
+ MCSection *SixteenByteConstantSection = nullptr;
+ MCSection *LazySymbolPointerSection = nullptr;
+ MCSection *NonLazySymbolPointerSection = nullptr;
+ MCSection *ThreadLocalPointerSection = nullptr;
/// COFF specific sections.
- MCSection *DrectveSection;
- MCSection *PDataSection;
- MCSection *XDataSection;
- MCSection *SXDataSection;
- MCSection *GFIDsSection;
- MCSection *GLJMPSection;
+ MCSection *DrectveSection = nullptr;
+ MCSection *PDataSection = nullptr;
+ MCSection *XDataSection = nullptr;
+ MCSection *SXDataSection = nullptr;
+ MCSection *GFIDsSection = nullptr;
+ MCSection *GLJMPSection = nullptr;
public:
void InitMCObjectFileInfo(const Triple &TT, bool PIC, MCContext &ctx,
@@ -393,8 +394,8 @@ class MCObjectFileInfo {
private:
Environment Env;
- bool PositionIndependent;
- MCContext *Ctx;
+ bool PositionIndependent = false;
+ MCContext *Ctx = nullptr;
Triple TT;
VersionTuple SDKVersion;
More information about the llvm-commits
mailing list