[lldb][NFC] Make ArgEntry::quote private and provide a getter

llvm-svn: 371823
This commit is contained in:
Raphael Isemann 2019-09-13 08:26:00 +00:00
parent 1ae9e6918d
commit a024f5e370
4 changed files with 5 additions and 4 deletions

View File

@ -35,6 +35,7 @@ public:
private:
friend class Args;
std::unique_ptr<char[]> ptr;
char quote;
char *data() { return ptr.get(); }
@ -43,11 +44,11 @@ public:
ArgEntry(llvm::StringRef str, char quote);
llvm::StringRef ref;
char quote;
const char *c_str() const { return ptr.get(); }
/// Returns true if this argument was quoted in any way.
bool IsQuoted() const { return quote != '\0'; }
char GetQuoteChar() const { return quote; }
};
/// Construct with an option command string.

View File

@ -394,7 +394,7 @@ int SBCommandInterpreter::HandleCompletionWithDescriptions(
// If we matched a unique single command, add a space... Only do this if
// the completer told us this was a complete word, however...
if (lldb_matches.GetSize() == 1) {
char quote_char = request.GetParsedArg().quote;
char quote_char = request.GetParsedArg().GetQuoteChar();
common_prefix =
Args::EscapeLLDBCommandArgument(common_prefix, quote_char);
if (request.GetParsedArg().IsQuoted())

View File

@ -949,7 +949,7 @@ unsigned char Editline::TabCommand(int ch) {
std::string to_add = completion.GetCompletion();
to_add = to_add.substr(request.GetCursorArgumentPrefix().size());
if (request.GetParsedArg().IsQuoted())
to_add.push_back(request.GetParsedArg().quote);
to_add.push_back(request.GetParsedArg().GetQuoteChar());
to_add.push_back(' ');
el_insertstr(m_editline, to_add.c_str());
break;

View File

@ -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->quote);
result.AppendArgument(pos->ref, pos->GetQuoteChar());
}
return result;
}