[lldb][NFC] Make ArgEntry::quote private and provide a getter
authorRaphael Isemann <teemperor@gmail.com>
Fri, 13 Sep 2019 08:26:00 +0000 (08:26 +0000)
committerRaphael Isemann <teemperor@gmail.com>
Fri, 13 Sep 2019 08:26:00 +0000 (08:26 +0000)
llvm-svn: 371823

lldb/include/lldb/Utility/Args.h
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/Host/common/Editline.cpp
lldb/source/Interpreter/Options.cpp

index bc21d39bac2d3a1b21929e353a3b2f1e2d6e73cc..7672dbf95e3f90e0f0450654407c0e1150597c23 100644 (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.
index 98354c414a7689f988b8b19df8e5218033b396ed..23a9b24206cd41faff2818ea82834cb4672116bc 100644 (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())
index 0a95dffa40eee307d601a1692307d053ae9f83fe..3e655244b107b0bcc62b5d194793f46966c2aac0 100644 (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;
index 138677ca13ff824031a1d972a7c1ae0c6059ec08..0e37461601da1159c6e2f92da443b0d2a60643bc 100644 (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;
 }