Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[lldb] Use llvm::replace (NFC) #140343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 lldb/source/Interpreter/CommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3346,9 +3346,9 @@ bool CommandInterpreter::SaveTranscript(
CommandReturnObject &result, std::optional<std::string> output_file) {
if (output_file == std::nullopt || output_file->empty()) {
std::string now = llvm::to_string(std::chrono::system_clock::now());
std::replace(now.begin(), now.end(), ' ', '_');
llvm::replace(now, ' ', '_');
// Can't have file name with colons on Windows
std::replace(now.begin(), now.end(), ':', '-');
llvm::replace(now, ':', '-');
const std::string file_name = "lldb_session_" + now + ".log";

FileSpec save_location = GetSaveSessionDirectory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ TokenVerifier::TokenVerifier(std::string body) {
// We only care about tokens and not their original source locations. If we
// move the whole expression to only be in one line we can simplify the
// following code that extracts the token contents.
std::replace(body.begin(), body.end(), '\n', ' ');
std::replace(body.begin(), body.end(), '\r', ' ');
llvm::replace(body, '\n', ' ');
llvm::replace(body, '\r', ' ');

FileSystemOptions file_opts;
FileManager file_mgr(file_opts,
Expand Down
9 changes: 3 additions & 6 deletions 9 lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,9 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources(
// ScriptInterpreter. For now, we just replace dots with
// underscores, but if we ever support anything other than
// Python we will need to rework this
std::replace(module_basename.begin(), module_basename.end(), '.',
'_');
std::replace(module_basename.begin(), module_basename.end(), ' ',
'_');
std::replace(module_basename.begin(), module_basename.end(), '-',
'_');
llvm::replace(module_basename, '.', '_');
llvm::replace(module_basename, ' ', '_');
llvm::replace(module_basename, '-', '_');
ScriptInterpreter *script_interpreter =
target->GetDebugger().GetScriptInterpreter();
if (script_interpreter &&
Expand Down
4 changes: 2 additions & 2 deletions 4 lldb/source/Utility/FileSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Denormalize(llvm::SmallVectorImpl<char> &path, FileSpec::Style style) {
if (PathStyleIsPosix(style))
return;

std::replace(path.begin(), path.end(), '/', '\\');
llvm::replace(path, '/', '\\');
}

} // end anonymous namespace
Expand Down Expand Up @@ -186,7 +186,7 @@ void FileSpec::SetFile(llvm::StringRef pathname, Style style) {

// Normalize back slashes to forward slashes
if (m_style == Style::windows)
std::replace(resolved.begin(), resolved.end(), '\\', '/');
llvm::replace(resolved, '\\', '/');

if (resolved.empty()) {
// If we have no path after normalization set the path to the current
Expand Down
2 changes: 1 addition & 1 deletion 2 lldb/utils/TableGen/LLDBOptionDefEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static void emitOptions(std::string Command, ArrayRef<const Record *> Records,
std::vector<CommandOption> Options(Records.begin(), Records.end());

std::string ID = Command;
std::replace(ID.begin(), ID.end(), ' ', '_');
llvm::replace(ID, ' ', '_');
// Generate the macro that the user needs to define before including the
// *.inc file.
std::string NeededMacro = "LLDB_OPTIONS_" + ID;
Expand Down
4 changes: 2 additions & 2 deletions 4 lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static void emityProperties(std::string PropertyName,
// Generate the macro that the user needs to define before including the
// *.inc file.
std::string NeededMacro = "LLDB_PROPERTIES_" + PropertyName;
std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_');
llvm::replace(NeededMacro, ' ', '_');

// All options are in one file, so we need put them behind macros and ask the
// user to define the macro for the options that are needed.
Expand All @@ -154,7 +154,7 @@ static void emitPropertyEnum(std::string PropertyName,
// Generate the macro that the user needs to define before including the
// *.inc file.
std::string NeededMacro = "LLDB_PROPERTIES_" + PropertyName;
std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_');
llvm::replace(NeededMacro, ' ', '_');

// All options are in one file, so we need put them behind macros and ask the
// user to define the macro for the options that are needed.
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.