summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit94b993ed8acc7142a068ecf3f6325a8cb30301b1 (patch)
tree4493f51d1c01919aa6002d7481d5eaa289b8215b /llvm/lib/MC/MCSectionELF.cpp
parente0b374b5ef6a854972da83b5ab51af68fb22d2c9 (diff)
downloadbcm5719-llvm-94b993ed8acc7142a068ecf3f6325a8cb30301b1.tar.gz
bcm5719-llvm-94b993ed8acc7142a068ecf3f6325a8cb30301b1.zip
Simplify some uses of str(n)cmp with StringRef.
llvm-svn: 94189
Diffstat (limited to 'llvm/lib/MC/MCSectionELF.cpp')
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 4d520ecd20a..ebfe2691719 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud