[Lldb-commits] [lldb] r333552 - [LLDB] Re-apply r303907 that's reverted by mistake

Tim Shen via lldb-commits lldb-commits at lists.llvm.org
Wed May 30 07:54:22 PDT 2018


Author: timshen
Date: Wed May 30 07:54:22 2018
New Revision: 333552

URL: http://llvm.org/viewvc/llvm-project?rev=333552&view=rev
Log:
[LLDB] Re-apply r303907 that's reverted by mistake

Modified:
    lldb/trunk/include/lldb/Host/Editline.h
    lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/include/lldb/Host/Editline.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=333552&r1=333551&r2=333552&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Editline.h (original)
+++ lldb/trunk/include/lldb/Host/Editline.h Wed May 30 07:54:22 2018
@@ -81,8 +81,14 @@ using EditLineStringStreamType = std::st
 using EditLineCharType = char;
 #endif
 
+#ifdef EL_CLIENTDATA	/* editline with wide support + wide char read function */
+using EditLineGetCharType = wchar_t;
+#else
+using EditLineGetCharType = char;
+#endif
+
 typedef int (*EditlineGetCharCallbackType)(::EditLine *editline,
-                                           EditLineCharType *c);
+                                           EditLineGetCharType *c);
 typedef unsigned char (*EditlineCommandCallbackType)(::EditLine *editline,
                                                      int ch);
 typedef const char *(*EditlinePromptCallbackType)(::EditLine *editline);
@@ -269,7 +275,7 @@ private:
 
   /// Character reading implementation for EditLine that supports our multi-line
   /// editing trickery.
-  int GetCharacter(EditLineCharType *c);
+  int GetCharacter(EditLineGetCharType *c);
 
   /// Prompt implementation for EditLine.
   const char *Prompt();
@@ -322,7 +328,7 @@ private:
   /// single or multi-line editing.
   void ConfigureEditor(bool multiline);
 
-  bool CompleteCharacter(char ch, EditLineCharType &out);
+  bool CompleteCharacter(char ch, EditLineGetCharType &out);
 
 private:
 #if LLDB_EDITLINE_USE_WCHAR

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=333552&r1=333551&r2=333552&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Wed May 30 07:54:22 2018
@@ -467,7 +467,7 @@ unsigned char Editline::RecallHistory(bo
   return CC_NEWLINE;
 }
 
-int Editline::GetCharacter(EditLineCharType *c) {
+int Editline::GetCharacter(EditLineGetCharType *c) {
   const LineInfoW *info = el_wline(m_editline);
 
   // Paint a faint version of the desired prompt over the version libedit draws
@@ -961,7 +961,7 @@ void Editline::ConfigureEditor(bool mult
          }));
 
   el_wset(m_editline, EL_GETCFN, (EditlineGetCharCallbackType)([](
-                                     EditLine *editline, EditLineCharType *c) {
+                                     EditLine *editline, EditLineGetCharType *c) {
             return Editline::InstanceFor(editline)->GetCharacter(c);
           }));
 
@@ -1350,12 +1350,12 @@ void Editline::PrintAsync(Stream *stream
   }
 }
 
-bool Editline::CompleteCharacter(char ch, EditLineCharType &out) {
+bool Editline::CompleteCharacter(char ch, EditLineGetCharType &out) {
 #if !LLDB_EDITLINE_USE_WCHAR
   if (ch == (char)EOF)
     return false;
 
-  out = ch;
+  out = (unsigned char)ch;
   return true;
 #else
   std::codecvt_utf8<wchar_t> cvt;




More information about the lldb-commits mailing list