[llvm] Use StringRef::drop_back (NFC) (#139471)
This commit is contained in:
parent
6f84ec3496
commit
18549aa1cc
@ -672,7 +672,7 @@ public:
|
||||
StringRef getAsCString() const {
|
||||
assert(isCString() && "Isn't a C string");
|
||||
StringRef Str = getAsString();
|
||||
return Str.substr(0, Str.size() - 1);
|
||||
return Str.drop_back();
|
||||
}
|
||||
|
||||
/// Return the raw, underlying, bytes of this data. Note that this is an
|
||||
|
||||
@ -726,7 +726,7 @@ static Option *getOptionPred(StringRef Name, size_t &Length,
|
||||
// characters in it (so that the next iteration will not be the empty
|
||||
// string.
|
||||
while (OMI == OptionsMap.end() && Name.size() > 1) {
|
||||
Name = Name.substr(0, Name.size() - 1); // Chop off the last character.
|
||||
Name = Name.drop_back();
|
||||
OMI = OptionsMap.find(Name);
|
||||
if (OMI != OptionsMap.end() && !Pred(OMI->getValue()))
|
||||
OMI = OptionsMap.end();
|
||||
|
||||
@ -644,9 +644,8 @@ MCSubtargetInfo *Hexagon_MC::createHexagonMCSubtargetInfo(const Triple &TT,
|
||||
void Hexagon_MC::addArchSubtarget(MCSubtargetInfo const *STI, StringRef FS) {
|
||||
assert(STI != nullptr);
|
||||
if (STI->getCPU().contains("t")) {
|
||||
auto ArchSTI = createHexagonMCSubtargetInfo(
|
||||
STI->getTargetTriple(),
|
||||
STI->getCPU().substr(0, STI->getCPU().size() - 1), FS);
|
||||
auto ArchSTI = createHexagonMCSubtargetInfo(STI->getTargetTriple(),
|
||||
STI->getCPU().drop_back(), FS);
|
||||
std::lock_guard<std::mutex> Lock(ArchSubtargetMutex);
|
||||
ArchSubtarget[std::string(STI->getCPU())] =
|
||||
std::unique_ptr<MCSubtargetInfo const>(ArchSTI);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user