[llvm-commits] [llvm] r117477 - /llvm/trunk/lib/MC/ELFObjectWriter.cpp
Benjamin Kramer
benny.kra at googlemail.com
Wed Oct 27 12:53:52 PDT 2010
Author: d0k
Date: Wed Oct 27 14:53:52 2010
New Revision: 117477
URL: http://llvm.org/viewvc/llvm-project?rev=117477&view=rev
Log:
Replace pointer arithmetic with StringRef::substr.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=117477&r1=117476&r2=117477&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed Oct 27 14:53:52 2010
@@ -459,12 +459,12 @@
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 @@
!Rest.startswith("@@@"))
report_fatal_error("A @@ version cannot be undefined");
- std::pair<const MCSymbol *, const MCSymbol *> t(&Symbol, &Alias);
- Renames.insert(t);
+ Renames.insert(std::make_pair(&Symbol, &Alias));
}
}
@@ -887,9 +886,9 @@
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();
More information about the llvm-commits
mailing list