[llvm] 9afcdaa - [MCParser] De-capitalize ELFAsmParser functions. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 22:28:39 PDT 2024


Author: Fangrui Song
Date: 2024-10-22T22:28:33-07:00
New Revision: 9afcdaa3960d58abc1f6845eecb97ee337857d9c

URL: https://github.com/llvm/llvm-project/commit/9afcdaa3960d58abc1f6845eecb97ee337857d9c
DIFF: https://github.com/llvm/llvm-project/commit/9afcdaa3960d58abc1f6845eecb97ee337857d9c.diff

LOG: [MCParser] De-capitalize ELFAsmParser functions. NFC

To match the convention and DarwinAsmParser.

Added: 
    

Modified: 
    llvm/lib/MC/MCParser/ELFAsmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index c4536441665fa0..28672a19aa701b 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -41,7 +41,7 @@ class ELFAsmParser : public MCAsmParserExtension {
     getParser().addDirectiveHandler(Directive, Handler);
   }
 
-  bool ParseSectionSwitch(StringRef Section, unsigned Type, unsigned Flags,
+  bool parseSectionSwitch(StringRef Section, unsigned Type, unsigned Flags,
                           SectionKind Kind);
 
 public:
@@ -51,108 +51,108 @@ class ELFAsmParser : public MCAsmParserExtension {
     // Call the base implementation.
     this->MCAsmParserExtension::Initialize(Parser);
 
-    addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveData>(".data");
-    addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveText>(".text");
-    addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveBSS>(".bss");
-    addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveRoData>(".rodata");
-    addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTData>(".tdata");
-    addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTBSS>(".tbss");
+    addDirectiveHandler<&ELFAsmParser::parseSectionDirectiveData>(".data");
+    addDirectiveHandler<&ELFAsmParser::parseSectionDirectiveText>(".text");
+    addDirectiveHandler<&ELFAsmParser::parseSectionDirectiveBSS>(".bss");
+    addDirectiveHandler<&ELFAsmParser::parseSectionDirectiveRoData>(".rodata");
+    addDirectiveHandler<&ELFAsmParser::parseSectionDirectiveTData>(".tdata");
+    addDirectiveHandler<&ELFAsmParser::parseSectionDirectiveTBSS>(".tbss");
     addDirectiveHandler<
-      &ELFAsmParser::ParseSectionDirectiveDataRel>(".data.rel");
+      &ELFAsmParser::parseSectionDirectiveDataRel>(".data.rel");
     addDirectiveHandler<
-      &ELFAsmParser::ParseSectionDirectiveDataRelRo>(".data.rel.ro");
+      &ELFAsmParser::parseSectionDirectiveDataRelRo>(".data.rel.ro");
     addDirectiveHandler<
-      &ELFAsmParser::ParseSectionDirectiveEhFrame>(".eh_frame");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveSection>(".section");
+      &ELFAsmParser::parseSectionDirectiveEhFrame>(".eh_frame");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveSection>(".section");
     addDirectiveHandler<
-      &ELFAsmParser::ParseDirectivePushSection>(".pushsection");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectivePopSection>(".popsection");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveSize>(".size");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectivePrevious>(".previous");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveType>(".type");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveIdent>(".ident");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymver>(".symver");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveVersion>(".version");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveWeakref>(".weakref");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".weak");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".local");
+      &ELFAsmParser::parseDirectivePushSection>(".pushsection");
+    addDirectiveHandler<&ELFAsmParser::parseDirectivePopSection>(".popsection");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveSize>(".size");
+    addDirectiveHandler<&ELFAsmParser::parseDirectivePrevious>(".previous");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveType>(".type");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveIdent>(".ident");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveSymver>(".symver");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveVersion>(".version");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveWeakref>(".weakref");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveSymbolAttribute>(".weak");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveSymbolAttribute>(".local");
     addDirectiveHandler<
-      &ELFAsmParser::ParseDirectiveSymbolAttribute>(".protected");
+      &ELFAsmParser::parseDirectiveSymbolAttribute>(".protected");
     addDirectiveHandler<
-      &ELFAsmParser::ParseDirectiveSymbolAttribute>(".internal");
+      &ELFAsmParser::parseDirectiveSymbolAttribute>(".internal");
     addDirectiveHandler<
-      &ELFAsmParser::ParseDirectiveSymbolAttribute>(".hidden");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveSubsection>(".subsection");
-    addDirectiveHandler<&ELFAsmParser::ParseDirectiveCGProfile>(".cg_profile");
+      &ELFAsmParser::parseDirectiveSymbolAttribute>(".hidden");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveSubsection>(".subsection");
+    addDirectiveHandler<&ELFAsmParser::parseDirectiveCGProfile>(".cg_profile");
   }
 
   // FIXME: Part of this logic is duplicated in the MCELFStreamer. What is
   // the best way for us to get access to it?
