[Lldb-commits] [lldb] r371842 - [lldb][NFC] Remove ArgEntry::ref member
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 13 04:26:48 PDT 2019
Author: teemperor
Date: Fri Sep 13 04:26:48 2019
New Revision: 371842
URL: http://llvm.org/viewvc/llvm-project?rev=371842&view=rev
Log:
[lldb][NFC] Remove ArgEntry::ref member
The StringRef should always be identical to the C string, so we
might as well just create the StringRef from the C-string. This
might be slightly slower until we implement the storage of ArgEntry
with a string instead of a std::unique_ptr<char[]>. Until then we
have to do the additional strlen on the C string to construct the
StringRef.
Modified:
lldb/trunk/include/lldb/Utility/Args.h
lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
lldb/trunk/source/Commands/CommandObjectApropos.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectHelp.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Commands/CommandObjectMultiword.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectPlugin.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectSource.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/Interpreter/CommandAlias.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
lldb/trunk/source/Interpreter/Options.cpp
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/trunk/source/Utility/Args.cpp
lldb/trunk/unittests/Utility/ArgsTest.cpp
Modified: lldb/trunk/include/lldb/Utility/Args.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Args.h?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/Args.h (original)
+++ lldb/trunk/include/lldb/Utility/Args.h Fri Sep 13 04:26:48 2019
@@ -43,7 +43,7 @@ public:
ArgEntry() = default;
ArgEntry(llvm::StringRef str, char quote);
- llvm::StringRef ref;
+ llvm::StringRef ref() const { return c_str(); }
const char *c_str() const { return ptr.get(); }
/// Returns true if this argument was quoted in any way.
Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Fri Sep 13 04:26:48 2019
@@ -122,7 +122,7 @@ void BreakpointIDList::FindAndReplaceIDR
for (size_t i = 0; i < old_args.size(); ++i) {
bool is_range = false;
- current_arg = old_args[i].ref;
+ current_arg = old_args[i].ref();
if (!allow_locations && current_arg.contains('.')) {
result.AppendErrorWithFormat(
"Breakpoint locations not allowed, saw location: %s.",
@@ -146,16 +146,16 @@ void BreakpointIDList::FindAndReplaceIDR
} else
names_found.insert(current_arg);
} else if ((i + 2 < old_args.size()) &&
- BreakpointID::IsRangeIdentifier(old_args[i + 1].ref) &&
+ BreakpointID::IsRangeIdentifier(old_args[i + 1].ref()) &&
BreakpointID::IsValidIDExpression(current_arg) &&
- BreakpointID::IsValidIDExpression(old_args[i + 2].ref)) {
+ BreakpointID::IsValidIDExpression(old_args[i + 2].ref())) {
range_from = current_arg;
- range_to = old_args[i + 2].ref;
+ range_to = old_args[i + 2].ref();
is_range = true;
i = i + 2;
} else {
// See if user has specified id.*
- llvm::StringRef tmp_str = old_args[i].ref;
+ llvm::StringRef tmp_str = old_args[i].ref();
size_t pos = tmp_str.find('.');
if (pos != llvm::StringRef::npos) {
llvm::StringRef bp_id_str = tmp_str.substr(0, pos);
Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Fri Sep 13 04:26:48 2019
@@ -44,7 +44,7 @@ bool CommandObjectApropos::DoExecute(Arg
const size_t argc = args.GetArgumentCount();
if (argc == 1) {
- auto search_word = args[0].ref;
+ auto search_word = args[0].ref();
if (!search_word.empty()) {
// The bulk of the work must be done inside the Command Interpreter,
// since the command dictionary is private.
@@ -79,7 +79,7 @@ bool CommandObjectApropos::DoExecute(Arg
const bool dump_qualified_name = true;
result.AppendMessageWithFormatv(
"\nThe following settings variables may relate to '{0}': \n\n",
- args[0].ref);
+ args[0].ref());
for (size_t i = 0; i < num_properties; ++i)
properties[i]->DumpDescription(
m_interpreter, result.GetOutputStream(), 0, dump_qualified_name);
Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri Sep 13 04:26:48 2019
@@ -1707,7 +1707,7 @@ protected:
// Make a pass through first to see that all the names are legal.
for (auto &entry : command.entries()) {
Status error;
- if (!BreakpointID::StringIsBreakpointName(entry.ref, error))
+ if (!BreakpointID::StringIsBreakpointName(entry.ref(), error))
{
result.AppendErrorWithFormat("Invalid breakpoint name: %s - %s",
entry.c_str(), error.AsCString());
Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Fri Sep 13 04:26:48 2019
@@ -283,7 +283,7 @@ protected:
return false;
}
- FileSpec cmd_file(command[0].ref);
+ FileSpec cmd_file(command[0].ref());
FileSystem::Instance().Resolve(cmd_file);
ExecutionContext *exe_ctx = nullptr; // Just use the default context.
@@ -546,7 +546,7 @@ protected:
// Get the alias command.
- auto alias_command = args[0].ref;
+ auto alias_command = args[0].ref();
if (alias_command.startswith("-")) {
result.AppendError("aliases starting with a dash are not supported");
if (alias_command == "--help" || alias_command == "--long-help") {
@@ -653,8 +653,8 @@ protected:
}
// Save these in std::strings since we're going to shift them off.
- const std::string alias_command(args[0].ref);
- const std::string actual_command(args[1].ref);
+ const std::string alias_command(args[0].ref());
+ const std::string actual_command(args[1].ref());
args.Shift(); // Shift the alias command word off the argument vector.
args.Shift(); // Shift the old command word off the argument vector.
@@ -686,7 +686,7 @@ protected:
OptionArgVectorSP(new OptionArgVector);
while (cmd_obj->IsMultiwordObject() && !args.empty()) {
- auto sub_command = args[0].ref;
+ auto sub_command = args[0].ref();
assert(!sub_command.empty());
subcommand_obj_sp = cmd_obj->GetSubcommandSP(sub_command);
if (!subcommand_obj_sp) {
@@ -780,7 +780,7 @@ protected:
return false;
}
- auto command_name = args[0].ref;
+ auto command_name = args[0].ref();
cmd_obj = m_interpreter.GetCommandObject(command_name);
if (!cmd_obj) {
result.AppendErrorWithFormat(
@@ -862,7 +862,7 @@ protected:
return false;
}
- auto command_name = args[0].ref;
+ auto command_name = args[0].ref();
if (!m_interpreter.CommandExists(command_name)) {
StreamString error_msg_stream;
const bool generate_upropos = true;
@@ -988,7 +988,7 @@ protected:
}
Status error;
- auto name = command[0].ref;
+ auto name = command[0].ref();
m_regex_cmd_up = std::make_unique<CommandObjectRegexCommand>(
m_interpreter, name, m_options.GetHelp(), m_options.GetSyntax(), 10, 0,
true);
@@ -1013,7 +1013,7 @@ protected:
} else {
for (auto &entry : command.entries().drop_front()) {
bool check_only = false;
- error = AppendRegexSubstitution(entry.ref, check_only);
+ error = AppendRegexSubstitution(entry.ref(), check_only);
if (error.Fail())
break;
}
@@ -1656,7 +1656,7 @@ protected:
}
// Store the options in case we get multi-line input
- m_cmd_name = command[0].ref;
+ m_cmd_name = command[0].ref();
m_short_help.assign(m_options.m_short_help);
m_synchronicity = m_options.m_synchronicity;
@@ -1798,7 +1798,7 @@ protected:
return false;
}
- auto cmd_name = command[0].ref;
+ auto cmd_name = command[0].ref();
if (cmd_name.empty() || !m_interpreter.HasUserCommands() ||
!m_interpreter.UserCommandExists(cmd_name)) {
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Fri Sep 13 04:26:48 2019
@@ -358,7 +358,7 @@ protected:
}
if (command.GetArgumentCount() == 1) {
- if (command[0].ref.getAsInteger(0, frame_idx)) {
+ if (command[0].ref().getAsInteger(0, frame_idx)) {
result.AppendErrorWithFormat("invalid frame index argument '%s'.",
command[0].c_str());
result.SetStatus(eReturnStatusFailed);
@@ -527,7 +527,7 @@ protected:
for (auto &entry : command) {
if (m_option_variable.use_regex) {
const size_t regex_start_index = regex_var_list.GetSize();
- llvm::StringRef name_str = entry.ref;
+ llvm::StringRef name_str = entry.ref();
RegularExpression regex(name_str);
if (regex.IsValid()) {
size_t num_matches = 0;
@@ -586,7 +586,7 @@ protected:
StackFrame::eExpressionPathOptionsInspectAnonymousUnions;
lldb::VariableSP var_sp;
valobj_sp = frame->GetValueForVariableExpressionPath(
- entry.ref, m_varobj_options.use_dynamic, expr_path_options,
+ entry.ref(), m_varobj_options.use_dynamic, expr_path_options,
var_sp, error);
if (valobj_sp) {
std::string scope_string;
Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Fri Sep 13 04:26:48 2019
@@ -96,7 +96,7 @@ bool CommandObjectHelp::DoExecute(Args &
// Get command object for the first command argument. Only search built-in
// command dictionary.
StringList matches;
- auto command_name = command[0].ref;
+ auto command_name = command[0].ref();
cmd_obj = m_interpreter.GetCommandObject(command_name, &matches);
if (cmd_obj != nullptr) {
@@ -107,7 +107,7 @@ bool CommandObjectHelp::DoExecute(Args &
// object that corresponds to the help command entered.
std::string sub_command;
for (auto &entry : command.entries().drop_front()) {
- sub_command = entry.ref;
+ sub_command = entry.ref();
matches.Clear();
if (sub_cmd_obj->IsAlias())
sub_cmd_obj =
@@ -208,7 +208,7 @@ void CommandObjectHelp::HandleCompletion
return;
}
CommandObject *cmd_obj =
- m_interpreter.GetCommandObject(request.GetParsedLine()[0].ref);
+ m_interpreter.GetCommandObject(request.GetParsedLine()[0].ref());
// The command that they are getting help on might be ambiguous, in which
// case we should complete that, otherwise complete with the command the
Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Fri Sep 13 04:26:48 2019
@@ -145,7 +145,7 @@ protected:
}
// Store into a std::string since we're about to shift the channel off.
- const std::string channel = args[0].ref;
+ const std::string channel = args[0].ref();
args.Shift(); // Shift off the channel
char log_file[PATH_MAX];
if (m_options.log_file)
@@ -212,7 +212,7 @@ protected:
return false;
}
- const std::string channel = args[0].ref;
+ const std::string channel = args[0].ref();
args.Shift(); // Shift off the channel
if (channel == "all") {
Log::DisableAllLogChannels();
@@ -265,7 +265,7 @@ protected:
bool success = true;
for (const auto &entry : args.entries())
success =
- success && Log::ListChannelCategories(entry.ref, output_stream);
+ success && Log::ListChannelCategories(entry.ref(), output_stream);
if (success)
result.SetStatus(eReturnStatusSuccessFinishResult);
}
@@ -291,7 +291,7 @@ protected:
result.SetStatus(eReturnStatusFailed);
if (args.GetArgumentCount() == 1) {
- auto sub_command = args[0].ref;
+ auto sub_command = args[0].ref();
if (sub_command.equals_lower("enable")) {
Timer::SetDisplayDepth(UINT32_MAX);
@@ -308,8 +308,8 @@ protected:
result.SetStatus(eReturnStatusSuccessFinishResult);
}
} else if (args.GetArgumentCount() == 2) {
- auto sub_command = args[0].ref;
- auto param = args[1].ref;
+ auto sub_command = args[0].ref();
+ auto param = args[1].ref();
if (sub_command.equals_lower("enable")) {
uint32_t depth;
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Sep 13 04:26:48 2019
@@ -593,7 +593,7 @@ protected:
}
if (argc > 0)
- addr = OptionArgParser::ToAddress(&m_exe_ctx, command[0].ref,
+ addr = OptionArgParser::ToAddress(&m_exe_ctx, command[0].ref(),
LLDB_INVALID_ADDRESS, &error);
if (addr == LLDB_INVALID_ADDRESS) {
@@ -605,7 +605,7 @@ protected:
if (argc == 2) {
lldb::addr_t end_addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[1].ref, LLDB_INVALID_ADDRESS, nullptr);
+ &m_exe_ctx, command[1].ref(), LLDB_INVALID_ADDRESS, nullptr);
if (end_addr == LLDB_INVALID_ADDRESS) {
result.AppendError("invalid end address expression.");
result.AppendError(error.AsCString());
@@ -1034,13 +1034,13 @@ protected:
Status error;
lldb::addr_t low_addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error);
+ &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
if (low_addr == LLDB_INVALID_ADDRESS || error.Fail()) {
result.AppendError("invalid low address");
return false;
}
lldb::addr_t high_addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[1].ref, LLDB_INVALID_ADDRESS, &error);
+ &m_exe_ctx, command[1].ref(), LLDB_INVALID_ADDRESS, &error);
if (high_addr == LLDB_INVALID_ADDRESS || error.Fail()) {
result.AppendError("invalid high address");
return false;
@@ -1339,7 +1339,7 @@ protected:
Status error;
lldb::addr_t addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error);
+ &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
if (addr == LLDB_INVALID_ADDRESS) {
result.AppendError("invalid address expression\n");
@@ -1442,10 +1442,10 @@ protected:
// Be careful, getAsInteger with a radix of 16 rejects "0xab" so we
// have to special case that:
bool success = false;
- if (entry.ref.startswith("0x"))
- success = !entry.ref.getAsInteger(0, uval64);
+ if (entry.ref().startswith("0x"))
+ success = !entry.ref().getAsInteger(0, uval64);
if (!success)
- success = !entry.ref.getAsInteger(16, uval64);
+ success = !entry.ref().getAsInteger(16, uval64);
if (!success) {
result.AppendErrorWithFormat(
"'%s' is not a valid hex string value.\n", entry.c_str());
@@ -1463,7 +1463,7 @@ protected:
break;
}
case eFormatBoolean:
- uval64 = OptionArgParser::ToBoolean(entry.ref, false, &success);
+ uval64 = OptionArgParser::ToBoolean(entry.ref(), false, &success);
if (!success) {
result.AppendErrorWithFormat(
"'%s' is not a valid boolean string value.\n", entry.c_str());
@@ -1474,7 +1474,7 @@ protected:
break;
case eFormatBinary:
- if (entry.ref.getAsInteger(2, uval64)) {
+ if (entry.ref().getAsInteger(2, uval64)) {
result.AppendErrorWithFormat(
"'%s' is not a valid binary string value.\n", entry.c_str());
result.SetStatus(eReturnStatusFailed);
@@ -1493,10 +1493,10 @@ protected:
case eFormatCharArray:
case eFormatChar:
case eFormatCString: {
- if (entry.ref.empty())
+ if (entry.ref().empty())
break;
- size_t len = entry.ref.size();
+ size_t len = entry.ref().size();
// Include the NULL for C strings...
if (m_format_options.GetFormat() == eFormatCString)
++len;
@@ -1513,7 +1513,7 @@ protected:
break;
}
case eFormatDecimal:
- if (entry.ref.getAsInteger(0, sval64)) {
+ if (entry.ref().getAsInteger(0, sval64)) {
result.AppendErrorWithFormat(
"'%s' is not a valid signed decimal value.\n", entry.c_str());
result.SetStatus(eReturnStatusFailed);
@@ -1531,7 +1531,7 @@ protected:
case eFormatUnsigned:
- if (!entry.ref.getAsInteger(0, uval64)) {
+ if (!entry.ref().getAsInteger(0, uval64)) {
result.AppendErrorWithFormat(
"'%s' is not a valid unsigned decimal string value.\n",
entry.c_str());
@@ -1549,7 +1549,7 @@ protected:
break;
case eFormatOctal:
- if (entry.ref.getAsInteger(8, uval64)) {
+ if (entry.ref().getAsInteger(8, uval64)) {
result.AppendErrorWithFormat(
"'%s' is not a valid octal string value.\n", entry.c_str());
result.SetStatus(eReturnStatusFailed);
@@ -1635,7 +1635,7 @@ protected:
Status error;
lldb::addr_t addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error);
+ &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
if (addr == LLDB_INVALID_ADDRESS) {
result.AppendError("invalid address expression");
@@ -1700,7 +1700,7 @@ protected:
result.SetStatus(eReturnStatusFailed);
} else {
if (command.GetArgumentCount() == 1) {
- auto load_addr_str = command[0].ref;
+ auto load_addr_str = command[0].ref();
load_addr = OptionArgParser::ToAddress(&m_exe_ctx, load_addr_str,
LLDB_INVALID_ADDRESS, &error);
if (error.Fail() || load_addr == LLDB_INVALID_ADDRESS) {
Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Fri Sep 13 04:26:48 2019
@@ -93,7 +93,7 @@ bool CommandObjectMultiword::Execute(con
return result.Succeeded();
}
- auto sub_command = args[0].ref;
+ auto sub_command = args[0].ref();
if (sub_command.empty())
return result.Succeeded();
@@ -180,7 +180,7 @@ void CommandObjectMultiword::GenerateHel
}
void CommandObjectMultiword::HandleCompletion(CompletionRequest &request) {
- auto arg0 = request.GetParsedLine()[0].ref;
+ auto arg0 = request.GetParsedLine()[0].ref();
if (request.GetCursorIndex() == 0) {
StringList new_matches, descriptions;
AddNamesMatchingPartialString(m_subcommand_dict, arg0, new_matches,
@@ -225,7 +225,7 @@ const char *CommandObjectMultiword::GetR
if (current_command_args.GetArgumentCount() <= index)
return nullptr;
CommandObject *sub_command_object =
- GetSubcommandObject(current_command_args[index].ref);
+ GetSubcommandObject(current_command_args[index].ref());
if (sub_command_object == nullptr)
return nullptr;
return sub_command_object->GetRepeatCommand(current_command_args, index);
Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Fri Sep 13 04:26:48 2019
@@ -1336,9 +1336,9 @@ protected:
Stream &ostrm = result.GetOutputStream();
for (auto &entry : args.entries()) {
lldb::pid_t pid;
- if (entry.ref.getAsInteger(0, pid)) {
+ if (entry.ref().getAsInteger(0, pid)) {
result.AppendErrorWithFormat("invalid process ID argument '%s'",
- entry.ref.str().c_str());
+ entry.ref().str().c_str());
result.SetStatus(eReturnStatusFailed);
break;
} else {
Modified: lldb/trunk/source/Commands/CommandObjectPlugin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlugin.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlugin.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlugin.cpp Fri Sep 13 04:26:48 2019
@@ -57,7 +57,7 @@ protected:
Status error;
- FileSpec dylib_fspec(command[0].ref);
+ FileSpec dylib_fspec(command[0].ref());
FileSystem::Instance().Resolve(dylib_fspec);
if (GetDebugger().LoadPlugin(dylib_fspec, error))
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Fri Sep 13 04:26:48 2019
@@ -923,7 +923,7 @@ protected:
for (auto &entry : command.entries()) {
Status error;
PlatformSP platform = process->GetTarget().GetPlatform();
- llvm::StringRef image_path = entry.ref;
+ llvm::StringRef image_path = entry.ref();
uint32_t image_token = LLDB_INVALID_IMAGE_TOKEN;
if (!m_options.do_install) {
@@ -985,9 +985,9 @@ protected:
for (auto &entry : command.entries()) {
uint32_t image_token;
- if (entry.ref.getAsInteger(0, image_token)) {
+ if (entry.ref().getAsInteger(0, image_token)) {
result.AppendErrorWithFormat("invalid image index argument '%s'",
- entry.ref.str().c_str());
+ entry.ref().str().c_str());
result.SetStatus(eReturnStatusFailed);
break;
} else {
Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Fri Sep 13 04:26:48 2019
@@ -206,7 +206,7 @@ protected:
// consistent towards the user and allow them to say reg read $rbx -
// internally, however, we should be strict and not allow ourselves
// to call our registers $rbx in our own API
- auto arg_str = entry.ref;
+ auto arg_str = entry.ref();
arg_str.consume_front("$");
reg_info = reg_ctx->GetRegisterInfoByName(arg_str);
@@ -335,8 +335,8 @@ protected:
"register write takes exactly 2 arguments: <reg-name> <value>");
result.SetStatus(eReturnStatusFailed);
} else {
- auto reg_name = command[0].ref;
- auto value_str = command[1].ref;
+ auto reg_name = command[0].ref();
+ auto value_str = command[1].ref();
// in most LLDB commands we accept $rbx as the name for register RBX -
// and here we would reject it and non-existant. we should be more
Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Fri Sep 13 04:26:48 2019
@@ -281,7 +281,7 @@ protected:
if (!args.empty()) {
for (const auto &arg : args) {
Status error(GetDebugger().DumpPropertyValue(
- &m_exe_ctx, result.GetOutputStream(), arg.ref,
+ &m_exe_ctx, result.GetOutputStream(), arg.ref(),
OptionValue::eDumpGroupValue));
if (error.Success()) {
result.GetOutputStream().EOL();
@@ -403,7 +403,7 @@ protected:
for (const auto &arg : args) {
Status error(GetDebugger().DumpPropertyValue(
- &clean_ctx, out_file, arg.ref, OptionValue::eDumpGroupExport));
+ &clean_ctx, out_file, arg.ref(), OptionValue::eDumpGroupExport));
if (!error.Success()) {
result.AppendError(error.AsCString());
result.SetStatus(eReturnStatusFailed);
Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Fri Sep 13 04:26:48 2019
@@ -734,7 +734,7 @@ public:
// the arguments directly.
auto iter =
llvm::find_if(current_command_args, [](const Args::ArgEntry &e) {
- return e.ref == "-r" || e.ref == "--reverse";
+ return e.ref() == "-r" || e.ref() == "--reverse";
});
if (iter == current_command_args.end())
return m_cmd_name.c_str();
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Sep 13 04:26:48 2019
@@ -625,7 +625,7 @@ protected:
for (auto &entry : args.entries()) {
uint32_t target_idx;
- if (entry.ref.getAsInteger(0, target_idx)) {
+ if (entry.ref().getAsInteger(0, target_idx)) {
result.AppendErrorWithFormat("invalid target index '%s'\n",
entry.c_str());
result.SetStatus(eReturnStatusFailed);
@@ -2550,10 +2550,10 @@ protected:
}
} else {
for (auto &entry : args.entries()) {
- if (entry.ref.empty())
+ if (entry.ref().empty())
continue;
- FileSpec file_spec(entry.ref);
+ FileSpec file_spec(entry.ref());
if (FileSystem::Instance().Exists(file_spec)) {
ModuleSpec module_spec(file_spec);
if (m_uuid_option_group.GetOptionValue().OptionWasSet())
@@ -2583,10 +2583,10 @@ protected:
} else {
std::string resolved_path = file_spec.GetPath();
result.SetStatus(eReturnStatusFailed);
- if (resolved_path != entry.ref) {
+ if (resolved_path != entry.ref()) {
result.AppendErrorWithFormat(
"invalid module path '%s' with resolved path '%s'\n",
- entry.ref.str().c_str(), resolved_path.c_str());
+ entry.ref().str().c_str(), resolved_path.c_str());
break;
}
result.AppendErrorWithFormat("invalid module path '%s'\n",
@@ -4303,9 +4303,9 @@ protected:
PlatformSP platform_sp(target->GetPlatform());
for (auto &entry : args.entries()) {
- if (!entry.ref.empty()) {
+ if (!entry.ref().empty()) {
auto &symbol_file_spec = module_spec.GetSymbolFileSpec();
- symbol_file_spec.SetFile(entry.ref, FileSpec::Style::native);
+ symbol_file_spec.SetFile(entry.ref(), FileSpec::Style::native);
FileSystem::Instance().Resolve(symbol_file_spec);
if (file_option_set) {
module_spec.GetFileSpec() =
@@ -4329,7 +4329,7 @@ protected:
} else {
std::string resolved_symfile_path =
module_spec.GetSymbolFileSpec().GetPath();
- if (resolved_symfile_path != entry.ref) {
+ if (resolved_symfile_path != entry.ref()) {
result.AppendErrorWithFormat(
"invalid module path '%s' with resolved path '%s'\n",
entry.c_str(), resolved_symfile_path.c_str());
Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Sep 13 04:26:48 2019
@@ -840,7 +840,7 @@ public:
std::vector<Thread *> resume_threads;
for (auto &entry : command.entries()) {
uint32_t thread_idx;
- if (entry.ref.getAsInteger(0, thread_idx)) {
+ if (entry.ref().getAsInteger(0, thread_idx)) {
result.AppendErrorWithFormat(
"invalid thread index argument: \"%s\".\n", entry.c_str());
result.SetStatus(eReturnStatusFailed);
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Fri Sep 13 04:26:48 2019
@@ -80,9 +80,9 @@ static bool WarnOnPotentialUnquotedUnsig
return false;
for (auto entry : llvm::enumerate(command.entries().drop_back())) {
- if (entry.value().ref != "unsigned")
+ if (entry.value().ref() != "unsigned")
continue;
- auto next = command.entries()[entry.index() + 1].ref;
+ auto next = command.entries()[entry.index() + 1].ref();
if (next == "int" || next == "short" || next == "char" || next == "long") {
result.AppendWarningWithFormat(
"unsigned %s being treated as two types. if you meant the combined "
@@ -679,15 +679,15 @@ protected:
WarnOnPotentialUnquotedUnsignedType(command, result);
for (auto &arg_entry : command.entries()) {
- if (arg_entry.ref.empty()) {
+ if (arg_entry.ref().empty()) {
result.AppendError("empty typenames not allowed");
result.SetStatus(eReturnStatusFailed);
return false;
}
- ConstString typeCS(arg_entry.ref);
+ ConstString typeCS(arg_entry.ref());
if (m_command_options.m_regex) {
- RegularExpression typeRX(arg_entry.ref);
+ RegularExpression typeRX(arg_entry.ref());
if (!typeRX.IsValid()) {
result.AppendError(
"regex format error (maybe this is not really a regex?)");
@@ -1328,13 +1328,13 @@ bool CommandObjectTypeSummaryAdd::Execut
m_options.m_name, m_options.m_category);
for (auto &entry : command.entries()) {
- if (entry.ref.empty()) {
+ if (entry.ref().empty()) {
result.AppendError("empty typenames not allowed");
result.SetStatus(eReturnStatusFailed);
return false;
}
- options->m_target_types << entry.ref;
+ options->m_target_types << entry.ref();
}
m_interpreter.GetPythonCommandsFromIOHandler(
@@ -1355,7 +1355,7 @@ bool CommandObjectTypeSummaryAdd::Execut
for (auto &entry : command.entries()) {
CommandObjectTypeSummaryAdd::AddSummary(
- ConstString(entry.ref), script_format,
+ ConstString(entry.ref()), script_format,
(m_options.m_regex ? eRegexSummary : eRegularSummary),
m_options.m_category, &error);
if (error.Fail()) {
@@ -1428,12 +1428,12 @@ bool CommandObjectTypeSummaryAdd::Execut
// now I have a valid format, let's add it to every type
Status error;
for (auto &arg_entry : command.entries()) {
- if (arg_entry.ref.empty()) {
+ if (arg_entry.ref().empty()) {
result.AppendError("empty typenames not allowed");
result.SetStatus(eReturnStatusFailed);
return false;
}
- ConstString typeCS(arg_entry.ref);
+ ConstString typeCS(arg_entry.ref());
AddSummary(typeCS, entry,
(m_options.m_regex ? eRegexSummary : eRegularSummary),
@@ -1786,7 +1786,7 @@ protected:
for (auto &entry : command.entries()) {
TypeCategoryImplSP category_sp;
- if (DataVisualization::Categories::GetCategory(ConstString(entry.ref),
+ if (DataVisualization::Categories::GetCategory(ConstString(entry.ref()),
category_sp) &&
category_sp) {
category_sp->AddLanguage(m_options.m_cate_language.GetCurrentValue());
@@ -2228,13 +2228,13 @@ bool CommandObjectTypeSynthAdd::Execute_
m_options.m_cascade, m_options.m_regex, m_options.m_category);
for (auto &entry : command.entries()) {
- if (entry.ref.empty()) {
+ if (entry.ref().empty()) {
result.AppendError("empty typenames not allowed");
result.SetStatus(eReturnStatusFailed);
return false;
}
- options->m_target_types << entry.ref;
+ options->m_target_types << entry.ref();
}
m_interpreter.GetPythonCommandsFromIOHandler(
@@ -2293,13 +2293,13 @@ bool CommandObjectTypeSynthAdd::Execute_
Status error;
for (auto &arg_entry : command.entries()) {
- if (arg_entry.ref.empty()) {
+ if (arg_entry.ref().empty()) {
result.AppendError("empty typenames not allowed");
result.SetStatus(eReturnStatusFailed);
return false;
}
- ConstString typeCS(arg_entry.ref);
+ ConstString typeCS(arg_entry.ref());
if (!AddSynth(typeCS, entry,
m_options.m_regex ? eRegexSynth : eRegularSynth,
m_options.m_category, &error)) {
@@ -2594,13 +2594,13 @@ protected:
WarnOnPotentialUnquotedUnsignedType(command, result);
for (auto &arg_entry : command.entries()) {
- if (arg_entry.ref.empty()) {
+ if (arg_entry.ref().empty()) {
result.AppendError("empty typenames not allowed");
result.SetStatus(eReturnStatusFailed);
return false;
}
- ConstString typeCS(arg_entry.ref);
+ ConstString typeCS(arg_entry.ref());
if (!AddFilter(typeCS, entry,
m_options.m_regex ? eRegexFilter : eRegularFilter,
m_options.m_category, &error)) {
Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Fri Sep 13 04:26:48 2019
@@ -89,12 +89,12 @@ bool CommandObjectMultiwordWatchpoint::V
// Go through the arguments and make a canonical form of arg list containing
// only numbers with possible "-" in between.
for (auto &entry : args.entries()) {
- if ((idx = WithRSAIndex(entry.ref)) == -1) {
- StrRefArgs.push_back(entry.ref);
+ if ((idx = WithRSAIndex(entry.ref())) == -1) {
+ StrRefArgs.push_back(entry.ref());
continue;
}
// The Arg contains the range specifier, split it, then.
- std::tie(first, second) = entry.ref.split(RSA[idx]);
+ std::tie(first, second) = entry.ref().split(RSA[idx]);
if (!first.empty())
StrRefArgs.push_back(first);
StrRefArgs.push_back(Minus);
Modified: lldb/trunk/source/Interpreter/CommandAlias.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandAlias.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandAlias.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandAlias.cpp Fri Sep 13 04:26:48 2019
@@ -64,8 +64,8 @@ static bool ProcessAliasOptionsArgs(lldb
option_arg_vector->emplace_back("<argument>", -1, options_string);
else {
for (auto &entry : args.entries()) {
- if (!entry.ref.empty())
- option_arg_vector->emplace_back("<argument>", -1, entry.ref);
+ if (!entry.ref().empty())
+ option_arg_vector->emplace_back("<argument>", -1, entry.ref());
}
}
}
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Sep 13 04:26:48 2019
@@ -1961,7 +1961,7 @@ void CommandInterpreter::BuildAliasComma
for (auto entry : llvm::enumerate(cmd_args.entries())) {
if (!used[entry.index()] && !wants_raw_input)
- new_args.AppendArgument(entry.value().ref);
+ new_args.AppendArgument(entry.value().ref());
}
cmd_args.Clear();
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Fri Sep 13 04:26:48 2019
@@ -967,7 +967,7 @@ bool CommandObjectParsed::Execute(const
}
if (!handled) {
for (auto entry : llvm::enumerate(cmd_args.entries())) {
- if (!entry.value().ref.empty() && entry.value().ref.front() == '`') {
+ if (!entry.value().ref().empty() && entry.value().ref().front() == '`') {
cmd_args.ReplaceArgumentAtIndex(
entry.index(),
m_interpreter.ProcessEmbeddedScriptCommands(entry.value().c_str()));
Modified: lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueDictionary.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueDictionary.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueDictionary.cpp Fri Sep 13 04:26:48 2019
@@ -111,18 +111,18 @@ Status OptionValueDictionary::SetArgs(co
return error;
}
for (const auto &entry : args) {
- if (entry.ref.empty()) {
+ if (entry.ref().empty()) {
error.SetErrorString("empty argument");
return error;
}
- if (!entry.ref.contains('=')) {
+ if (!entry.ref().contains('=')) {
error.SetErrorString(
"assign operation takes one or more key=value arguments");
return error;
}
llvm::StringRef key, value;
- std::tie(key, value) = entry.ref.split('=');
+ std::tie(key, value) = entry.ref().split('=');
bool key_valid = false;
if (key.empty()) {
error.SetErrorString("empty dictionary key");
Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Fri Sep 13 04:26:48 2019
@@ -937,7 +937,7 @@ static Args ReconstituteArgsAfterParsing
for (const char *arg : parsed) {
auto pos = FindOriginalIter(arg, original);
assert(pos != original.end());
- result.AppendArgument(pos->ref, pos->GetQuoteChar());
+ result.AppendArgument(pos->ref(), pos->GetQuoteChar());
}
return result;
}
@@ -948,8 +948,8 @@ static size_t FindArgumentIndexForOption
std::string long_opt =
llvm::formatv("--{0}", long_option.definition->long_option);
for (const auto &entry : llvm::enumerate(args)) {
- if (entry.value().ref.startswith(short_opt) ||
- entry.value().ref.startswith(long_opt))
+ if (entry.value().ref().startswith(short_opt) ||
+ entry.value().ref().startswith(long_opt))
return entry.index();
}
@@ -1088,7 +1088,7 @@ llvm::Expected<Args> Options::ParseAlias
continue;
if (!input_line.empty()) {
- auto tmp_arg = args_copy[idx].ref;
+ auto tmp_arg = args_copy[idx].ref();
size_t pos = input_line.find(tmp_arg);
if (pos != std::string::npos)
input_line.erase(pos, tmp_arg.size());
@@ -1098,9 +1098,9 @@ llvm::Expected<Args> Options::ParseAlias
OptionParser::eNoArgument) &&
(OptionParser::GetOptionArgument() != nullptr) &&
(idx < args_copy.GetArgumentCount()) &&
- (args_copy[idx].ref == OptionParser::GetOptionArgument())) {
+ (args_copy[idx].ref() == OptionParser::GetOptionArgument())) {
if (input_line.size() > 0) {
- auto tmp_arg = args_copy[idx].ref;
+ auto tmp_arg = args_copy[idx].ref();
size_t pos = input_line.find(tmp_arg);
if (pos != std::string::npos)
input_line.erase(pos, tmp_arg.size());
@@ -1291,7 +1291,7 @@ OptionElementVector Options::ParseForCom
const Args::ArgEntry &cursor = args[cursor_index];
if ((static_cast<int32_t>(dash_dash_pos) == -1 ||
cursor_index < dash_dash_pos) &&
- !cursor.IsQuoted() && cursor.ref == "-") {
+ !cursor.IsQuoted() && cursor.ref() == "-") {
option_element_vector.push_back(
OptionArgElement(OptionArgElement::eBareDash, cursor_index,
OptionArgElement::eBareDash));
Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Fri Sep 13 04:26:48 2019
@@ -348,7 +348,7 @@ protected:
bool demangled_any = false;
bool error_any = false;
for (auto &entry : command.entries()) {
- if (entry.ref.empty())
+ if (entry.ref().empty())
continue;
// the actual Mangled class should be strict about this, but on the
@@ -356,7 +356,7 @@ protected:
// they will come out with an extra underscore - be willing to strip this
// on behalf of the user. This is the moral equivalent of the -_/-n
// options to c++filt
- auto name = entry.ref;
+ auto name = entry.ref();
if (name.startswith("__Z"))
name = name.drop_front();
@@ -365,12 +365,12 @@ protected:
ConstString demangled(
mangled.GetDisplayDemangledName(lldb::eLanguageTypeC_plus_plus));
demangled_any = true;
- result.AppendMessageWithFormat("%s ---> %s\n", entry.ref.str().c_str(),
+ result.AppendMessageWithFormat("%s ---> %s\n", entry.c_str(),
demangled.GetCString());
} else {
error_any = true;
result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n",
- entry.ref.str().c_str());
+ entry.ref().str().c_str());
}
}
Modified: lldb/trunk/source/Utility/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Args.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Args.cpp (original)
+++ lldb/trunk/source/Utility/Args.cpp Fri Sep 13 04:26:48 2019
@@ -163,7 +163,6 @@ Args::ArgEntry::ArgEntry(llvm::StringRef
::memcpy(data(), str.data() ? str.data() : "", size);
ptr[size] = 0;
- ref = llvm::StringRef(c_str(), size);
}
// Args constructor
@@ -182,7 +181,7 @@ Args &Args::operator=(const Args &rhs) {
m_argv.clear();
m_entries.clear();
for (auto &entry : rhs.m_entries) {
- m_entries.emplace_back(entry.ref, entry.quote);
+ m_entries.emplace_back(entry.ref(), entry.quote);
m_argv.push_back(m_entries.back().data());
}
m_argv.push_back(nullptr);
@@ -199,7 +198,7 @@ void Args::Dump(Stream &s, const char *l
int i = 0;
for (auto &entry : m_entries) {
s.Indent();
- s.Format("{0}[{1}]=\"{2}\"\n", label_name, i++, entry.ref);
+ s.Format("{0}[{1}]=\"{2}\"\n", label_name, i++, entry.ref());
}
s.Format("{0}[{1}]=NULL\n", label_name, i);
s.EOL();
@@ -211,7 +210,7 @@ bool Args::GetCommandString(std::string
for (size_t i = 0; i < m_entries.size(); ++i) {
if (i > 0)
command += ' ';
- command += m_entries[i].ref;
+ command += m_entries[i].ref();
}
return !m_entries.empty();
@@ -226,10 +225,10 @@ bool Args::GetQuotedCommandString(std::s
if (m_entries[i].quote) {
command += m_entries[i].quote;
- command += m_entries[i].ref;
+ command += m_entries[i].ref();
command += m_entries[i].quote;
} else {
- command += m_entries[i].ref;
+ command += m_entries[i].ref();
}
}
@@ -293,7 +292,7 @@ void Args::AppendArguments(const Args &r
assert(m_argv.back() == nullptr);
m_argv.pop_back();
for (auto &entry : rhs.m_entries) {
- m_entries.emplace_back(entry.ref, entry.quote);
+ m_entries.emplace_back(entry.ref(), entry.quote);
m_argv.push_back(m_entries.back().data());
}
m_argv.push_back(nullptr);
Modified: lldb/trunk/unittests/Utility/ArgsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ArgsTest.cpp?rev=371842&r1=371841&r2=371842&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/ArgsTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ArgsTest.cpp Fri Sep 13 04:26:48 2019
@@ -152,9 +152,9 @@ TEST(ArgsTest, StringListConstructor) {
<< "baz";
Args args(list);
ASSERT_EQ(3u, args.GetArgumentCount());
- EXPECT_EQ("foo", args[0].ref);
- EXPECT_EQ("bar", args[1].ref);
- EXPECT_EQ("baz", args[2].ref);
+ EXPECT_EQ("foo", args[0].ref());
+ EXPECT_EQ("bar", args[1].ref());
+ EXPECT_EQ("baz", args[2].ref());
}
TEST(ArgsTest, GetQuotedCommandString) {
More information about the lldb-commits
mailing list