mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Use basic_string::find(char) instead of basic_string::find(const char *s, size_type pos=0)
Many (StringRef) cannot be detected by clang-tidy performance-faster-string-find.
This commit is contained in:
parent
74da8abf7f
commit
8b5501e7ef
@ -108,7 +108,7 @@ rescheduleLexographically(std::vector<MachineInstr *> instructions,
|
||||
OS.flush();
|
||||
|
||||
// Trim the assignment, or start from the beginning in the case of a store.
|
||||
const size_t i = S.find("=");
|
||||
const size_t i = S.find('=');
|
||||
StringInstrMap.push_back({(i == std::string::npos) ? S : S.substr(i), II});
|
||||
}
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ bool Pattern::parsePattern(StringRef PatternStr, StringRef Prefix,
|
||||
|
||||
// Parse string variable or legacy @LINE expression.
|
||||
if (!IsNumBlock) {
|
||||
size_t VarEndIdx = MatchStr.find(":");
|
||||
size_t VarEndIdx = MatchStr.find(':');
|
||||
size_t SpacePos = MatchStr.substr(0, VarEndIdx).find_first_of(" \t");
|
||||
if (SpacePos != StringRef::npos) {
|
||||
SM.PrintMessage(SMLoc::getFromPointer(MatchStr.data() + SpacePos),
|
||||
|
@ -324,7 +324,7 @@ StringRef sys::detail::getHostCPUNameForS390x(StringRef ProcCpuinfoContent) {
|
||||
SmallVector<StringRef, 32> CPUFeatures;
|
||||
for (unsigned I = 0, E = Lines.size(); I != E; ++I)
|
||||
if (Lines[I].startswith("features")) {
|
||||
size_t Pos = Lines[I].find(":");
|
||||
size_t Pos = Lines[I].find(':');
|
||||
if (Pos != StringRef::npos) {
|
||||
Lines[I].drop_front(Pos + 1).split(CPUFeatures, ' ');
|
||||
break;
|
||||
|
@ -179,7 +179,7 @@ void SystemZHazardRecognizer::dumpSU(SUnit *SU, raw_ostream &OS) const {
|
||||
*SchedModel->getProcResource(PI->ProcResourceIdx);
|
||||
std::string FU(PRD.Name);
|
||||
// trim e.g. Z13_FXaUnit -> FXa
|
||||
FU = FU.substr(FU.find("_") + 1);
|
||||
FU = FU.substr(FU.find('_') + 1);
|
||||
size_t Pos = FU.find("Unit");
|
||||
if (Pos != std::string::npos)
|
||||
FU.resize(Pos);
|
||||
|
@ -691,7 +691,7 @@ static const void *getSymbolsAndView(claimed_file &F) {
|
||||
static void getThinLTOOldAndNewSuffix(std::string &OldSuffix,
|
||||
std::string &NewSuffix) {
|
||||
assert(options::thinlto_object_suffix_replace.empty() ||
|
||||
options::thinlto_object_suffix_replace.find(";") != StringRef::npos);
|
||||
options::thinlto_object_suffix_replace.find(';') != StringRef::npos);
|
||||
StringRef SuffixReplace = options::thinlto_object_suffix_replace;
|
||||
auto Split = SuffixReplace.split(';');
|
||||
OldSuffix = std::string(Split.first);
|
||||
@ -847,7 +847,7 @@ static CodeGenOpt::Level getCGOptLevel() {
|
||||
static void getThinLTOOldAndNewPrefix(std::string &OldPrefix,
|
||||
std::string &NewPrefix) {
|
||||
StringRef PrefixReplace = options::thinlto_prefix_replace;
|
||||
assert(PrefixReplace.empty() || PrefixReplace.find(";") != StringRef::npos);
|
||||
assert(PrefixReplace.empty() || PrefixReplace.find(';') != StringRef::npos);
|
||||
auto Split = PrefixReplace.split(';');
|
||||
OldPrefix = std::string(Split.first);
|
||||
NewPrefix = std::string(Split.second);
|
||||
|
@ -465,7 +465,7 @@ static void createCombinedModuleSummaryIndex() {
|
||||
static void getThinLTOOldAndNewPrefix(std::string &OldPrefix,
|
||||
std::string &NewPrefix) {
|
||||
assert(ThinLTOPrefixReplace.empty() ||
|
||||
ThinLTOPrefixReplace.find(";") != StringRef::npos);
|
||||
ThinLTOPrefixReplace.find(';') != StringRef::npos);
|
||||
StringRef PrefixReplace = ThinLTOPrefixReplace;
|
||||
std::pair<StringRef, StringRef> Split = PrefixReplace.split(";");
|
||||
OldPrefix = Split.first.str();
|
||||
|
Loading…
Reference in New Issue
Block a user