From 07ee63283cc2b9a4d6c98ecd30d1b721fe3cb29a Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 27 Oct 2010 19:53:52 +0000 Subject: [PATCH] Replace pointer arithmetic with StringRef::substr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117477 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/ELFObjectWriter.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 1904397fe11..addda8a02b0 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -459,12 +459,12 @@ void ELFObjectWriterImpl::ExecutePostLayoutBinding(MCAssembler &Asm) { if (!Alias.isVariable()) continue; const MCSymbol &Symbol = AliasedSymbol(Alias); - const StringRef &AliasName = Alias.getName(); + StringRef AliasName = Alias.getName(); size_t Pos = AliasName.find('@'); if (Pos == StringRef::npos) continue; - StringRef Rest(AliasName.begin() + Pos); + StringRef Rest = AliasName.substr(Pos); if (!Symbol.isUndefined() && !Rest.startswith("@@@")) continue; @@ -473,8 +473,7 @@ void ELFObjectWriterImpl::ExecutePostLayoutBinding(MCAssembler &Asm) { !Rest.startswith("@@@")) report_fatal_error("A @@ version cannot be undefined"); - std::pair t(&Symbol, &Alias); - Renames.insert(t); + Renames.insert(std::make_pair(&Symbol, &Alias)); } } @@ -887,9 +886,9 @@ void ELFObjectWriterImpl::ComputeSymbolTable(MCAssembler &Asm) { size_t Pos = Name.find("@@@"); std::string FinalName; if (Pos != StringRef::npos) { - StringRef Prefix(Name.begin(), Pos); + StringRef Prefix = Name.substr(0, Pos); unsigned n = MSD.SectionIndex == ELF::SHN_UNDEF ? 2 : 1; - StringRef Suffix(Name.begin() + Pos + n); + StringRef Suffix = Name.substr(Pos + n); FinalName = Prefix.str() + Suffix.str(); } else { FinalName = Name.str();