[Lldb-commits] [PATCH] D77843: [lldb/DataFormatters] Delete GetStringPrinterEscapingHelper

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 20 01:02:31 PDT 2020


labath added a comment.

The test stuff looks good to me.



================
Comment at: lldb/unittests/DataFormatter/StringPrinterTests.cpp:109
+  EXPECT_TRUE(matches({"\0", 1}, QUOTE("")));
+  EXPECT_TRUE(matches("\a", QUOTE("\\a")));
+  EXPECT_TRUE(matches("\b", QUOTE("\\u{8}")));
----------------
vsk wrote:
> shafik wrote:
> > We have [raw string literals](https://en.cppreference.com/w/cpp/language/string_literal) since C++11:
> > 
> > ```
> > EXPECT_TRUE(matches("\a", R"("\a")"));
> > ```
> I personally find the current version much clearer, but can change this if others feel strongly.
I think the raw strings are cleaner, particularly when it comes to strings like `"\\\""` and `"\\\\"`


================
Comment at: lldb/unittests/DataFormatter/StringPrinterTests.cpp:31
+template <StringPrinter::StringElementType elem_ty,
+          StringPrinter::EscapeStyle escape_style>
+static Optional<std::string> format(StringRef input) {
----------------
it looks like `escape_style` could be a regular argument instead of a template.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77843





More information about the lldb-commits mailing list