[lldb-dev] proposed change to remove conditional WCHAR support in libedit wrapper

Neal Sidhwaney via lldb-dev lldb-dev at lists.llvm.org
Sat Jul 10 01:51:34 PDT 2021


I was thinking of removing the conditional compilation to use libedit’s WCHAR support on non-Windows platforms.  The conditional preprocessor logic is definitely the correct way to support both wide & narrow character APIs, but editline has enabled the wide API’s by default for some time, and there might be an opportunity today to simplify it.  

I’m thinking that using the wide-character API and converting to narrow-character string whenever interacting with the rest of LLDB makes the most sense.  One hopefully small issue that the history filename is determined based on whether WCHAR is used or not.  So history might not work unless people rename their file after using a version with this change.  From what I could tell, the format of the file is actually the same whether you use history() or history_w(), so it doesn’t have to be converted from narrow chars to wide characters, although I only tested that on OS X.

There is a WIP of what this might look like here: https://github.com/llvm/llvm-project/compare/main...nealsid:lldb-editline-remove-wchar <https://github.com/llvm/llvm-project/compare/main...nealsid:lldb-editline-remove-wchar> However, it uses the narrow character libedit API. But it gives an idea of what changes will be necessary.  

Anyone else think this could be useful? Or, conversely, does anyone see something that I missed that requires the conditional compilation to remain in? Since a broken shell would be bad for everyone, I am not sure what the best way is to verify who it might break, i.e. if people who use LLDB from head want to test it first, or other platforms to consider besides OS X/Linux/Windows.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20210710/b7259ac9/attachment.html>

More information about the lldb-dev mailing list