summaryrefslogtreecommitdiff
path: root/lib/MC/MCSectionELF.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-01-22 18:21:23 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-01-22 18:21:23 +0000
commita46918d2b1b63aa3db94aa10b9ea70209b84e274 (patch)
treebbd891a282bc1076acbf99c27001b5d617965420 /lib/MC/MCSectionELF.cpp
parent50a5aa19ca5e164904e1fd62ab5cd20ac62cb9a1 (diff)
downloadllvm-a46918d2b1b63aa3db94aa10b9ea70209b84e274.tar.gz
llvm-a46918d2b1b63aa3db94aa10b9ea70209b84e274.tar.bz2
llvm-a46918d2b1b63aa3db94aa10b9ea70209b84e274.tar.xz
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
Diffstat (limited to 'lib/MC/MCSectionELF.cpp')
-rw-r--r--lib/MC/MCSectionELF.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/MC/MCSectionELF.cpp b/lib/MC/MCSectionELF.cpp
index 4d520ecd20..ebfe269171 100644
--- a/lib/MC/MCSectionELF.cpp
+++ b/lib/MC/MCSectionELF.cpp
@@ -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;