diff options
| author | Raphael Isemann <teemperor@gmail.com> | 2019-09-13 11:26:48 +0000 |
|---|---|---|
| committer | Raphael Isemann <teemperor@gmail.com> | 2019-09-13 11:26:48 +0000 |
| commit | 0d9a201e2624998922f825ebbe01aae0cce4bbd5 (patch) | |
| tree | 3d844315931e3026c40a44de0d2117368e82360d /lldb/source/Interpreter | |
| parent | 930ebc15a6398710e84eea16b735721fe4a2c2fd (diff) | |
| download | bcm5719-llvm-0d9a201e2624998922f825ebbe01aae0cce4bbd5.tar.gz bcm5719-llvm-0d9a201e2624998922f825ebbe01aae0cce4bbd5.zip | |
[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.
llvm-svn: 371842
Diffstat (limited to 'lldb/source/Interpreter')
| -rw-r--r-- | lldb/source/Interpreter/CommandAlias.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Interpreter/OptionValueDictionary.cpp | 6 | ||||
| -rw-r--r-- | lldb/source/Interpreter/Options.cpp | 14 |
5 files changed, 14 insertions, 14 deletions
diff --git a/lldb/source/Interpreter/CommandAlias.cpp b/lldb/source/Interpreter/CommandAlias.cpp index 4281ba5338a..5139c53a47b 100644 --- a/lldb/source/Interpreter/CommandAlias.cpp +++ b/lldb/source/Interpreter/CommandAlias.cpp @@ -64,8 +64,8 @@ static bool ProcessAliasOptionsArgs(lldb::CommandObjectSP &cmd_obj_sp, 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()); } } } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index a7380b686b1..e9f22b5ebd2 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1961,7 +1961,7 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj, 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(); diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 747e4897236..d666852ee68 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -967,7 +967,7 @@ bool CommandObjectParsed::Execute(const char *args_string, } 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())); diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp index eb66c485bfd..a4022288fcc 100644 --- a/lldb/source/Interpreter/OptionValueDictionary.cpp +++ b/lldb/source/Interpreter/OptionValueDictionary.cpp @@ -111,18 +111,18 @@ Status OptionValueDictionary::SetArgs(const Args &args, 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"); diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index 0e37461601d..09ecfed206c 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -937,7 +937,7 @@ static Args ReconstituteArgsAfterParsing(llvm::ArrayRef<char *> parsed, 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(const Args &args, 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(const Args &args, 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(const Args &args, 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::ParseForCompletion(const Args &args, 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)); |

