[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
Fri Jun 1 09:39:38 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:
> 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.


https://reviews.llvm.org/D47625





More information about the lldb-commits mailing list