-  bool ParseSectionDirectiveData(StringRef, SMLoc) {
-    return ParseSectionSwitch(".data", ELF::SHT_PROGBITS,
+  bool parseSectionDirectiveData(StringRef, SMLoc) {
+    return parseSectionSwitch(".data", ELF::SHT_PROGBITS,
                               ELF::SHF_WRITE | ELF::SHF_ALLOC,
                               SectionKind::getData());
   }
-  bool ParseSectionDirectiveText(StringRef, SMLoc) {
-    return ParseSectionSwitch(".text", ELF::SHT_PROGBITS,
+  bool parseSectionDirectiveText(StringRef, SMLoc) {
+    return parseSectionSwitch(".text", ELF::SHT_PROGBITS,
                               ELF::SHF_EXECINSTR |
                               ELF::SHF_ALLOC, SectionKind::getText());
   }
-  bool ParseSectionDirectiveBSS(StringRef, SMLoc) {
-    return ParseSectionSwitch(".bss", ELF::SHT_NOBITS,
+  bool parseSectionDirectiveBSS(StringRef, SMLoc) {
+    return parseSectionSwitch(".bss", ELF::SHT_NOBITS,
                               ELF::SHF_WRITE |
                               ELF::SHF_ALLOC, SectionKind::getBSS());
   }
-  bool ParseSectionDirectiveRoData(StringRef, SMLoc) {
-    return ParseSectionSwitch(".rodata", ELF::SHT_PROGBITS,
+  bool parseSectionDirectiveRoData(StringRef, SMLoc) {
+    return parseSectionSwitch(".rodata", ELF::SHT_PROGBITS,
                               ELF::SHF_ALLOC,
                               SectionKind::getReadOnly());
   }
-  bool ParseSectionDirectiveTData(StringRef, SMLoc) {
-    return ParseSectionSwitch(".tdata", ELF::SHT_PROGBITS,
+  bool parseSectionDirectiveTData(StringRef, SMLoc) {
+    return parseSectionSwitch(".tdata", ELF::SHT_PROGBITS,
                               ELF::SHF_ALLOC |
                               ELF::SHF_TLS | ELF::SHF_WRITE,
                               SectionKind::getThreadData());
   }
-  bool ParseSectionDirectiveTBSS(StringRef, SMLoc) {
-    return ParseSectionSwitch(".tbss", ELF::SHT_NOBITS,
+  bool parseSectionDirectiveTBSS(StringRef, SMLoc) {
+    return parseSectionSwitch(".tbss", ELF::SHT_NOBITS,
                               ELF::SHF_ALLOC |
                               ELF::SHF_TLS | ELF::SHF_WRITE,
                               SectionKind::getThreadBSS());
   }
-  bool ParseSectionDirectiveDataRel(StringRef, SMLoc) {
-    return ParseSectionSwitch(".data.rel", ELF::SHT_PROGBITS,
+  bool parseSectionDirectiveDataRel(StringRef, SMLoc) {
+    return parseSectionSwitch(".data.rel", ELF::SHT_PROGBITS,
                               ELF::SHF_ALLOC | ELF::SHF_WRITE,
                               SectionKind::getData());
   }
-  bool ParseSectionDirectiveDataRelRo(StringRef, SMLoc) {
-    return ParseSectionSwitch(".data.rel.ro", ELF::SHT_PROGBITS,
+  bool parseSectionDirectiveDataRelRo(StringRef, SMLoc) {
+    return parseSectionSwitch(".data.rel.ro", ELF::SHT_PROGBITS,
                               ELF::SHF_ALLOC |
                               ELF::SHF_WRITE,
                               SectionKind::getReadOnlyWithRel());
   }
-  bool ParseSectionDirectiveEhFrame(StringRef, SMLoc) {
-    return ParseSectionSwitch(".eh_frame", ELF::SHT_PROGBITS,
+  bool parseSectionDirectiveEhFrame(StringRef, SMLoc) {
+    return parseSectionSwitch(".eh_frame", ELF::SHT_PROGBITS,
                               ELF::SHF_ALLOC | ELF::SHF_WRITE,
                               SectionKind::getData());
   }
-  bool ParseDirectivePushSection(StringRef, SMLoc);
-  bool ParseDirectivePopSection(StringRef, SMLoc);
-  bool ParseDirectiveSection(StringRef, SMLoc);
-  bool ParseDirectiveSize(StringRef, SMLoc);
-  bool ParseDirectivePrevious(StringRef, SMLoc);
-  bool ParseDirectiveType(StringRef, SMLoc);
-  bool ParseDirectiveIdent(StringRef, SMLoc);
-  bool ParseDirectiveSymver(StringRef, SMLoc);
-  bool ParseDirectiveVersion(StringRef, SMLoc);
-  bool ParseDirectiveWeakref(StringRef, SMLoc);
-  bool ParseDirectiveSymbolAttribute(StringRef, SMLoc);
-  bool ParseDirectiveSubsection(StringRef, SMLoc);
-  bool ParseDirectiveCGProfile(StringRef, SMLoc);
+  bool parseDirectivePushSection(StringRef, SMLoc);
+  bool parseDirectivePopSection(StringRef, SMLoc);
+  bool parseDirectiveSection(StringRef, SMLoc);
+  bool parseDirectiveSize(StringRef, SMLoc);
+  bool parseDirectivePrevious(StringRef, SMLoc);
+  bool parseDirectiveType(StringRef, SMLoc);
+  bool parseDirectiveIdent(StringRef, SMLoc);
+  bool parseDirectiveSymver(StringRef, SMLoc);
+  bool parseDirectiveVersion(StringRef, SMLoc);
+  bool parseDirectiveWeakref(StringRef, SMLoc);
+  bool parseDirectiveSymbolAttribute(StringRef, SMLoc);
+  bool parseDirectiveSubsection(StringRef, SMLoc);
+  bool parseDirectiveCGProfile(StringRef, SMLoc);
 
 private:
-  bool ParseSectionName(StringRef &SectionName);
-  bool ParseSectionArguments(bool IsPush, SMLoc loc);
+  bool parseSectionName(StringRef &SectionName);
+  bool parseSectionArguments(bool IsPush, SMLoc loc);
   unsigned parseSunStyleSectionFlags();
   bool maybeParseSectionType(StringRef &TypeName);
   bool parseMergeSize(int64_t &Size);
@@ -165,7 +165,7 @@ class ELFAsmParser : public MCAsmParserExtension {
 
 /// ParseDirectiveSymbolAttribute
 ///  ::= { ".local", ".weak", ... } [ identifier ( , identifier )* ]
-bool ELFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
+bool ELFAsmParser::parseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
   MCSymbolAttr Attr = StringSwitch<MCSymbolAttr>(Directive)
     .Case(".weak", MCSA_Weak)
     .Case(".local", MCSA_Local)
@@ -204,7 +204,7 @@ bool ELFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
   return false;
 }
 
-bool ELFAsmParser::ParseSectionSwitch(StringRef Section, unsigned Type,
+bool ELFAsmParser::parseSectionSwitch(StringRef Section, unsigned Type,
                                       unsigned Flags, SectionKind Kind) {
   const MCExpr *Subsection = nullptr;
   if (getLexer().isNot(AsmToken::EndOfStatement)) {
@@ -219,7 +219,7 @@ bool ELFAsmParser::ParseSectionSwitch(StringRef Section, unsigned Type,
   return false;
 }
 
-bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) {
+bool ELFAsmParser::parseDirectiveSize(StringRef, SMLoc) {
   StringRef Name;
   if (getParser().parseIdentifier(Name))
     return TokError("expected identifier");
@@ -241,7 +241,7 @@ bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) {
   return false;
 }
 
-bool ELFAsmParser::ParseSectionName(StringRef &SectionName) {
+bool ELFAsmParser::parseSectionName(StringRef &SectionName) {
   // A section name can contain -, so we cannot just use
   // parseIdentifier.
   SMLoc FirstLoc = getLexer().getLoc();
@@ -392,10 +392,10 @@ unsigned ELFAsmParser::parseSunStyleSectionFlags() {
 }
 
 
-bool ELFAsmParser::ParseDirectivePushSection(StringRef s, SMLoc loc) {
+bool ELFAsmParser::parseDirectivePushSection(StringRef s, SMLoc loc) {
   getStreamer().pushSection();
 
-  if (ParseSectionArguments(/*IsPush=*/true, loc)) {
+  if (parseSectionArguments(/*IsPush=*/true, loc)) {
     getStreamer().popSection();
     return true;
   }
@@ -403,14 +403,14 @@ bool ELFAsmParser::ParseDirectivePushSection(StringRef s, SMLoc loc) {
   return false;
 }
 
-bool ELFAsmParser::ParseDirectivePopSection(StringRef, SMLoc) {
+bool ELFAsmParser::parseDirectivePopSection(StringRef, SMLoc) {
   if (!getStreamer().popSection())
     return TokError(".popsection without corresponding .pushsection");
   return false;
 }
 
-bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc loc) {
-  return ParseSectionArguments(/*IsPush=*/false, loc);
+bool ELFAsmParser::parseDirectiveSection(StringRef, SMLoc loc) {
+  return parseSectionArguments(/*IsPush=*/false, loc);
 }
 
 bool ELFAsmParser::maybeParseSectionType(StringRef &TypeName) {
@@ -536,10 +536,10 @@ static bool allowSectionTypeMismatch(const Triple &TT, StringRef SectionName,
   return false;
 }
 
-bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
+bool ELFAsmParser::parseSectionArguments(bool IsPush, SMLoc loc) {
   StringRef SectionName;
 
-  if (ParseSectionName(SectionName))
+  if (parseSectionName(SectionName))
     return TokError("expected identifier");
 
   StringRef TypeName;
@@ -724,7 +724,7 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
   return false;
 }
 
-bool ELFAsmParser::ParseDirectivePrevious(StringRef DirName, SMLoc) {
+bool ELFAsmParser::parseDirectivePrevious(StringRef DirName, SMLoc) {
   MCSectionSubPair PreviousSection = getStreamer().getPreviousSection();
   if (PreviousSection.first == nullptr)
       return TokError(".previous without corresponding .section");
@@ -752,7 +752,7 @@ static MCSymbolAttr MCAttrForString(StringRef Type) {
 ///  ::= .type identifier , @attribute
 ///  ::= .type identifier , %attribute
 ///  ::= .type identifier , "attribute"
-bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) {
+bool ELFAsmParser::parseDirectiveType(StringRef, SMLoc) {
   StringRef Name;
   if (getParser().parseIdentifier(Name))
     return TokError("expected identifier");
@@ -805,7 +805,7 @@ bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) {
 
 /// ParseDirectiveIdent
 ///  ::= .ident string
-bool ELFAsmParser::ParseDirectiveIdent(StringRef, SMLoc) {
+bool ELFAsmParser::parseDirectiveIdent(StringRef, SMLoc) {
   if (getLexer().isNot(AsmToken::String))
     return TokError("expected string");
 
@@ -823,7 +823,7 @@ bool ELFAsmParser::ParseDirectiveIdent(StringRef, SMLoc) {
 
 /// ParseDirectiveSymver
 ///  ::= .symver foo, bar2 at zed
-bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) {
+bool ELFAsmParser::parseDirectiveSymver(StringRef, SMLoc) {
   StringRef OriginalName, Name, Action;
   if (getParser().parseIdentifier(OriginalName))
     return TokError("expected identifier");
@@ -860,7 +860,7 @@ bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) {
 
 /// ParseDirectiveVersion
 ///  ::= .version string
-bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
+bool ELFAsmParser::parseDirectiveVersion(StringRef, SMLoc) {
   if (getLexer().isNot(AsmToken::String))
     return TokError("expected string");
 
@@ -884,7 +884,7 @@ bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
 
 /// ParseDirectiveWeakref
 ///  ::= .weakref foo, bar
-bool ELFAsmParser::ParseDirectiveWeakref(StringRef, SMLoc) {
+bool ELFAsmParser::parseDirectiveWeakref(StringRef, SMLoc) {
   // FIXME: Share code with the other alias building directives.
 
   StringRef AliasName;
@@ -908,7 +908,7 @@ bool ELFAsmParser::ParseDirectiveWeakref(StringRef, SMLoc) {
   return false;
 }
 
-bool ELFAsmParser::ParseDirectiveSubsection(StringRef, SMLoc) {
+bool ELFAsmParser::parseDirectiveSubsection(StringRef, SMLoc) {
   const MCExpr *Subsection = MCConstantExpr::create(0, getContext());
   if (getLexer().isNot(AsmToken::EndOfStatement)) {
     if (getParser().parseExpression(Subsection))
@@ -924,7 +924,7 @@ bool ELFAsmParser::ParseDirectiveSubsection(StringRef, SMLoc) {
                                      Subsection);
 }
 
-bool ELFAsmParser::ParseDirectiveCGProfile(StringRef S, SMLoc Loc) {
+bool ELFAsmParser::parseDirectiveCGProfile(StringRef S, SMLoc Loc) {
   return MCAsmParserExtension::ParseDirectiveCGProfile(S, Loc);
 }
 


        


More information about the llvm-commits mailing list