[llvm] Use llvm::replace (NFC) (#137481)
This commit is contained in:
@@ -116,7 +116,7 @@ public:
|
||||
std::string getFormattedName() const {
|
||||
StringRef Name = Def->getValueAsString("name");
|
||||
std::string N = Name.str();
|
||||
std::replace(N.begin(), N.end(), ' ', '_');
|
||||
llvm::replace(N, ' ', '_');
|
||||
return N;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ StringRef CodeViewDebug::getFullFilepath(const DIFile *File) {
|
||||
// Canonicalize the path. We have to do it textually because we may no longer
|
||||
// have access the file in the filesystem.
|
||||
// First, replace all slashes with backslashes.
|
||||
std::replace(Filepath.begin(), Filepath.end(), '/', '\\');
|
||||
llvm::replace(Filepath, '/', '\\');
|
||||
|
||||
// Remove all "\.\" with "\".
|
||||
size_t Cursor = 0;
|
||||
|
||||
@@ -928,8 +928,7 @@ public:
|
||||
assert(ActiveVLocIt != ActiveVLocs.end());
|
||||
|
||||
// Update all instances of Src in the variable's tracked values to Dst.
|
||||
std::replace(ActiveVLocIt->second.Ops.begin(),
|
||||
ActiveVLocIt->second.Ops.end(), SrcOp, DstOp);
|
||||
llvm::replace(ActiveVLocIt->second.Ops, SrcOp, DstOp);
|
||||
|
||||
auto &[Var, DILoc] = DVMap.lookupDVID(VarID);
|
||||
MachineInstr *MI = MTracker->emitLoc(ActiveVLocIt->second.Ops, Var, DILoc,
|
||||
|
||||
@@ -764,7 +764,7 @@ void LiveVariables::recomputeForSingleDefVirtReg(Register Reg) {
|
||||
void LiveVariables::replaceKillInstruction(Register Reg, MachineInstr &OldMI,
|
||||
MachineInstr &NewMI) {
|
||||
VarInfo &VI = getVarInfo(Reg);
|
||||
std::replace(VI.Kills.begin(), VI.Kills.end(), &OldMI, &NewMI);
|
||||
llvm::replace(VI.Kills, &OldMI, &NewMI);
|
||||
}
|
||||
|
||||
/// removeVirtualRegistersKilled - Remove all killed info for the specified
|
||||
|
||||
@@ -2713,8 +2713,7 @@ void SelectionDAGISel::UpdateChains(
|
||||
assert(ChainVal.getValueType() == MVT::Other && "Not a chain?");
|
||||
SelectionDAG::DAGNodeDeletedListener NDL(
|
||||
*CurDAG, [&](SDNode *N, SDNode *E) {
|
||||
std::replace(ChainNodesMatched.begin(), ChainNodesMatched.end(), N,
|
||||
static_cast<SDNode *>(nullptr));
|
||||
llvm::replace(ChainNodesMatched, N, static_cast<SDNode *>(nullptr));
|
||||
});
|
||||
if (ChainNode->getOpcode() != ISD::TokenFactor)
|
||||
ReplaceUses(ChainVal, InputChain);
|
||||
|
||||
@@ -31,7 +31,7 @@ LVStringPool &llvm::logicalview::getStringPool() { return StringPool; }
|
||||
std::string llvm::logicalview::transformPath(StringRef Path) {
|
||||
std::string Name(Path);
|
||||
std::transform(Name.begin(), Name.end(), Name.begin(), tolower);
|
||||
std::replace(Name.begin(), Name.end(), '\\', '/');
|
||||
llvm::replace(Name, '\\', '/');
|
||||
|
||||
// Remove all duplicate slashes.
|
||||
size_t Pos = 0;
|
||||
|
||||
@@ -63,7 +63,7 @@ std::string PDBSymbolCompiland::getSourceFileFullPath() const {
|
||||
auto Len = EnvWorkingDir.length();
|
||||
if (EnvWorkingDir[Len - 1] != '/' && EnvWorkingDir[Len - 1] != '\\') {
|
||||
std::string Path = EnvWorkingDir + "\\" + EnvSrc;
|
||||
std::replace(Path.begin(), Path.end(), '/', '\\');
|
||||
llvm::replace(Path, '/', '\\');
|
||||
// We will return it as full path if we can't find a better one.
|
||||
if (sys::path::is_absolute(Path))
|
||||
SourceFileFullPath = Path;
|
||||
|
||||
@@ -102,10 +102,8 @@ static std::string replaceIllegalFilenameChars(std::string Filename,
|
||||
std::string IllegalChars =
|
||||
is_style_windows(sys::path::Style::native) ? "\\/:?\"<>|" : "/";
|
||||
|
||||
for (char IllegalChar : IllegalChars) {
|
||||
std::replace(Filename.begin(), Filename.end(), IllegalChar,
|
||||
ReplacementChar);
|
||||
}
|
||||
for (char IllegalChar : IllegalChars)
|
||||
llvm::replace(Filename, IllegalChar, ReplacementChar);
|
||||
|
||||
return Filename;
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ void native(SmallVectorImpl<char> &Path, Style style) {
|
||||
Path = PathHome;
|
||||
}
|
||||
} else {
|
||||
std::replace(Path.begin(), Path.end(), '\\', '/');
|
||||
llvm::replace(Path, '\\', '/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ std::string convert_to_slash(StringRef path, Style style) {
|
||||
return std::string(path);
|
||||
|
||||
std::string s = path.str();
|
||||
std::replace(s.begin(), s.end(), '\\', '/');
|
||||
llvm::replace(s, '\\', '/');
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ static std::string lowerLLVMIntrinsicName(IntrinsicInst *II) {
|
||||
Function *IntrinsicFunc = II->getCalledFunction();
|
||||
assert(IntrinsicFunc && "Missing function");
|
||||
std::string FuncName = IntrinsicFunc->getName().str();
|
||||
std::replace(FuncName.begin(), FuncName.end(), '.', '_');
|
||||
llvm::replace(FuncName, '.', '_');
|
||||
FuncName = "spirv." + FuncName;
|
||||
return FuncName;
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ static std::string getSignature(FunctionType *FTy) {
|
||||
erase_if(Sig, isSpace);
|
||||
// When s2wasm parses .s file, a comma means the end of an argument. So a
|
||||
// mangled function name can contain any character but a comma.
|
||||
std::replace(Sig.begin(), Sig.end(), ',', '.');
|
||||
llvm::replace(Sig, ',', '.');
|
||||
return Sig;
|
||||
}
|
||||
|
||||
|
||||
@@ -14030,7 +14030,7 @@ static SDValue lowerV8I16GeneralSingleInputShuffle(
|
||||
// a dword. We find the adjacent index by toggling the low bit.
|
||||
int AdjIndex = InPlaceInputs[0] ^ 1;
|
||||
SourceHalfMask[AdjIndex - HalfOffset] = InPlaceInputs[1] - HalfOffset;
|
||||
std::replace(HalfMask.begin(), HalfMask.end(), InPlaceInputs[1], AdjIndex);
|
||||
llvm::replace(HalfMask, InPlaceInputs[1], AdjIndex);
|
||||
PSHUFDMask[AdjIndex / 2] = AdjIndex / 2;
|
||||
};
|
||||
fixInPlaceInputs(LToLInputs, HToLInputs, PSHUFLMask, LoMask, 0);
|
||||
@@ -14114,8 +14114,7 @@ static SDValue lowerV8I16GeneralSingleInputShuffle(
|
||||
SourceOffset;
|
||||
SourceHalfMask[InputFixed - SourceOffset] =
|
||||
IncomingInputs[0] - SourceOffset;
|
||||
std::replace(HalfMask.begin(), HalfMask.end(), IncomingInputs[0],
|
||||
InputFixed);
|
||||
llvm::replace(HalfMask, IncomingInputs[0], InputFixed);
|
||||
IncomingInputs[0] = InputFixed;
|
||||
}
|
||||
} else if (IncomingInputs.size() == 2) {
|
||||
|
||||
@@ -997,7 +997,7 @@ llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
|
||||
/*PredecessorWithTwoSuccessors=*/false,
|
||||
DTUToUse ? nullptr : DT)) {
|
||||
// Dest has been folded into Fold. Update our worklists accordingly.
|
||||
std::replace(Latches.begin(), Latches.end(), Dest, Fold);
|
||||
llvm::replace(Latches, Dest, Fold);
|
||||
llvm::erase(UnrolledLoopBlocks, Dest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,9 +142,8 @@ static void VisitComponent(const std::string &Name,
|
||||
if (AC->Library) {
|
||||
if (Missing && GetComponentLibraryPath) {
|
||||
std::string path = (*GetComponentLibraryPath)(AC->Library);
|
||||
if (DirSep == "\\") {
|
||||
std::replace(path.begin(), path.end(), '/', '\\');
|
||||
}
|
||||
if (DirSep == "\\")
|
||||
llvm::replace(path, '/', '\\');
|
||||
if (!sys::fs::exists(path))
|
||||
Missing->push_back(path);
|
||||
}
|
||||
@@ -396,13 +395,12 @@ int main(int argc, char **argv) {
|
||||
} else {
|
||||
StaticExt = "lib";
|
||||
DirSep = "\\";
|
||||
std::replace(ActiveObjRoot.begin(), ActiveObjRoot.end(), '/', '\\');
|
||||
std::replace(ActivePrefix.begin(), ActivePrefix.end(), '/', '\\');
|
||||
std::replace(ActiveBinDir.begin(), ActiveBinDir.end(), '/', '\\');
|
||||
std::replace(ActiveLibDir.begin(), ActiveLibDir.end(), '/', '\\');
|
||||
std::replace(ActiveCMakeDir.begin(), ActiveCMakeDir.end(), '/', '\\');
|
||||
std::replace(ActiveIncludeOption.begin(), ActiveIncludeOption.end(), '/',
|
||||
'\\');
|
||||
llvm::replace(ActiveObjRoot, '/', '\\');
|
||||
llvm::replace(ActivePrefix, '/', '\\');
|
||||
llvm::replace(ActiveBinDir, '/', '\\');
|
||||
llvm::replace(ActiveLibDir, '/', '\\');
|
||||
llvm::replace(ActiveCMakeDir, '/', '\\');
|
||||
llvm::replace(ActiveIncludeOption, '/', '\\');
|
||||
}
|
||||
SharedDir = ActiveBinDir;
|
||||
StaticDir = ActiveLibDir;
|
||||
@@ -437,9 +435,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (BuiltDyLib) {
|
||||
std::string path((SharedDir + DirSep + DyLibName).str());
|
||||
if (DirSep == "\\") {
|
||||
std::replace(path.begin(), path.end(), '/', '\\');
|
||||
}
|
||||
if (DirSep == "\\")
|
||||
llvm::replace(path, '/', '\\');
|
||||
DyLibExists = sys::fs::exists(path);
|
||||
if (!DyLibExists) {
|
||||
// The shared library does not exist: don't error unless the user
|
||||
@@ -554,9 +551,8 @@ int main(int argc, char **argv) {
|
||||
Components.push_back(AC.Name);
|
||||
if (AC.Library && !IsInDevelopmentTree) {
|
||||
std::string path(GetComponentLibraryPath(AC.Library, false));
|
||||
if (DirSep == "\\") {
|
||||
std::replace(path.begin(), path.end(), '/', '\\');
|
||||
}
|
||||
if (DirSep == "\\")
|
||||
llvm::replace(path, '/', '\\');
|
||||
if (DyLibExists && !sys::fs::exists(path)) {
|
||||
Components =
|
||||
GetAllDyLibComponents(IsInDevelopmentTree, true, DirSep);
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
|
||||
std::string format(StringRef Str) const {
|
||||
std::string Res = Str.str();
|
||||
std::replace(Res.begin(), Res.end(), '!', Specifier);
|
||||
llvm::replace(Res, '!', Specifier);
|
||||
return Res;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1055,9 +1055,7 @@ TEST_F(FileSystemTest, CreateDir) {
|
||||
do {
|
||||
LongPathWithUnixSeparators.append("/DirNameWith19Charss");
|
||||
} while (LongPathWithUnixSeparators.size() < 260);
|
||||
std::replace(LongPathWithUnixSeparators.begin(),
|
||||
LongPathWithUnixSeparators.end(),
|
||||
'\\', '/');
|
||||
llvm::replace(LongPathWithUnixSeparators, '\\', '/');
|
||||
ASSERT_NO_ERROR(fs::create_directories(Twine(LongPathWithUnixSeparators)));
|
||||
// cleanup
|
||||
ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) +
|
||||
@@ -2442,7 +2440,7 @@ TEST_F(FileSystemTest, widenPath) {
|
||||
EXPECT_EQ(Result, Expected);
|
||||
|
||||
// Check that Unix separators are handled correctly.
|
||||
std::replace(Input.begin(), Input.end(), '\\', '/');
|
||||
llvm::replace(Input, '\\', '/');
|
||||
ASSERT_NO_ERROR(windows::widenPath(Input, Result));
|
||||
EXPECT_EQ(Result, Expected);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user