[Lldb-commits] [PATCH] D47625: [cmake] Detect presence of wide-char libedit at build time

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 11 02:19:08 PDT 2018

labath 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;
 using EditLineGetCharType = char;
christos wrote:
> 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:
> > ```
> > 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.
Thanks a lot. I've committed the patch with this condition updated.



More information about the lldb-commits mailing list