[Lldb-commits] [PATCH] D27780: Make OptionDefinition structure store a StringRef

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 14 16:47:08 PST 2016


zturner added inline comments.


================
Comment at: lldb/source/Interpreter/Options.cpp:728
+        for (auto &def : range) {
+          std::string full_name("--");
+          full_name.append(def.long_option);
----------------
clayborg wrote:
> Do we still need std::string here for full_name? We might be able to do smarter things with StringRef for all uses of full_name below, including the matches.GetStringAtIndex() by seeing if the string at index starts with "--", and then just comparing the remainder to "def.long_option"?
Yes, I tried that at first, but soon after noticed that `matches` is an output parameter, so we would have to fix up the caller to stop making assumptions that the `--` is tacked onto the beginning.  Certainly doable, but it has potential for growing into a large CL depending on how far down the rabbit hole we'd have to go to fix everything.


https://reviews.llvm.org/D27780





More information about the lldb-commits mailing list