Re: [Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-19 Thread Zachary Turner via lldb-commits
The reason we store the quote char, btw, is so that we can use the same exact quoting as the user typed at command line. A general algorithm wouldn't be able to reproduce exactly what the user typed On Sat, Nov 19, 2016 at 9:43 AM Zachary Turner wrote: > The main user of the c_str() is printf cal

Re: [Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-19 Thread Zachary Turner via lldb-commits
The main user of the c_str() is printf calls. It's in the commit message :) On Sat, Nov 19, 2016 at 7:14 AM Pavel Labath wrote: > labath added a comment. > > > Assuming we do that, what interface do you think would be simpler? We > still > > need easy access to both a StringRef and a c_str(), si

[Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-19 Thread Pavel Labath via lldb-commits
labath added a comment. > Assuming we do that, what interface do you think would be simpler? We still > need easy access to both a StringRef and a c_str(), since StringRef::data > is not guaranteed to be null terminated, so the entry thing is still nice. I was assuming (possibly incorrectly, I

Re: [Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-19 Thread Zachary Turner via lldb-commits
One idea might be to have the entry contain 2 StringRefs. `str` and `quoted_str`. This way you never get access to the underlying quote char, just the full arg, either quoted or unquoted (although doing this would still be better done orthogonally to this patch) On Sat, Nov 19, 2016 at 5:48 AM Zach

Re: [Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-19 Thread Zachary Turner via lldb-commits
Assuming we do that, what interface do you think would be simpler? We still need easy access to both a StringRef and a c_str(), since StringRef::data is not guaranteed to be null terminated, so the entry thing is still nice. On Sat, Nov 19, 2016 at 5:44 AM Zachary Turner wrote: > The quote char i

Re: [Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-19 Thread Zachary Turner via lldb-commits
The quote char is only exposed as a means to not break existing code which depends on it (most of which, not surprisingly, is in the Args class itself. We could try to come up with a way to kill it, but that seems like a separate refactor (and perhaps quite difficult since different platforms have

[Lldb-commits] [PATCH] D26883: Demonstrate proposed new Args API

2016-11-19 Thread Pavel Labath via lldb-commits
labath added a comment. I don't know how deep do you want this refactor to be, but there is one issue I would like us to consider, if only to decide it is out of scope of this change. I am talking about the `quote_char` thingy. The main problem for me is that I don't think it's possible to sane