Fix Clang-tidy readability-redundant-string-cstr warnings
Reviewers: zturner, labath
Subscribers: tberghammer, danalbert, lldb-commits
Differential Revision: https://reviews.llvm.org/D26233
llvm-svn: 285855
diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
index a866f61..90d7415 100644
--- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
@@ -66,7 +66,7 @@
error.SetErrorString("BRA::CFSD: Couldn't read module name entry.");
return nullptr;
}
- module_filespec.SetFile(module_name.c_str(), false);
+ module_filespec.SetFile(module_name, false);
}
return new BreakpointResolverAddress(bkpt, address, module_filespec);
}
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index c8be200..acdd297 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -83,7 +83,7 @@
return nullptr;
}
- FileSpec file_spec(filename.c_str(), false);
+ FileSpec file_spec(filename, false);
return new BreakpointResolverFileLine(bkpt, file_spec, line_no, offset,
check_inlines, skip_prologue,
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index 5eebc78..c07e5ae 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -414,7 +414,7 @@
match_start_point, max_return_elements,
matches),
m_include_support_files(include_support_files), m_matching_files() {
- FileSpec partial_spec(m_completion_str.c_str(), false);
+ FileSpec partial_spec(m_completion_str, false);
m_file_name = partial_spec.GetFilename().GetCString();
m_dir_name = partial_spec.GetDirectory().GetCString();
}
@@ -560,7 +560,7 @@
: CommandCompletions::Completer(interpreter, completion_str,
match_start_point, max_return_elements,
matches) {
- FileSpec partial_spec(m_completion_str.c_str(), false);
+ FileSpec partial_spec(m_completion_str, false);
m_file_name = partial_spec.GetFilename().GetCString();
m_dir_name = partial_spec.GetDirectory().GetCString();
}
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index e977698..dcf6fa2 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -2305,8 +2305,7 @@
}
}
Error error = target->SerializeBreakpointsToFile(
- FileSpec(m_options.m_filename.c_str(), true), valid_bp_ids,
- m_options.m_append);
+ FileSpec(m_options.m_filename, true), valid_bp_ids, m_options.m_append);
if (!error.Success()) {
result.AppendErrorWithFormat("error serializing breakpoints: %s.",
error.AsCString());
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 3df7fb7..ee7add9 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -635,7 +635,7 @@
}
// Verify that the command is alias-able.
- if (m_interpreter.CommandExists(alias_command.c_str())) {
+ if (m_interpreter.CommandExists(alias_command)) {
result.AppendErrorWithFormat(
"'%s' is a permanent debugger command and cannot be redefined.\n",
alias_command.c_str());
@@ -728,7 +728,7 @@
// Verify that the command is alias'able, and get the appropriate command
// object.
- if (m_interpreter.CommandExists(alias_command.c_str())) {
+ if (m_interpreter.CommandExists(alias_command)) {
result.AppendErrorWithFormat(
"'%s' is a permanent debugger command and cannot be redefined.\n",
alias_command.c_str());
@@ -780,17 +780,17 @@
args.GetCommandString(args_string);
}
- if (m_interpreter.AliasExists(alias_command.c_str()) ||
- m_interpreter.UserCommandExists(alias_command.c_str())) {
+ if (m_interpreter.AliasExists(alias_command) ||
+ m_interpreter.UserCommandExists(alias_command)) {
result.AppendWarningWithFormat(
"Overwriting existing definition for '%s'.\n",
alias_command.c_str());
}
if (CommandAlias *alias = m_interpreter.AddAlias(
- alias_command.c_str(),
+ alias_command,
use_subcommand ? subcommand_obj_sp : command_obj_sp,
- args_string.c_str())) {
+ args_string)) {
if (m_command_options.m_help.OptionWasSet())
alias->SetHelp(m_command_options.m_help.GetCurrentValue());
if (m_command_options.m_long_help.OptionWasSet())
@@ -1713,7 +1713,7 @@
// everything should be fine now, let's add this alias
CommandObjectSP command_obj_sp(new CommandObjectPythonFunction(
- m_interpreter, m_cmd_name, funct_name_str.c_str(), m_short_help,
+ m_interpreter, m_cmd_name, funct_name_str, m_short_help,
m_synchronicity));
if (!m_interpreter.AddUserCommand(m_cmd_name, command_obj_sp,
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 1df7052..eae5ddc 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -591,7 +591,7 @@
scope_string = GetScopeString(var_sp).str();
if (!scope_string.empty())
- s.PutCString(scope_string.c_str());
+ s.PutCString(scope_string);
if (m_option_variable.show_decl &&
var_sp->GetDeclaration().GetFile()) {
@@ -637,7 +637,7 @@
scope_string = GetScopeString(var_sp).str();
if (!scope_string.empty())
- s.PutCString(scope_string.c_str());
+ s.PutCString(scope_string);
// if (format != eFormatDefault)
// valobj_sp->SetFormat (format);
@@ -698,7 +698,7 @@
continue;
if (!scope_string.empty())
- s.PutCString(scope_string.c_str());
+ s.PutCString(scope_string);
if (m_option_variable.show_decl &&
var_sp->GetDeclaration().GetFile()) {
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index e4cd5a4..80e21f7 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -550,7 +550,7 @@
perms = lldb::eFilePermissionsUserRW | lldb::eFilePermissionsGroupRW |
lldb::eFilePermissionsWorldRead;
lldb::user_id_t fd = platform_sp->OpenFile(
- FileSpec(cmd_line.c_str(), false),
+ FileSpec(cmd_line, false),
File::eOpenOptionRead | File::eOpenOptionWrite |
File::eOpenOptionAppend | File::eOpenOptionCanCreate,
perms, error);
@@ -957,7 +957,7 @@
if (platform_sp) {
std::string remote_file_path(args.GetArgumentAtIndex(0));
user_id_t size =
- platform_sp->GetFileSize(FileSpec(remote_file_path.c_str(), false));
+ platform_sp->GetFileSize(FileSpec(remote_file_path, false));
if (size != UINT64_MAX) {
result.AppendMessageWithFormat("File size of %s (remote): %" PRIu64
"\n",
@@ -1793,7 +1793,7 @@
error = (platform_sp->RunShellCommand(expr, working_dir, &status, &signo,
&output, m_options.timeout));
if (!output.empty())
- result.GetOutputStream().PutCString(output.c_str());
+ result.GetOutputStream().PutCString(output);
if (status > 0) {
if (signo > 0) {
const char *signo_cstr = Host::GetSignalAsCString(signo);
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index b0231a7..6f1a50d 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -609,7 +609,7 @@
m_module_list.Clear();
if (!m_options.modules.empty()) {
for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) {
- FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+ FileSpec module_file_spec(m_options.modules[i], false);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
if (target->GetImages().FindModules(module_spec, m_module_list) == 0)
@@ -944,7 +944,7 @@
if (num_modules > 0) {
ModuleList matching_modules;
for (size_t i = 0; i < num_modules; ++i) {
- FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+ FileSpec module_file_spec(m_options.modules[i], false);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
@@ -969,7 +969,7 @@
if (num_modules > 0) {
ModuleList matching_modules;
for (size_t i = 0; i < num_modules; ++i) {
- FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+ FileSpec module_file_spec(m_options.modules[i], false);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
@@ -1228,7 +1228,7 @@
if (!m_options.modules.empty()) {
ModuleList matching_modules;
for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) {
- FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+ FileSpec module_file_spec(m_options.modules[i], false);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index ba4aeb8..9cd82c2 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1279,7 +1279,7 @@
if (width)
strm.Printf("%-*s", width, arch_str.c_str());
else
- strm.PutCString(arch_str.c_str());
+ strm.PutCString(arch_str);
}
}
diff --git a/lldb/source/Core/Broadcaster.cpp b/lldb/source/Core/Broadcaster.cpp
index 9f1ec53..d2cca7a 100644
--- a/lldb/source/Core/Broadcaster.cpp
+++ b/lldb/source/Core/Broadcaster.cpp
@@ -99,7 +99,7 @@
s.PutCString(GetBroadcasterName());
s.PutChar('.');
}
- s.PutCString(pos->second.c_str());
+ s.PutCString(pos->second);
++num_names_added;
}
}
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 806f915..96461f8 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -280,7 +280,7 @@
std::string str = lldb_utility::ansi::FormatAnsiTerminalCodes(
new_prompt, GetUseColor());
if (str.length())
- new_prompt = str.c_str();
+ new_prompt = str;
GetCommandInterpreter().UpdatePrompt(new_prompt);
EventSP prompt_change_event_sp(
new Event(CommandInterpreter::eBroadcastBitResetPrompt,
@@ -350,7 +350,7 @@
std::string str =
lldb_utility::ansi::FormatAnsiTerminalCodes(new_prompt, GetUseColor());
if (str.length())
- new_prompt = str.c_str();
+ new_prompt = str;
GetCommandInterpreter().UpdatePrompt(new_prompt);
}
@@ -1429,7 +1429,7 @@
content_stream.Flush();
// Print it.
- output_stream_sp->PutCString(content_stream.GetString().c_str());
+ output_stream_sp->PutCString(content_stream.GetString());
}
} else {
error_stream_sp->Printf("Failed to print structured "
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 5a320d1..577f2f6 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -725,15 +725,15 @@
opcode_column_width = m_opcode_name.length() + 1;
}
- ss.PutCString(m_opcode_name.c_str());
+ ss.PutCString(m_opcode_name);
ss.FillLastLineToColumn(opcode_pos + opcode_column_width, ' ');
- ss.PutCString(m_mnemonics.c_str());
+ ss.PutCString(m_mnemonics);
if (!m_comment.empty()) {
ss.FillLastLineToColumn(
opcode_pos + opcode_column_width + operand_column_width, ' ');
ss.PutCString(" ; ");
- ss.PutCString(m_comment.c_str());
+ ss.PutCString(m_comment);
}
s->Write(ss.GetData(), ss.GetSize());
}
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index 99b4a80..f5eb4d4 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -1106,7 +1106,7 @@
return true; // Only return true if all items succeeded
case Entry::Type::String:
- s.PutCString(entry.string.c_str());
+ s.PutCString(entry.string);
return true;
case Entry::Type::Scope: {
diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp
index 173d954..30b6188 100644
--- a/lldb/source/Core/Log.cpp
+++ b/lldb/source/Core/Log.cpp
@@ -107,16 +107,16 @@
llvm::raw_string_ostream stream(back_trace);
llvm::sys::PrintStackTrace(stream);
stream.flush();
- header.PutCString(back_trace.c_str());
+ header.PutCString(back_trace);
}
if (m_options.Test(LLDB_LOG_OPTION_THREADSAFE)) {
static std::recursive_mutex g_LogThreadedMutex;
std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
- stream_sp->PutCString(header.GetString().c_str());
+ stream_sp->PutCString(header.GetString());
stream_sp->Flush();
} else {
- stream_sp->PutCString(header.GetString().c_str());
+ stream_sp->PutCString(header.GetString());
stream_sp->Flush();
}
}
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 41981a4..b1a6569 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1208,7 +1208,7 @@
std::string back_trace;
llvm::raw_string_ostream stream(back_trace);
llvm::sys::PrintStackTrace(stream);
- log_message.PutCString(back_trace.c_str());
+ log_message.PutCString(back_trace);
}
log->PutCString(log_message.GetString().c_str());
}
diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp
index 6087f72..f92b7e6 100644
--- a/lldb/source/Core/Scalar.cpp
+++ b/lldb/source/Core/Scalar.cpp
@@ -289,14 +289,14 @@
case e_slonglong:
case e_sint128:
case e_sint256:
- s->PutCString(m_integer.toString(10, true).c_str());
+ s->PutCString(m_integer.toString(10, true));
break;
case e_uint:
case e_ulong:
case e_ulonglong:
case e_uint128:
case e_uint256:
- s->PutCString(m_integer.toString(10, false).c_str());
+ s->PutCString(m_integer.toString(10, false));
break;
case e_float:
case e_double:
diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp
index 8c4a3fe..2dfb269 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -477,7 +477,7 @@
error.SetErrorString("SFBM::CFSD: filter module item not a string.");
return nullptr;
}
- FileSpec module_spec(module.c_str(), false);
+ FileSpec module_spec(module, false);
return SearchFilterSP(
new SearchFilterByModule(target.shared_from_this(), module_spec));
@@ -646,7 +646,7 @@
"SFBM::CFSD: filter module item %zu not a string.", i);
return nullptr;
}
- modules.Append(FileSpec(module.c_str(), false));
+ modules.Append(FileSpec(module, false));
}
}
@@ -711,7 +711,7 @@
"SFBM::CFSD: filter module item %zu not a string.", i);
return result_sp;
}
- modules.Append(FileSpec(module.c_str(), false));
+ modules.Append(FileSpec(module, false));
}
}
@@ -733,7 +733,7 @@
"SFBM::CFSD: filter cu item %zu not a string.", i);
return nullptr;
}
- cus.Append(FileSpec(cu.c_str(), false));
+ cus.Append(FileSpec(cu, false));
}
return SearchFilterSP(new SearchFilterByModuleListAndCU(
diff --git a/lldb/source/Core/StructuredData.cpp b/lldb/source/Core/StructuredData.cpp
index 46be782..48c368d 100644
--- a/lldb/source/Core/StructuredData.cpp
+++ b/lldb/source/Core/StructuredData.cpp
@@ -181,7 +181,7 @@
if (this->GetType() == Type::eTypeDictionary) {
std::pair<llvm::StringRef, llvm::StringRef> match = path.split('.');
std::string key = match.first.str();
- ObjectSP value = this->GetAsDictionary()->GetValueForKey(key.c_str());
+ ObjectSP value = this->GetAsDictionary()->GetValueForKey(key);
if (value.get()) {
// Do we have additional words to descend? If not, return the
// value we're at right now.
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index b0e4798..235f305 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -2034,7 +2034,7 @@
if (this_had_base_class) {
if (parent_had_base_class)
s.PutCString("::");
- s.PutCString(cxx_class_name.c_str());
+ s.PutCString(cxx_class_name);
}
return parent_had_base_class || this_had_base_class;
}
diff --git a/lldb/source/DataFormatters/TypeSummary.cpp b/lldb/source/DataFormatters/TypeSummary.cpp
index f77f524..6a192d4 100644
--- a/lldb/source/DataFormatters/TypeSummary.cpp
+++ b/lldb/source/DataFormatters/TypeSummary.cpp
@@ -207,10 +207,10 @@
if (m_function_name.empty()) {
sstr.PutCString("no backing script");
} else {
- sstr.PutCString(m_function_name.c_str());
+ sstr.PutCString(m_function_name);
}
} else {
- sstr.PutCString(m_python_script.c_str());
+ sstr.PutCString(m_python_script);
}
return sstr.GetString();
}
diff --git a/lldb/source/Expression/IRDynamicChecks.cpp b/lldb/source/Expression/IRDynamicChecks.cpp
index bcc365a..b337ea2c 100644
--- a/lldb/source/Expression/IRDynamicChecks.cpp
+++ b/lldb/source/Expression/IRDynamicChecks.cpp
@@ -562,7 +562,7 @@
bool IRDynamicChecks::runOnModule(llvm::Module &M) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
- llvm::Function *function = M.getFunction(StringRef(m_func_name.c_str()));
+ llvm::Function *function = M.getFunction(StringRef(m_func_name));
if (!function) {
if (log)
diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp
index 36095de..7c3cd7e 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -433,7 +433,7 @@
// Now set the default file and line to the REPL source file
m_target.GetSourceManager().SetDefaultFileAndLine(
- FileSpec(m_repl_source_path.c_str(), false), new_default_line);
+ FileSpec(m_repl_source_path, false), new_default_line);
}
static_cast<IOHandlerEditline &>(io_handler)
.SetBaseLineNumber(m_code.GetSize() + 1);
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index 4021e37..c8972ee 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -610,7 +610,7 @@
void FileSpec::Dump(Stream *s) const {
if (s) {
std::string path{GetPath(true)};
- s->PutCString(path.c_str());
+ s->PutCString(path);
char path_separator = GetPreferredPathSeparator(m_syntax);
if (!m_filename && !path.empty() && path.back() != path_separator)
s->PutChar(path_separator);
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 05120f4..e31930f 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -539,7 +539,7 @@
FileSpec tmpdir_file_spec;
if (HostInfo::GetLLDBPath(ePathTypeLLDBTempSystemDir, tmpdir_file_spec)) {
tmpdir_file_spec.AppendPathComponent("lldb-shell-output.%%%%%%");
- llvm::sys::fs::createUniqueFile(tmpdir_file_spec.GetPath().c_str(),
+ llvm::sys::fs::createUniqueFile(tmpdir_file_spec.GetPath(),
output_file_path);
} else {
llvm::sys::fs::createTemporaryFile("lldb-shell-output.%%%%%%", "",
diff --git a/lldb/source/Host/common/HostNativeThreadBase.cpp b/lldb/source/Host/common/HostNativeThreadBase.cpp
index c1a09e1..fd39e0d 100644
--- a/lldb/source/Host/common/HostNativeThreadBase.cpp
+++ b/lldb/source/Host/common/HostNativeThreadBase.cpp
@@ -52,8 +52,7 @@
HostNativeThreadBase::ThreadCreateTrampoline(lldb::thread_arg_t arg) {
ThreadLauncher::HostThreadCreateInfo *info =
(ThreadLauncher::HostThreadCreateInfo *)arg;
- ThisThread::SetName(info->thread_name.c_str(),
- HostInfo::GetMaxThreadNameLength());
+ ThisThread::SetName(info->thread_name, HostInfo::GetMaxThreadNameLength());
thread_func_t thread_fptr = info->thread_fptr;
thread_arg_t thread_arg = info->thread_arg;
diff --git a/lldb/source/Host/common/Symbols.cpp b/lldb/source/Host/common/Symbols.cpp
index 8453428..461b15a 100644
--- a/lldb/source/Host/common/Symbols.cpp
+++ b/lldb/source/Host/common/Symbols.cpp
@@ -246,7 +246,7 @@
const uint32_t num_files = files.size();
for (size_t idx_file = 0; idx_file < num_files; ++idx_file) {
const std::string &filename = files[idx_file];
- FileSpec file_spec(filename.c_str(), true);
+ FileSpec file_spec(filename, true);
if (llvm::sys::fs::equivalent(file_spec.GetPath(),
module_spec.GetFileSpec().GetPath()))
diff --git a/lldb/source/Host/common/ThisThread.cpp b/lldb/source/Host/common/ThisThread.cpp
index 2fea0a1..b3f9ede 100644
--- a/lldb/source/Host/common/ThisThread.cpp
+++ b/lldb/source/Host/common/ThisThread.cpp
@@ -46,5 +46,5 @@
truncated_name = truncated_name.substr(begin, count);
}
- SetName(truncated_name.c_str());
+ SetName(truncated_name);
}
diff --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp
index 0f2ab79..2a01f06 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -176,7 +176,7 @@
}
});
- return g_fields->m_distribution_id.c_str();
+ return g_fields->m_distribution_id;
}
FileSpec HostInfoLinux::GetProgramFileSpec() {
diff --git a/lldb/source/Host/posix/PipePosix.cpp b/lldb/source/Host/posix/PipePosix.cpp
index a653b3e..4e0810c 100644
--- a/lldb/source/Host/posix/PipePosix.cpp
+++ b/lldb/source/Host/posix/PipePosix.cpp
@@ -142,7 +142,7 @@
// should try again.
Error error;
do {
- llvm::sys::fs::createUniqueFile(tmpdir_file_spec.GetPath().c_str(),
+ llvm::sys::fs::createUniqueFile(tmpdir_file_spec.GetPath(),
named_pipe_path);
error = CreateNew(named_pipe_path, child_process_inherit);
} while (error.GetError() == EEXIST);
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 7a41843..e9a7025 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1656,7 +1656,7 @@
if (repeat_command != nullptr)
m_repeat_command.assign(repeat_command);
else
- m_repeat_command.assign(original_command_string.c_str());
+ m_repeat_command.assign(original_command_string);
m_command_history.AppendString(original_command_string);
}
@@ -2146,7 +2146,7 @@
}
if (!init_file && !m_skip_lldbinit_files)
- init_file.SetFile(init_file_path.c_str(), false);
+ init_file.SetFile(init_file_path, false);
}
// If the file exists, tell HandleCommand to 'source' it; this will do the
@@ -2932,7 +2932,7 @@
ExtractCommand(scratch_command, next_word, suffix, quote_char);
if (cmd_obj == nullptr) {
std::string full_name;
- bool is_alias = GetAliasFullName(next_word.c_str(), full_name);
+ bool is_alias = GetAliasFullName(next_word, full_name);
cmd_obj = GetCommandObject(next_word, &matches);
bool is_real_command =
(is_alias == false) ||
@@ -2940,8 +2940,8 @@
if (!is_real_command) {
matches.Clear();
std::string alias_result;
- cmd_obj = BuildAliasResult(full_name.c_str(), scratch_command,
- alias_result, result);
+ cmd_obj =
+ BuildAliasResult(full_name, scratch_command, alias_result, result);
revised_command_line.Printf("%s", alias_result.c_str());
if (cmd_obj) {
wants_raw_input = cmd_obj->WantsRawCommandString();
diff --git a/lldb/source/Interpreter/OptionValueArray.cpp b/lldb/source/Interpreter/OptionValueArray.cpp
index 9d3c198..ae0e01c 100644
--- a/lldb/source/Interpreter/OptionValueArray.cpp
+++ b/lldb/source/Interpreter/OptionValueArray.cpp
@@ -72,7 +72,7 @@
Error OptionValueArray::SetValueFromString(llvm::StringRef value,
VarSetOperationType op) {
- Args args(value.str().c_str());
+ Args args(value.str());
Error error = SetArgs(args, op);
if (error.Success())
NotifyValueChanged();
diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp
index c844d22..edf5beb 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -198,7 +198,7 @@
Error OptionValueDictionary::SetValueFromString(llvm::StringRef value,
VarSetOperationType op) {
- Args args(value.str().c_str());
+ Args args(value.str());
Error error = SetArgs(args, op);
if (error.Success())
NotifyValueChanged();
diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp
index 732bafe..479d57e 100644
--- a/lldb/source/Interpreter/OptionValueFileSpec.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp
@@ -77,7 +77,7 @@
// or whitespace.
value = value.trim("\"' \t");
m_value_was_set = true;
- m_current_value.SetFile(value.str().c_str(), m_resolve);
+ m_current_value.SetFile(value.str(), m_resolve);
m_data_sp.reset();
m_data_mod_time.Clear();
NotifyValueChanged();
diff --git a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
index a15dd5c..1c92da5 100644
--- a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
@@ -41,7 +41,7 @@
Error OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
VarSetOperationType op) {
Error error;
- Args args(value.str().c_str());
+ Args args(value.str());
const size_t argc = args.GetArgumentCount();
switch (op) {
diff --git a/lldb/source/Interpreter/OptionValuePathMappings.cpp b/lldb/source/Interpreter/OptionValuePathMappings.cpp
index 15e50fdc..5b9850d 100644
--- a/lldb/source/Interpreter/OptionValuePathMappings.cpp
+++ b/lldb/source/Interpreter/OptionValuePathMappings.cpp
@@ -43,7 +43,7 @@
Error OptionValuePathMappings::SetValueFromString(llvm::StringRef value,
VarSetOperationType op) {
Error error;
- Args args(value.str().c_str());
+ Args args(value.str());
const size_t argc = args.GetArgumentCount();
switch (op) {
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
index 2f6e7e4..9d4f34f 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
@@ -736,7 +736,7 @@
if (op.m_negative) {
s.PutCString("-");
}
- s.PutCString(llvm::to_string(op.m_immediate).c_str());
+ s.PutCString(llvm::to_string(op.m_immediate));
break;
case Operand::Type::Invalid:
s.PutCString("Invalid");
@@ -1044,8 +1044,7 @@
} else {
thumb_arch_name = "thumbv8.2a";
}
- thumb_arch.GetTriple().setArchName(
- llvm::StringRef(thumb_arch_name.c_str()));
+ thumb_arch.GetTriple().setArchName(llvm::StringRef(thumb_arch_name));
}
// If no sub architecture specified then use the most recent arm architecture
diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
index 1093ff5..fcbba93 100644
--- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
@@ -369,7 +369,7 @@
E = m_rendezvous.loaded_end();
for (I = m_rendezvous.loaded_begin(); I != E; ++I) {
- FileSpec file(I->path.c_str(), true);
+ FileSpec file(I->path, true);
ModuleSP module_sp =
LoadModuleAtAddress(file, I->link_addr, I->base_addr, true);
if (module_sp.get()) {
@@ -393,7 +393,7 @@
E = m_rendezvous.unloaded_end();
for (I = m_rendezvous.unloaded_begin(); I != E; ++I) {
- FileSpec file(I->path.c_str(), true);
+ FileSpec file(I->path, true);
ModuleSpec module_spec(file);
ModuleSP module_sp = loaded_modules.FindFirstModule(module_spec);
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index e7c07d2..bf2549b 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -378,8 +378,7 @@
image_infos[i].mod_date =
image->GetValueForKey("mod_date")->GetAsInteger()->GetValue();
image_infos[i].file_spec.SetFile(
- image->GetValueForKey("pathname")->GetAsString()->GetValue().c_str(),
- false);
+ image->GetValueForKey("pathname")->GetAsString()->GetValue(), false);
StructuredData::Dictionary *mh =
image->GetValueForKey("mach_header")->GetAsDictionary();
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
index 70961c0..7b027de 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -472,9 +472,8 @@
info_dict->HasKey("shared_cache_base_address")) {
base_address = info_dict->GetValueForKey("shared_cache_base_address")
->GetIntegerValue(LLDB_INVALID_ADDRESS);
- std::string uuid_str = info_dict->GetValueForKey("shared_cache_uuid")
- ->GetStringValue()
- .c_str();
+ std::string uuid_str =
+ info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue();
if (!uuid_str.empty())
uuid.SetFromCString(uuid_str.c_str());
if (info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue() ==
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
index 3c20b51..c74f147 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
@@ -106,6 +106,4 @@
free(alloc);
}
-void ASTDumper::ToStream(lldb::StreamSP &stream) {
- stream->PutCString(m_dump.c_str());
-}
+void ASTDumper::ToStream(lldb::StreamSP &stream) { stream->PutCString(m_dump); }
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp
index 4081bc9..7bb784e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp
@@ -60,7 +60,7 @@
RecordDecl *struct_decl = NULL;
- StringRef desired_name(m_struct_name.c_str());
+ StringRef desired_name(m_struct_name);
for (CompoundStmt::const_body_iterator bi = body_compound_stmt->body_begin(),
be = body_compound_stmt->body_end();
@@ -125,7 +125,7 @@
if (m_ast_context && function_decl &&
!m_function.m_wrapper_function_name.compare(
- function_decl->getNameAsString().c_str())) {
+ function_decl->getNameAsString())) {
ExtractFromFunctionDecl(function_decl);
}
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 7a5f4f7..b55d664 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -922,7 +922,7 @@
std::string decl_name_string_without_colon(decl_name_string.c_str(),
decl_name_string.length() - 1);
IdentifierInfo *ident =
- &original_ctx->Idents.get(decl_name_string_without_colon.c_str());
+ &original_ctx->Idents.get(decl_name_string_without_colon);
original_selector = original_ctx->Selectors.getSelector(1, &ident);
} else {
SmallVector<IdentifierInfo *, 4> idents;
@@ -1293,7 +1293,7 @@
return false;
std::string name_str = context.m_decl_name.getAsString();
- StringRef name(name_str.c_str());
+ StringRef name(name_str);
IdentifierInfo &name_identifier(
origin_iface_decl->getASTContext().Idents.get(name));
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 3c21de2..c542b36 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -131,7 +131,7 @@
for (IDAndDiagnostic &diag : m_diagnostics) {
switch (diag.first) {
default:
- error_stream.PutCString(diag.second.c_str());
+ error_stream.PutCString(diag.second);
error_stream.PutChar('\n');
break;
case clang::DiagnosticsEngine::Level::Ignored:
@@ -441,7 +441,7 @@
if (macro_info) {
std::string macro_expansion = "#define ";
- macro_expansion.append(mi->first->getName().str().c_str());
+ macro_expansion.append(mi->first->getName().str());
{
if (macro_info->isFunctionLike()) {
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index 0956814..ac6e93c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -1149,7 +1149,7 @@
GlobalVariable *persistent_global = new GlobalVariable(
(*m_module), alloc->getType(), false, /* not constant */
GlobalValue::ExternalLinkage, NULL, /* no initializer */
- alloc->getName().str().c_str());
+ alloc->getName().str());
// What we're going to do here is make believe this was a regular old external
// variable. That means we need to make the metadata valid.
diff --git a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
index 45c26e8..4216c5a 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -244,7 +244,7 @@
if (thread_sp)
thread_sp->SetStopInfo(InstrumentationRuntimeStopInfo::
CreateStopReasonWithInstrumentationData(
- *thread_sp, description.c_str(), report));
+ *thread_sp, description, report));
StreamFileSP stream_sp(
process_sp->GetTarget().GetDebugger().GetOutputFile());
diff --git a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
index c78836a..84c8b64 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
@@ -817,7 +817,7 @@
thread_sp->SetStopInfo(
InstrumentationRuntimeStopInfo::
CreateStopReasonWithInstrumentationData(
- *thread_sp, stop_reason_description.c_str(), report));
+ *thread_sp, stop_reason_description, report));
StreamFileSP stream_sp(
process_sp->GetTarget().GetDebugger().GetOutputFile());
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index b20c4f9..406fa50 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -972,7 +972,7 @@
FileSpecList file_spec_list;
if (!m_gnu_debuglink_file.empty()) {
- FileSpec file_spec(m_gnu_debuglink_file.c_str(), false);
+ FileSpec file_spec(m_gnu_debuglink_file, false);
file_spec_list.Append(file_spec);
}
return file_spec_list;
diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
index 2578b9a..79ad8f5 100644
--- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp
+++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
@@ -428,7 +428,7 @@
Error AdbClient::SyncService::internalPullFile(const FileSpec &remote_file,
const FileSpec &local_file) {
const auto local_file_path = local_file.GetPath();
- llvm::FileRemover local_file_remover(local_file_path.c_str());
+ llvm::FileRemover local_file_remover(local_file_path);
std::ofstream dst(local_file_path, std::ios::out | std::ios::binary);
if (!dst.is_open())
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 364bd91..9f1a389 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -345,7 +345,7 @@
log->Printf("Failed to remove temp directory: %s", error.AsCString());
});
- FileSpec symfile_platform_filespec(tmpdir.c_str(), false);
+ FileSpec symfile_platform_filespec(tmpdir, false);
symfile_platform_filespec.AppendPathComponent("symbolized.oat");
// Execute oatdump on the remote device to generate a file with symtab
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index b47fc77..a92a8da 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -373,7 +373,7 @@
if (!cache_path.empty()) {
std::string module_path(module_spec.GetFileSpec().GetPath());
cache_path.append(module_path);
- FileSpec module_cache_spec(cache_path.c_str(), false);
+ FileSpec module_cache_spec(cache_path, false);
// if rsync is supported, always bring in the file - rsync will be very
// efficient
@@ -1294,7 +1294,7 @@
if (xcode_select_prefix_dir)
xcode_dir_path.append(xcode_select_prefix_dir);
xcode_dir_path.append("/usr/share/xcode-select/xcode_dir_path");
- temp_file_spec.SetFile(xcode_dir_path.c_str(), false);
+ temp_file_spec.SetFile(xcode_dir_path, false);
size_t bytes_read = temp_file_spec.ReadFileContents(
0, developer_dir_path, sizeof(developer_dir_path), NULL);
if (bytes_read > 0) {
@@ -1436,7 +1436,7 @@
size_t pos = path_to_shlib.rfind(substr);
if (pos != std::string::npos) {
path_to_shlib.erase(pos + strlen(substr));
- FileSpec ret(path_to_shlib.c_str(), false);
+ FileSpec ret(path_to_shlib, false);
FileSpec xcode_binary_path = ret;
xcode_binary_path.AppendPathComponent("MacOS");
@@ -1503,7 +1503,7 @@
}
output.append("/..");
- g_xcode_filespec = CheckPathForXcode(FileSpec(output.c_str(), false));
+ g_xcode_filespec = CheckPathForXcode(FileSpec(output, false));
}
}
}
@@ -1604,7 +1604,7 @@
enumerator_info.sdk_type = sdk_type;
- FileSpec::EnumerateDirectory(sdks_spec.GetPath().c_str(), find_directories,
+ FileSpec::EnumerateDirectory(sdks_spec.GetPath(), find_directories,
find_files, find_other, DirectoryEnumerator,
&enumerator_info);
@@ -1654,8 +1654,7 @@
FileSpec native_sdk_spec = sdks_spec;
StreamString native_sdk_name;
native_sdk_name.Printf("MacOSX%u.%u.sdk", major, minor);
- native_sdk_spec.AppendPathComponent(
- native_sdk_name.GetString().c_str());
+ native_sdk_spec.AppendPathComponent(native_sdk_name.GetString());
if (native_sdk_spec.Exists()) {
return native_sdk_spec;
@@ -1744,22 +1743,19 @@
minimum_version_option.PutCString("-mios-version-min=");
minimum_version_option.PutCString(
clang::VersionTuple(versions[0], versions[1], versions[2])
- .getAsString()
- .c_str());
+ .getAsString());
break;
case SDKType::iPhoneSimulator:
minimum_version_option.PutCString("-mios-simulator-version-min=");
minimum_version_option.PutCString(
clang::VersionTuple(versions[0], versions[1], versions[2])
- .getAsString()
- .c_str());
+ .getAsString());
break;
case SDKType::MacOSX:
minimum_version_option.PutCString("-mmacosx-version-min=");
minimum_version_option.PutCString(
clang::VersionTuple(versions[0], versions[1], versions[2])
- .getAsString()
- .c_str());
+ .getAsString());
}
options.push_back(minimum_version_option.GetString());
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 87a546b..89b61bf 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -220,13 +220,13 @@
"SDKs/MacOSX%u.%u.sdk",
xcode_contents_path.c_str(), versions[0],
versions[1]);
- fspec.SetFile(sdk_path.GetString().c_str(), false);
+ fspec.SetFile(sdk_path.GetString(), false);
if (fspec.Exists())
return ConstString(sdk_path.GetString().c_str());
}
if (!default_xcode_sdk.empty()) {
- fspec.SetFile(default_xcode_sdk.c_str(), false);
+ fspec.SetFile(default_xcode_sdk, false);
if (fspec.Exists())
return ConstString(default_xcode_sdk.c_str());
}
@@ -270,7 +270,7 @@
std::string cache_path(GetLocalCacheDirectory());
std::string module_path(platform_file.GetPath());
cache_path.append(module_path);
- FileSpec module_cache_spec(cache_path.c_str(), false);
+ FileSpec module_cache_spec(cache_path, false);
if (module_cache_spec.Exists()) {
local_file = module_cache_spec;
return Error();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index fef09f0..d62412f 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -271,8 +271,8 @@
const bool find_other = false;
SDKDirectoryInfoCollection builtin_sdk_directory_infos;
- FileSpec::EnumerateDirectory(m_device_support_directory.c_str(),
- find_directories, find_files, find_other,
+ FileSpec::EnumerateDirectory(m_device_support_directory, find_directories,
+ find_files, find_other,
GetContainedFilesIntoVectorOfStringsCallback,
&builtin_sdk_directory_infos);
@@ -530,7 +530,7 @@
const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr};
for (size_t i = 0; paths_to_try[i] != nullptr; i++) {
- local_file.SetFile(sdkroot_path.c_str(), false);
+ local_file.SetFile(sdkroot_path, false);
if (paths_to_try[i][0] != '\0')
local_file.AppendPathComponent(paths_to_try[i]);
local_file.AppendPathComponent(platform_file_path);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
index b815e4f..b64aa62 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
@@ -281,8 +281,8 @@
const bool find_other = false;
SDKDirectoryInfoCollection builtin_sdk_directory_infos;
- FileSpec::EnumerateDirectory(m_device_support_directory.c_str(),
- find_directories, find_files, find_other,
+ FileSpec::EnumerateDirectory(m_device_support_directory, find_directories,
+ find_files, find_other,
GetContainedFilesIntoVectorOfStringsCallback,
&builtin_sdk_directory_infos);
@@ -452,14 +452,13 @@
m_device_support_directory.assign(device_support_dir);
m_device_support_directory.append(
"/Platforms/watchOS.platform/DeviceSupport");
- FileSpec platform_device_support_dir(m_device_support_directory.c_str(),
- true);
+ FileSpec platform_device_support_dir(m_device_support_directory, true);
if (!platform_device_support_dir.Exists()) {
std::string alt_platform_dirname = device_support_dir;
alt_platform_dirname.append(
"/Platforms/WatchOS.platform/DeviceSupport");
- FileSpec alt_platform_device_support_dir(
- m_device_support_directory.c_str(), true);
+ FileSpec alt_platform_device_support_dir(m_device_support_directory,
+ true);
if (alt_platform_device_support_dir.Exists()) {
m_device_support_directory = alt_platform_dirname;
}
@@ -545,7 +544,7 @@
const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr};
for (size_t i = 0; paths_to_try[i] != nullptr; i++) {
- local_file.SetFile(sdkroot_path.c_str(), false);
+ local_file.SetFile(sdkroot_path, false);
if (paths_to_try[i][0] != '\0')
local_file.AppendPathComponent(paths_to_try[i]);
local_file.AppendPathComponent(platform_file_path);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index 6abd6e9..0553b1b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -288,8 +288,8 @@
const bool find_other = false;
SDKDirectoryInfoCollection builtin_sdk_directory_infos;
- FileSpec::EnumerateDirectory(m_device_support_directory.c_str(),
- find_directories, find_files, find_other,
+ FileSpec::EnumerateDirectory(m_device_support_directory, find_directories,
+ find_files, find_other,
GetContainedFilesIntoVectorOfStringsCallback,
&builtin_sdk_directory_infos);
@@ -516,7 +516,7 @@
const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr};
for (size_t i = 0; paths_to_try[i] != nullptr; i++) {
- local_file.SetFile(sdkroot_path.c_str(), false);
+ local_file.SetFile(sdkroot_path, false);
if (paths_to_try[i][0] != '\0')
local_file.AppendPathComponent(paths_to_try[i]);
local_file.AppendPathComponent(platform_file_path);
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 8e2587b..8494077 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -2475,7 +2475,7 @@
if (columns.size() < 6)
return true; // continue searching
- FileSpec this_file_spec(columns[5].str().c_str(), false);
+ FileSpec this_file_spec(columns[5].str(), false);
if (this_file_spec.GetFilename() != module_file_spec.GetFilename())
return true; // continue searching
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 06b1b36..6019428 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -880,8 +880,8 @@
}
}
- m_history.AddPacket(m_bytes.c_str(), total_length,
- History::ePacketTypeRecv, total_length);
+ m_history.AddPacket(m_bytes, total_length, History::ePacketTypeRecv,
+ total_length);
// Clear packet_str in case there is some existing data in it.
packet_str.clear();
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 600bd9c..da62908 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -345,7 +345,7 @@
packet.PutCString("qSupported");
for (uint32_t i = 0; i < features.size(); ++i) {
packet.PutCString(i == 0 ? ":" : ";");
- packet.PutCString(features[i].c_str());
+ packet.PutCString(features[i]);
}
StringExtractorGDBRemote response;
@@ -1070,7 +1070,7 @@
if (avail_type != CompressionType::None) {
StringExtractorGDBRemote response;
std::string packet = "QEnableCompression:type:" + avail_name + ";";
- if (SendPacketAndWaitForResponse(packet.c_str(), response, false) !=
+ if (SendPacketAndWaitForResponse(packet, response, false) !=
PacketResult::Success)
return;
@@ -1772,7 +1772,7 @@
// control the characters in a process name
std::string name;
extractor.GetHexByteString(name);
- process_info.GetExecutableFile().SetFile(name.c_str(), false);
+ process_info.GetExecutableFile().SetFile(name, false);
} else if (name.equals("cputype")) {
value.getAsInteger(0, cpu);
} else if (name.equals("cpusubtype")) {
@@ -2015,7 +2015,7 @@
match_info.GetProcessInfo().GetArchitecture();
const llvm::Triple &triple = match_arch.GetTriple();
packet.PutCString("triple:");
- packet.PutCString(triple.getTriple().c_str());
+ packet.PutCString(triple.getTriple());
packet.PutChar(';');
}
}
@@ -3201,7 +3201,7 @@
StringExtractor extractor(value);
std::string path;
extractor.GetHexByteString(path);
- module_spec.GetFileSpec() = FileSpec(path.c_str(), false, arch_spec);
+ module_spec.GetFileSpec() = FileSpec(path, false, arch_spec);
}
}
@@ -3322,7 +3322,7 @@
<< "," << std::hex << size;
GDBRemoteCommunication::PacketResult res =
- SendPacketAndWaitForResponse(packet.str().c_str(), chunk, false);
+ SendPacketAndWaitForResponse(packet.str(), chunk, false);
if (res != GDBRemoteCommunication::PacketResult::Success) {
err.SetErrorString("Error sending $qXfer packet");
@@ -3609,8 +3609,8 @@
// Send the packet.
const bool send_async = false;
StringExtractorGDBRemote response;
- auto result = SendPacketAndWaitForResponse(stream.GetString().c_str(),
- response, send_async);
+ auto result =
+ SendPacketAndWaitForResponse(stream.GetString(), response, send_async);
if (result == PacketResult::Success) {
// We failed if the config result comes back other than OK.
if (strcmp(response.GetStringRef().c_str(), "OK") == 0) {
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index 7c46c21..28d94f8 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -358,8 +358,7 @@
StringExtractor extractor(value);
std::string file;
extractor.GetHexByteString(file);
- match_info.GetProcessInfo().GetExecutableFile().SetFile(file.c_str(),
- false);
+ match_info.GetProcessInfo().GetExecutableFile().SetFile(file, false);
} else if (key.equals("name_match")) {
NameMatchType name_match =
llvm::StringSwitch<NameMatchType>(value)
@@ -644,8 +643,7 @@
std::string path;
packet.GetHexByteString(path);
if (!path.empty()) {
- lldb::user_id_t retcode =
- FileSystem::GetFileSize(FileSpec(path.c_str(), false));
+ lldb::user_id_t retcode = FileSystem::GetFileSize(FileSpec(path, false));
StreamString response;
response.PutChar('F');
response.PutHex64(retcode);
@@ -684,7 +682,7 @@
std::string path;
packet.GetHexByteString(path);
if (!path.empty()) {
- bool retcode = FileSystem::GetFileExists(FileSpec(path.c_str(), false));
+ bool retcode = FileSystem::GetFileExists(FileSpec(path, false));
StreamString response;
response.PutChar('F');
response.PutChar(',');
@@ -776,7 +774,7 @@
if (!path.empty()) {
uint64_t a, b;
StreamGDBRemote response;
- if (!FileSystem::CalculateMD5(FileSpec(path.c_str(), false), a, b)) {
+ if (!FileSystem::CalculateMD5(FileSpec(path, false), a, b)) {
response.PutCString("F,");
response.PutCString("x");
} else {
@@ -1031,8 +1029,7 @@
if (success) {
if (arg_idx == 0)
- m_process_launch_info.GetExecutableFile().SetFile(arg.c_str(),
- false);
+ m_process_launch_info.GetExecutableFile().SetFile(arg, false);
m_process_launch_info.GetArguments().AppendArgument(arg);
if (log)
log->Printf("LLGSPacketHandler::%s added arg %d: \"%s\"",
@@ -1276,7 +1273,7 @@
#ifdef __ANDROID__
return HostInfoAndroid::ResolveLibraryPath(module_path, arch);
#else
- return FileSpec(module_path.c_str(), true);
+ return FileSpec(module_path, true);
#endif
}
@@ -1284,7 +1281,7 @@
const std::string &module_path, const std::string &triple) {
ArchSpec arch(triple.c_str());
- const FileSpec req_module_path_spec(module_path.c_str(), true);
+ const FileSpec req_module_path_spec(module_path, true);
const FileSpec module_path_spec =
FindModuleFile(req_module_path_spec.GetPath(), arch);
const ModuleSpec module_spec(module_path_spec, arch);
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 754cdb0..0897611 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -667,7 +667,7 @@
if (::strcspn(thread_name.c_str(), "$#+-;:") == thread_name_len) {
response.PutCString("name:");
- response.PutCString(thread_name.c_str());
+ response.PutCString(thread_name);
} else {
// The thread name contains special chars, send as hex bytes.
response.PutCString("hexname:");
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 80d6b8a..33b60b5 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -128,7 +128,7 @@
std::string platform_ip;
int platform_port;
std::string platform_path;
- bool ok = UriParser::Parse(GetConnection()->GetURI().c_str(), platform_scheme,
+ bool ok = UriParser::Parse(GetConnection()->GetURI(), platform_scheme,
platform_ip, platform_port, platform_path);
UNUSED_IF_ASSERT_DISABLED(ok);
assert(ok);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index f96bfe7..4a3cc7f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2321,7 +2321,7 @@
reason = "watchpoint";
StreamString ostr;
ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
- description = ostr.GetString().c_str();
+ description = ostr.GetString();
} else if (key.compare("library") == 0) {
LoadModules();
} else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) {
@@ -4579,7 +4579,7 @@
if (!modInfo.get_link_map(link_map))
link_map = LLDB_INVALID_ADDRESS;
- FileSpec file(mod_name.c_str(), true);
+ FileSpec file(mod_name, true);
lldb::ModuleSP module_sp =
LoadModuleAtAddress(file, link_map, mod_base, mod_base_is_offset);
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index f2f3d5b..f3453f2 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -1021,7 +1021,7 @@
if (mode.empty())
return 0;
- return llvm::StringSwitch<uint32_t>(mode.str().c_str())
+ return llvm::StringSwitch<uint32_t>(mode.str())
.Case("r", File::eOpenOptionRead)
.Case("w", File::eOpenOptionWrite)
.Case("a", File::eOpenOptionWrite | File::eOpenOptionAppend |
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index ed86dfc..185c3ef 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -1818,7 +1818,7 @@
// Display the activity chain, from parent-most to child-most
// activity, separated by a colon (:).
stream.PutCString("activity-chain=");
- stream.PutCString(activity_chain.c_str());
+ stream.PutCString(activity_chain);
#else
if (GetGlobalProperties()->GetDisplayActivityChain()) {
// Display the activity chain, from parent-most to child-most
@@ -1850,7 +1850,7 @@
if (header_count > 0)
stream.PutChar(',');
stream.PutCString("subsystem=");
- stream.PutCString(subsystem.c_str());
+ stream.PutCString(subsystem);
++header_count;
}
}
@@ -1862,14 +1862,14 @@
if (header_count > 0)
stream.PutChar(',');
stream.PutCString("category=");
- stream.PutCString(category.c_str());
+ stream.PutCString(category);
++header_count;
}
}
stream.PutCString("] ");
auto &result = stream.GetString();
- output_stream.PutCString(result.c_str());
+ output_stream.PutCString(result);
return result.size();
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp
index 6b8317c2..4518d65 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp
@@ -140,7 +140,7 @@
DescriptorConstIter pos;
DescriptorConstIter end = m_descriptors.end();
for (pos = m_descriptors.begin(); pos != end; ++pos) {
- if (regex.Execute(pos->name.c_str()))
+ if (regex.Execute(pos->name))
die_offset_coll.push_back(m_header.die_offset + pos->offset);
}
}
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index cb5ee58..cd99493 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -470,7 +470,7 @@
lldb_private::TypeMap &types) {
auto global = m_session_up->getGlobalScope();
std::unique_ptr<IPDBEnumSymbols> results;
- results = global->findChildren(PDB_SymType::None, name.c_str(),
+ results = global->findChildren(PDB_SymType::None, name,
PDB_NameSearchFlags::NS_Default);
uint32_t matches = 0;
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 61f037d..75b7c3b 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -6518,7 +6518,7 @@
if (idx == child_idx) {
// Print the member type if requested
// Print the member name and equal sign
- child_name.assign(field->getNameAsString().c_str());
+ child_name.assign(field->getNameAsString());
// Figure out the type byte size (field_type_info.first) and
// alignment (field_type_info.second) from the AST context.
@@ -6577,7 +6577,7 @@
superclass_interface_decl));
child_name.assign(
- superclass_interface_decl->getNameAsString().c_str());
+ superclass_interface_decl->getNameAsString());
clang::TypeInfo ivar_type_info =
getASTContext()->getTypeInfo(ivar_qual_type.getTypePtr());
@@ -6608,7 +6608,7 @@
clang::QualType ivar_qual_type(ivar_decl->getType());
- child_name.assign(ivar_decl->getNameAsString().c_str());
+ child_name.assign(ivar_decl->getNameAsString());
clang::TypeInfo ivar_type_info =
getASTContext()->getTypeInfo(ivar_qual_type.getTypePtr());
@@ -8205,14 +8205,14 @@
std::string property_setter_no_colon(
property_setter_name, strlen(property_setter_name) - 1);
clang::IdentifierInfo *setter_ident =
- &clang_ast->Idents.get(property_setter_no_colon.c_str());
+ &clang_ast->Idents.get(property_setter_no_colon);
setter_sel = clang_ast->Selectors.getSelector(1, &setter_ident);
} else if (!(property_attributes & DW_APPLE_PROPERTY_readonly)) {
std::string setter_sel_string("set");
setter_sel_string.push_back(::toupper(property_name[0]));
setter_sel_string.append(&property_name[1]);
clang::IdentifierInfo *setter_ident =
- &clang_ast->Idents.get(setter_sel_string.c_str());
+ &clang_ast->Idents.get(setter_sel_string);
setter_sel = clang_ast->Selectors.getSelector(1, &setter_ident);
}
property_decl->setSetterName(setter_sel);
@@ -9254,7 +9254,7 @@
enum_end_pos = enum_decl->enumerator_end();
enum_pos != enum_end_pos; ++enum_pos) {
if (enum_pos->getInitVal().getSExtValue() == enum_svalue) {
- s->PutCString(enum_pos->getNameAsString().c_str());
+ s->PutCString(enum_pos->getNameAsString());
return true;
}
}
@@ -9268,7 +9268,7 @@
enum_end_pos = enum_decl->enumerator_end();
enum_pos != enum_end_pos; ++enum_pos) {
if (enum_pos->getInitVal().getZExtValue() == enum_uvalue) {
- s->PutCString(enum_pos->getNameAsString().c_str());
+ s->PutCString(enum_pos->getNameAsString());
return true;
}
}
@@ -9438,7 +9438,7 @@
typedef_decl->getQualifiedNameAsString());
if (!clang_typedef_name.empty()) {
s->PutCString("typedef ");
- s->PutCString(clang_typedef_name.c_str());
+ s->PutCString(clang_typedef_name);
}
}
} break;
@@ -9488,7 +9488,7 @@
} else {
std::string clang_type_name(qual_type.getAsString());
if (!clang_type_name.empty())
- s->PutCString(clang_type_name.c_str());
+ s->PutCString(clang_type_name);
}
}
}
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 4616208..a89ebfb 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -582,7 +582,7 @@
std::string obj;
if (regex_match.GetMatchAtIndex(path_with_object, 1, path) &&
regex_match.GetMatchAtIndex(path_with_object, 2, obj)) {
- archive_file.SetFile(path.c_str(), false);
+ archive_file.SetFile(path, false);
archive_object.SetCString(obj.c_str());
if (must_exist && !archive_file.Exists())
return false;
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 2fa30b7..e43a70f 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -913,7 +913,7 @@
if (m_module_sp.get() != sc.module_sp.get())
return false;
} else {
- FileSpec module_file_spec(m_module_spec.c_str(), false);
+ FileSpec module_file_spec(m_module_spec, false);
if (!FileSpec::Equal(module_file_spec, sc.module_sp->GetFileSpec(),
false))
return false;
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index f272859..270400a 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -573,7 +573,7 @@
FileSpec recurse_dst;
recurse_dst.GetDirectory().SetCString(dst_dir.GetPath().c_str());
RecurseCopyBaton rc_baton2 = {recurse_dst, rc_baton->platform_ptr, Error()};
- FileSpec::EnumerateDirectory(src_dir_path.c_str(), true, true, true,
+ FileSpec::EnumerateDirectory(src_dir_path, true, true, true,
RecurseCopy_Callback, &rc_baton2);
if (rc_baton2.error.Fail()) {
rc_baton->error.SetErrorString(rc_baton2.error.AsCString());
@@ -708,7 +708,7 @@
recurse_dst.GetDirectory().SetCString(fixed_dst.GetCString());
std::string src_dir_path(src.GetPath());
RecurseCopyBaton baton = {recurse_dst, this, Error()};
- FileSpec::EnumerateDirectory(src_dir_path.c_str(), true, true, true,
+ FileSpec::EnumerateDirectory(src_dir_path, true, true, true,
RecurseCopy_Callback, &baton);
return baton.error;
}
diff --git a/lldb/source/Target/ProcessLaunchInfo.cpp b/lldb/source/Target/ProcessLaunchInfo.cpp
index e29c9bc..164bab2 100644
--- a/lldb/source/Target/ProcessLaunchInfo.cpp
+++ b/lldb/source/Target/ProcessLaunchInfo.cpp
@@ -384,7 +384,7 @@
new_path += curr_path;
}
new_path += "\" ";
- shell_command.PutCString(new_path.c_str());
+ shell_command.PutCString(new_path);
}
if (triple.getOS() != llvm::Triple::Win32 ||
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index c8bbcee..5d9851a 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -372,7 +372,7 @@
std::string cwd_user_exe_path(cwd);
cwd_user_exe_path += '/';
cwd_user_exe_path += user_exe_path;
- FileSpec cwd_file(cwd_user_exe_path.c_str(), false);
+ FileSpec cwd_file(cwd_user_exe_path, false);
if (cwd_file.Exists())
file = cwd_file;
}
diff --git a/lldb/source/Utility/ModuleCache.cpp b/lldb/source/Utility/ModuleCache.cpp
index ed1e766..889cd8f 100644
--- a/lldb/source/Utility/ModuleCache.cpp
+++ b/lldb/source/Utility/ModuleCache.cpp
@@ -82,8 +82,7 @@
}
FileSpec GetSymbolFileSpec(const FileSpec &module_file_spec) {
- return FileSpec((module_file_spec.GetPath() + kSymFileExtension).c_str(),
- false);
+ return FileSpec(module_file_spec.GetPath() + kSymFileExtension, false);
}
void DeleteExistingModule(const FileSpec &root_dir_spec,
@@ -199,8 +198,8 @@
JoinPath(module_spec_dir, target_file.GetFilename().AsCString());
const auto tmp_file_path = tmp_file.GetPath();
- const auto err_code = llvm::sys::fs::rename(
- tmp_file_path.c_str(), module_file_path.GetPath().c_str());
+ const auto err_code =
+ llvm::sys::fs::rename(tmp_file_path, module_file_path.GetPath());
if (err_code)
return Error("Failed to rename file %s to %s: %s", tmp_file_path.c_str(),
module_file_path.GetPath().c_str(),
@@ -295,7 +294,7 @@
const auto tmp_download_file_spec = JoinPath(module_spec_dir, kTempFileName);
error = module_downloader(module_spec, tmp_download_file_spec);
- llvm::FileRemover tmp_file_remover(tmp_download_file_spec.GetPath().c_str());
+ llvm::FileRemover tmp_file_remover(tmp_download_file_spec.GetPath());
if (error.Fail())
return Error("Failed to download module: %s", error.AsCString());
@@ -315,8 +314,7 @@
const auto tmp_download_sym_file_spec =
JoinPath(module_spec_dir, kTempSymFileName);
error = symfile_downloader(cached_module_sp, tmp_download_sym_file_spec);
- llvm::FileRemover tmp_symfile_remover(
- tmp_download_sym_file_spec.GetPath().c_str());
+ llvm::FileRemover tmp_symfile_remover(tmp_download_sym_file_spec.GetPath());
if (error.Fail())
// Failed to download a symfile but fetching the module was successful. The
// module might
diff --git a/lldb/tools/lldb-server/Acceptor.cpp b/lldb/tools/lldb-server/Acceptor.cpp
index 938d779..2e42f03 100644
--- a/lldb/tools/lldb-server/Acceptor.cpp
+++ b/lldb/tools/lldb-server/Acceptor.cpp
@@ -58,13 +58,13 @@
}
Error Acceptor::Listen(int backlog) {
- return m_listener_socket_up->Listen(StringRef(m_name.c_str()), backlog);
+ return m_listener_socket_up->Listen(StringRef(m_name), backlog);
}
Error Acceptor::Accept(const bool child_processes_inherit, Connection *&conn) {
Socket *conn_socket = nullptr;
auto error = m_listener_socket_up->Accept(
- StringRef(m_name.c_str()), child_processes_inherit, conn_socket);
+ StringRef(m_name), child_processes_inherit, conn_socket);
if (error.Success())
conn = new ConnectionFileDescriptor(conn_socket);
diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp
index d6bfaa2..21d422c 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -124,8 +124,7 @@
temp_file << socket_id;
}
- err_code = llvm::sys::fs::rename(temp_file_path.c_str(),
- file_spec.GetPath().c_str());
+ err_code = llvm::sys::fs::rename(temp_file_path.c_str(), file_spec.GetPath());
if (err_code)
return Error("Failed to rename file %s to %s: %s", temp_file_path.c_str(),
file_spec.GetPath().c_str(), err_code.message().c_str());
diff --git a/lldb/unittests/Host/SocketTest.cpp b/lldb/unittests/Host/SocketTest.cpp
index b7ecf19..569a440 100644
--- a/lldb/unittests/Host/SocketTest.cpp
+++ b/lldb/unittests/Host/SocketTest.cpp
@@ -79,7 +79,7 @@
std::unique_ptr<SocketType> connect_socket_up(
new SocketType(child_processes_inherit, error));
EXPECT_FALSE(error.Fail());
- error = connect_socket_up->Connect(connect_remote_address.c_str());
+ error = connect_socket_up->Connect(connect_remote_address);
EXPECT_FALSE(error.Fail());
EXPECT_TRUE(connect_socket_up->IsValid());
diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
index 95e9e05..fd4125a 100644
--- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -487,7 +487,7 @@
std::string sizeof_var = "sizeof_";
sizeof_var.append(Enum);
- EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var.c_str()),
+ EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var),
enum_type->GetByteSize());
}
}
@@ -535,7 +535,7 @@
std::string sizeof_var = "sizeof_";
sizeof_var.append(Typedef);
- EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var.c_str()),
+ EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var),
typedef_type->GetByteSize());
}
}