[Lldb-commits] [PATCH] D47625: [cmake] Detect presence of wide-char libedit at build time
Christos Zoulas via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 7 12:25:13 PDT 2018
christos added inline comments.
================
Comment at: include/lldb/Host/Editline.h:72-76
#ifdef EL_CLIENTDATA /* editline with wide support + wide char read function */
using EditLineGetCharType = wchar_t;
#else
using EditLineGetCharType = char;
#endif
----------------
labath wrote:
> christos wrote:
> > labath wrote:
> > > It's not fully clear to me whether this part is still correct. My understanding is that if we use `el_wset` to set the getchar callback, we should always use wchar_t, regardless of libedit version. This is only true if all wide-char capable libedit versions also define EL_CLIENTDATA.
> > >
> > > Is this the case?
> > I believe that you are correct: If you use el_wset, you should use wchar_t. The problem is that for libedit versions prior to 2016-04-19 the getchar function used char * for narrow and wchar_t * for wide. Versions after that use wchar_t * for both. This was an accident due to some code refactoring. If you are checking if that's the case or not, perhaps you can determine this if el_rfunc_t is defined in histedit.h or not. Unfortunately there is no compile time way to determine if that's the case or not.
> Thank, I can do that. Just to double-check, the condition you say here should be is:
> ```
> #if LLDB_EDITLINE_USE_WCHAR || defined(EL_CLIENTDATA) || LLDB_LIBEDIT_HAVE_EL_RFUNC_T
> using EditLineGetCharType = wchar_t;
> #else
> using EditLineGetCharType = char;
> #endif
> ```
> Is that right ?
I think that's right. In any case it will probably fix cases that are currently broken.
https://reviews.llvm.org/D47625
More information about the lldb-commits
mailing list