mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Simplify some uses of str(n)cmp with StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -22,14 +22,12 @@ Create(StringRef Section, unsigned Type, unsigned Flags,
|
||||
|
||||
// ShouldOmitSectionDirective - Decides whether a '.section' directive
|
||||
// should be printed before the section name
|
||||
bool MCSectionELF::ShouldOmitSectionDirective(const char *Name,
|
||||
bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,
|
||||
const MCAsmInfo &MAI) const {
|
||||
|
||||
// FIXME: Does .section .bss/.data/.text work everywhere??
|
||||
if (strcmp(Name, ".text") == 0 ||
|
||||
strcmp(Name, ".data") == 0 ||
|
||||
(strcmp(Name, ".bss") == 0 &&
|
||||
!MAI.usesELFSectionDirectiveForBSS()))
|
||||
if (Name == ".text" || Name == ".data" ||
|
||||
(Name == ".bss" && !MAI.usesELFSectionDirectiveForBSS()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -46,7 +44,7 @@ bool MCSectionELF::ShouldPrintSectionType(unsigned Ty) const {
|
||||
void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
|
||||
raw_ostream &OS) const {
|
||||
|
||||
if (ShouldOmitSectionDirective(SectionName.c_str(), MAI)) {
|
||||
if (ShouldOmitSectionDirective(SectionName, MAI)) {
|
||||
OS << '\t' << getSectionName() << '\n';
|
||||
return;
|
||||
}
|
||||
@@ -128,7 +126,7 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
|
||||
// header index.
|
||||
bool MCSectionELF::HasCommonSymbols() const {
|
||||
|
||||
if (strncmp(SectionName.c_str(), ".gnu.linkonce.", 14) == 0)
|
||||
if (StringRef(SectionName).startswith(".gnu.linkonce."))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user