[Lldb-commits] [PATCH] D120101: [lldb] Fix (unintentional) recursion in CommandObjectRegexCommand

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Feb 20 16:28:52 PST 2022


clayborg added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectRegexCommand.h:47
+  /// matched with replacements[1] and not replacements[0].
+  static std::string SubstituteVariables(
+      llvm::StringRef input,
----------------
clayborg wrote:
> Do we want a "Expected<std::string>" as the result? If any index that follows a '%' 'that is 1 or higher could require the index be valid within "replacements" or we would return an error like "%4 is out of range, not enough arguments specified". Seems weird to just leave it in the resulting string as that is most certainly not what the user would expect? I might be what we used to do, but since we are improving things here, is seems like this would be easy to do
And also, do we really want to print "%0" if we have one in the string? Maybe an error for that as well?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120101/new/

https://reviews.llvm.org/D120101



More information about the lldb-commits mailing list