From 689c3a2552b90bcc93558581eebbef9c540a0994 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 11 Mar 2022 20:07:00 -0800 Subject: [PATCH] [MC] Fix letter case of some MCSection member functions --- llvm/include/llvm/MC/MCSection.h | 4 ++-- llvm/include/llvm/MC/MCSectionCOFF.h | 6 +++--- llvm/include/llvm/MC/MCSectionELF.h | 6 +++--- llvm/include/llvm/MC/MCSectionGOFF.h | 4 ++-- llvm/include/llvm/MC/MCSectionMachO.h | 4 ++-- llvm/include/llvm/MC/MCSectionWasm.h | 4 ++-- llvm/include/llvm/MC/MCSectionXCOFF.h | 4 ++-- llvm/lib/MC/MCAsmStreamer.cpp | 2 +- llvm/lib/MC/MCAssembler.cpp | 4 ++-- llvm/lib/MC/MCParser/AsmParser.cpp | 4 ++-- llvm/lib/MC/MCParser/MasmParser.cpp | 2 +- llvm/lib/MC/MCSectionCOFF.cpp | 12 +++++------- llvm/lib/MC/MCSectionELF.cpp | 8 ++++---- llvm/lib/MC/MCSectionMachO.cpp | 4 ++-- llvm/lib/MC/MCSectionWasm.cpp | 4 ++-- llvm/lib/MC/MCSectionXCOFF.cpp | 4 ++-- llvm/lib/MC/MCStreamer.cpp | 2 +- llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 4 ++-- llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp | 2 +- llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp | 2 +- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 2 +- 21 files changed, 43 insertions(+), 45 deletions(-) diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h index 4335092..ab038ab 100644 --- a/llvm/include/llvm/MC/MCSection.h +++ b/llvm/include/llvm/MC/MCSection.h @@ -184,13 +184,13 @@ public: void dump() const; - virtual void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, + virtual void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const = 0; /// Return true if a .align directive should use "optimized nops" to fill /// instead of 0s. - virtual bool UseCodeAlign() const = 0; + virtual bool useCodeAlign() const = 0; /// Check whether this section is "virtual", that is has no actual object /// file contents. diff --git a/llvm/include/llvm/MC/MCSectionCOFF.h b/llvm/include/llvm/MC/MCSectionCOFF.h index 3ece6eb..373863e 100644 --- a/llvm/include/llvm/MC/MCSectionCOFF.h +++ b/llvm/include/llvm/MC/MCSectionCOFF.h @@ -61,7 +61,7 @@ private: public: /// Decides whether a '.section' directive should be printed before the /// section name - bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; + bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; unsigned getCharacteristics() const { return Characteristics; } MCSymbol *getCOMDATSymbol() const { return COMDATSymbol; } @@ -69,10 +69,10 @@ public: void setSelection(int Selection) const; - void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, + void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override; - bool UseCodeAlign() const override; + bool useCodeAlign() const override; bool isVirtualSection() const override; StringRef getVirtualSectionKind() const override; diff --git a/llvm/include/llvm/MC/MCSectionELF.h b/llvm/include/llvm/MC/MCSectionELF.h index 10ffb33..3b52393 100644 --- a/llvm/include/llvm/MC/MCSectionELF.h +++ b/llvm/include/llvm/MC/MCSectionELF.h @@ -67,7 +67,7 @@ private: public: /// Decides whether a '.section' directive should be printed before the /// section name - bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; + bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; unsigned getType() const { return Type; } unsigned getFlags() const { return Flags; } @@ -76,10 +76,10 @@ public: const MCSymbolELF *getGroup() const { return Group.getPointer(); } bool isComdat() const { return Group.getInt(); } - void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, + void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override; - bool UseCodeAlign() const override; + bool useCodeAlign() const override; bool isVirtualSection() const override; StringRef getVirtualSectionKind() const override; diff --git a/llvm/include/llvm/MC/MCSectionGOFF.h b/llvm/include/llvm/MC/MCSectionGOFF.h index 4ba7f79..ce36d92 100644 --- a/llvm/include/llvm/MC/MCSectionGOFF.h +++ b/llvm/include/llvm/MC/MCSectionGOFF.h @@ -29,13 +29,13 @@ private: : MCSection(SV_GOFF, Name, K, nullptr) {} public: - void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, + void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override { OS << "\t.section\t\"" << getName() << "\"\n"; } - bool UseCodeAlign() const override { return false; } + bool useCodeAlign() const override { return false; } bool isVirtualSection() const override { return false; } diff --git a/llvm/include/llvm/MC/MCSectionMachO.h b/llvm/include/llvm/MC/MCSectionMachO.h index bf89405..fdf1773 100644 --- a/llvm/include/llvm/MC/MCSectionMachO.h +++ b/llvm/include/llvm/MC/MCSectionMachO.h @@ -68,10 +68,10 @@ public: bool &TAAParsed, // Out. unsigned &StubSize); // Out. - void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, + void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override; - bool UseCodeAlign() const override; + bool useCodeAlign() const override; bool isVirtualSection() const override; static bool classof(const MCSection *S) { diff --git a/llvm/include/llvm/MC/MCSectionWasm.h b/llvm/include/llvm/MC/MCSectionWasm.h index f34dd6b..579f92a 100644 --- a/llvm/include/llvm/MC/MCSectionWasm.h +++ b/llvm/include/llvm/MC/MCSectionWasm.h @@ -58,10 +58,10 @@ public: const MCSymbolWasm *getGroup() const { return Group; } unsigned getSegmentFlags() const { return SegmentFlags; } - void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, + void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override; - bool UseCodeAlign() const override; + bool useCodeAlign() const override; bool isVirtualSection() const override; bool isWasmData() const { diff --git a/llvm/include/llvm/MC/MCSectionXCOFF.h b/llvm/include/llvm/MC/MCSectionXCOFF.h index 1dafdd3..f83e083 100644 --- a/llvm/include/llvm/MC/MCSectionXCOFF.h +++ b/llvm/include/llvm/MC/MCSectionXCOFF.h @@ -101,10 +101,10 @@ public: } MCSymbolXCOFF *getQualNameSymbol() const { return QualName; } - void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, + void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override; - bool UseCodeAlign() const override; + bool useCodeAlign() const override; bool isVirtualSection() const override; StringRef getSymbolTableName() const { return SymbolTableName; } bool isMultiSymbolsAllowed() const { return MultiSymbolsAllowed; } diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index 887947d..b27efea 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -503,7 +503,7 @@ void MCAsmStreamer::changeSection(MCSection *Section, if (MCTargetStreamer *TS = getTargetStreamer()) { TS->changeSection(getCurrentSectionOnly(), Section, Subsection, OS); } else { - Section->PrintSwitchToSection(*MAI, getContext().getTargetTriple(), OS, + Section->printSwitchToSection(*MAI, getContext().getTargetTriple(), OS, Subsection); } } diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 6c158d9..a90ad89 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -335,7 +335,7 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout, // Insert extra Nops for code alignment if the target define // shouldInsertExtraNopBytesForCodeAlign target hook. - if (AF.getParent()->UseCodeAlign() && AF.hasEmitNops() && + if (AF.getParent()->useCodeAlign() && AF.hasEmitNops() && getBackend().shouldInsertExtraNopBytesForCodeAlign(AF, Size)) return Size; @@ -874,7 +874,7 @@ void MCAssembler::layout(MCAsmLayout &Layout) { MCAlignFragment &AF = cast(Frag); // Insert fixup type for code alignment if the target define // shouldInsertFixupForCodeAlign target hook. - if (Sec.UseCodeAlign() && AF.hasEmitNops()) + if (Sec.useCodeAlign() && AF.hasEmitNops()) getBackend().shouldInsertFixupForCodeAlign(*this, Layout, AF); continue; } diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index a8139e9..bcec8cd 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -3470,9 +3470,9 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) { // directive. const MCSection *Section = getStreamer().getCurrentSectionOnly(); assert(Section && "must have section to emit alignment"); - bool UseCodeAlign = Section->UseCodeAlign(); + bool useCodeAlign = Section->useCodeAlign(); if ((!HasFillExpr || Lexer.getMAI().getTextAlignFillValue() == FillExpr) && - ValueSize == 1 && UseCodeAlign) { + ValueSize == 1 && useCodeAlign) { getStreamer().emitCodeAlignment(Alignment, &getTargetParser().getSTI(), MaxBytesToFill); } else { diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp index 5426039..aa4cc02 100644 --- a/llvm/lib/MC/MCParser/MasmParser.cpp +++ b/llvm/lib/MC/MCParser/MasmParser.cpp @@ -4759,7 +4759,7 @@ bool MasmParser::emitAlignTo(int64_t Alignment) { // directive. const MCSection *Section = getStreamer().getCurrentSectionOnly(); assert(Section && "must have section to emit alignment"); - if (Section->UseCodeAlign()) { + if (Section->useCodeAlign()) { getStreamer().emitCodeAlignment(Alignment, &getTargetParser().getSTI(), /*MaxBytesToEmit=*/0); } else { diff --git a/llvm/lib/MC/MCSectionCOFF.cpp b/llvm/lib/MC/MCSectionCOFF.cpp index 387bf2c..f7ca037 100644 --- a/llvm/lib/MC/MCSectionCOFF.cpp +++ b/llvm/lib/MC/MCSectionCOFF.cpp @@ -14,9 +14,9 @@ using namespace llvm; -// ShouldOmitSectionDirective - Decides whether a '.section' directive +// shouldOmitSectionDirective - Decides whether a '.section' directive // should be printed before the section name -bool MCSectionCOFF::ShouldOmitSectionDirective(StringRef Name, +bool MCSectionCOFF::shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const { if (COMDATSymbol) return false; @@ -34,11 +34,11 @@ void MCSectionCOFF::setSelection(int Selection) const { Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT; } -void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, +void MCSectionCOFF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const { // standard sections don't require the '.section' - if (ShouldOmitSectionDirective(getName(), MAI)) { + if (shouldOmitSectionDirective(getName(), MAI)) { OS << '\t' << getName() << '\n'; return; } @@ -104,9 +104,7 @@ void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, OS << '\n'; } -bool MCSectionCOFF::UseCodeAlign() const { - return getKind().isText(); -} +bool MCSectionCOFF::useCodeAlign() const { return getKind().isText(); } bool MCSectionCOFF::isVirtualSection() const { return getCharacteristics() & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA; diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp index 7480a68..3724a22 100644 --- a/llvm/lib/MC/MCSectionELF.cpp +++ b/llvm/lib/MC/MCSectionELF.cpp @@ -19,7 +19,7 @@ using namespace llvm; // Decides whether a '.section' directive // should be printed before the section name. -bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name, +bool MCSectionELF::shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const { if (isUnique()) return false; @@ -50,10 +50,10 @@ static void printName(raw_ostream &OS, StringRef Name) { OS << '"'; } -void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, +void MCSectionELF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const { - if (ShouldOmitSectionDirective(getName(), MAI)) { + if (shouldOmitSectionDirective(getName(), MAI)) { OS << '\t' << getName(); if (Subsection) { OS << '\t'; @@ -201,7 +201,7 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, } } -bool MCSectionELF::UseCodeAlign() const { +bool MCSectionELF::useCodeAlign() const { return getFlags() & ELF::SHF_EXECINSTR; } diff --git a/llvm/lib/MC/MCSectionMachO.cpp b/llvm/lib/MC/MCSectionMachO.cpp index a8d42c2..0c97089 100644 --- a/llvm/lib/MC/MCSectionMachO.cpp +++ b/llvm/lib/MC/MCSectionMachO.cpp @@ -102,7 +102,7 @@ MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section, } } -void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, +void MCSectionMachO::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const { OS << "\t.section\t" << getSegmentName() << ',' << getName(); @@ -166,7 +166,7 @@ void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, OS << '\n'; } -bool MCSectionMachO::UseCodeAlign() const { +bool MCSectionMachO::useCodeAlign() const { return hasAttribute(MachO::S_ATTR_PURE_INSTRUCTIONS); } diff --git a/llvm/lib/MC/MCSectionWasm.cpp b/llvm/lib/MC/MCSectionWasm.cpp index 2b1f2c7..e90f401 100644 --- a/llvm/lib/MC/MCSectionWasm.cpp +++ b/llvm/lib/MC/MCSectionWasm.cpp @@ -44,7 +44,7 @@ static void printName(raw_ostream &OS, StringRef Name) { OS << '"'; } -void MCSectionWasm::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, +void MCSectionWasm::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const { @@ -101,6 +101,6 @@ void MCSectionWasm::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, } } -bool MCSectionWasm::UseCodeAlign() const { return false; } +bool MCSectionWasm::useCodeAlign() const { return false; } bool MCSectionWasm::isVirtualSection() const { return false; } diff --git a/llvm/lib/MC/MCSectionXCOFF.cpp b/llvm/lib/MC/MCSectionXCOFF.cpp index c59c87b..e962b97 100644 --- a/llvm/lib/MC/MCSectionXCOFF.cpp +++ b/llvm/lib/MC/MCSectionXCOFF.cpp @@ -25,7 +25,7 @@ void MCSectionXCOFF::printCsectDirective(raw_ostream &OS) const { << '\n'; } -void MCSectionXCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, +void MCSectionXCOFF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const { if (getKind().isText()) { @@ -120,7 +120,7 @@ void MCSectionXCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, report_fatal_error("Printing for this SectionKind is unimplemented."); } -bool MCSectionXCOFF::UseCodeAlign() const { return getKind().isText(); } +bool MCSectionXCOFF::useCodeAlign() const { return getKind().isText(); } bool MCSectionXCOFF::isVirtualSection() const { // DWARF sections are always not virtual. diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index a42b4da..700f273 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -60,7 +60,7 @@ void MCTargetStreamer::changeSection(const MCSection *CurSection, MCSection *Section, const MCExpr *Subsection, raw_ostream &OS) { - Section->PrintSwitchToSection(*Streamer.getContext().getAsmInfo(), + Section->printSwitchToSection(*Streamer.getContext().getAsmInfo(), Streamer.getContext().getTargetTriple(), OS, Subsection); } diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 91087af..bc04be6 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -11786,7 +11786,7 @@ bool ARMAsmParser::parseDirectiveEven(SMLoc L) { } assert(Section && "must have section to emit alignment"); - if (Section->UseCodeAlign()) + if (Section->useCodeAlign()) getStreamer().emitCodeAlignment(2, &getSTI()); else getStreamer().emitValueToAlignment(2); @@ -11988,7 +11988,7 @@ bool ARMAsmParser::parseDirectiveAlign(SMLoc L) { // '.align' is target specifically handled to mean 2**2 byte alignment. const MCSection *Section = getStreamer().getCurrentSectionOnly(); assert(Section && "must have section to emit alignment"); - if (Section->UseCodeAlign()) + if (Section->useCodeAlign()) getStreamer().emitCodeAlignment(4, &getSTI(), 0); else getStreamer().emitValueToAlignment(4, 0, 1, 0); diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index d27f44c..fca98d2 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -903,7 +903,7 @@ void MipsTargetELFStreamer::finish() { unsigned Alignment = Section.getAlignment(); if (Alignment) { OS.SwitchSection(&Section); - if (Section.UseCodeAlign()) + if (Section.useCodeAlign()) OS.emitCodeAlignment(Alignment, &STI, Alignment); else OS.emitValueToAlignment(Alignment, 0, 1, Alignment); diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp index 1cbd650..b72cea5 100644 --- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp +++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp @@ -93,7 +93,7 @@ void NVPTXTargetStreamer::changeSection(const MCSection *CurSection, // Emit DWARF .file directives in the outermost scope. outputDwarfFileDirectives(); OS << "\t.section"; - Section->PrintSwitchToSection(*getStreamer().getContext().getAsmInfo(), + Section->printSwitchToSection(*getStreamer().getContext().getAsmInfo(), getStreamer().getContext().getTargetTriple(), OS, SubSection); // DWARF sections are enclosed into braces - emit the open one. diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 521e1f6..6041e43 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -4871,7 +4871,7 @@ bool X86AsmParser::parseDirectiveEven(SMLoc L) { getStreamer().initSections(false, getSTI()); Section = getStreamer().getCurrentSectionOnly(); } - if (Section->UseCodeAlign()) + if (Section->useCodeAlign()) getStreamer().emitCodeAlignment(2, &getSTI(), 0); else getStreamer().emitValueToAlignment(2, 0, 1, 0); -- 2.7.4