diff options
author | Kazu Hirata <kazu@google.com> | 2025-04-26 18:18:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-26 18:18:09 -0700 |
commit | 8210cdd764cb0b334f2bc205b316e94480c47c88 (patch) | |
tree | 2c8d555403767b4467bd3f6f7d070ac69872e3da /llvm/tools/llvm-config/llvm-config.cpp | |
parent | fda8b751bd676190251721cb4840e82dd378f3fb (diff) | |
download | llvm-8210cdd764cb0b334f2bc205b316e94480c47c88.zip llvm-8210cdd764cb0b334f2bc205b316e94480c47c88.tar.gz llvm-8210cdd764cb0b334f2bc205b316e94480c47c88.tar.bz2 |
[llvm] Use llvm::replace (NFC) (#137481)
Diffstat (limited to 'llvm/tools/llvm-config/llvm-config.cpp')
-rw-r--r-- | llvm/tools/llvm-config/llvm-config.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp index a54538b..49df8fd 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -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); |