diff options
author | Enrico Granata <egranata@apple.com> | 2015-10-07 02:06:48 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-10-07 02:06:48 +0000 |
commit | d54f7fb8eb3c0817d17c89640a8e3bcf0622c952 (patch) | |
tree | b25c936a539cbd296db3e17bb38cd86bc2f9dd11 /lldb/source/DataFormatters/StringPrinter.cpp | |
parent | cbffa8cc97336946adcbd6b3b532f3c080cbf246 (diff) | |
download | bcm5719-llvm-d54f7fb8eb3c0817d17c89640a8e3bcf0622c952.tar.gz bcm5719-llvm-d54f7fb8eb3c0817d17c89640a8e3bcf0622c952.zip |
Enable the StringPrinter to have prefixes that are strings instead of just a single character; and also introduce a comparable suffix mechanism
llvm-svn: 249506
Diffstat (limited to 'lldb/source/DataFormatters/StringPrinter.cpp')
-rw-r--r-- | lldb/source/DataFormatters/StringPrinter.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp index 3225168a2a3..98a9e1a5398 100644 --- a/lldb/source/DataFormatters/StringPrinter.cpp +++ b/lldb/source/DataFormatters/StringPrinter.cpp @@ -272,7 +272,7 @@ DumpUTFBufferToStream (ConversionResult (*ConvertFunction) (const SourceDataType { Stream &stream(*dump_options.GetStream()); if (dump_options.GetPrefixToken() != 0) - stream.Printf("%c",dump_options.GetPrefixToken()); + stream.Printf("%s",dump_options.GetPrefixToken()); if (dump_options.GetQuote() != 0) stream.Printf("%c",dump_options.GetQuote()); auto data(dump_options.GetData()); @@ -372,6 +372,8 @@ DumpUTFBufferToStream (ConversionResult (*ConvertFunction) (const SourceDataType } if (dump_options.GetQuote() != 0) stream.Printf("%c",dump_options.GetQuote()); + if (dump_options.GetSuffixToken() != 0) + stream.Printf("%s",dump_options.GetSuffixToken()); return true; } @@ -392,6 +394,7 @@ lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStreamOptions::ReadB { SetStream(options.GetStream()); SetPrefixToken(options.GetPrefixToken()); + SetSuffixToken(options.GetSuffixToken()); SetQuote(options.GetQuote()); SetEscapeNonPrintables(options.GetEscapeNonPrintables()); SetBinaryZeroIsTerminator(options.GetBinaryZeroIsTerminator()); @@ -433,11 +436,11 @@ StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::ASCII if (my_error.Fail()) return false; - char prefix_token = options.GetPrefixToken(); + const char* prefix_token = options.GetPrefixToken(); char quote = options.GetQuote(); if (prefix_token != 0) - options.GetStream()->Printf("%c%c",prefix_token,quote); + options.GetStream()->Printf("%s%c",prefix_token,quote); else if (quote != 0) options.GetStream()->Printf("%c",quote); @@ -481,8 +484,12 @@ StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::ASCII data++; } } - - if (quote != 0) + + const char* suffix_token = options.GetSuffixToken(); + + if (suffix_token != 0) + options.GetStream()->Printf("%c%s",quote, suffix_token); + else if (quote != 0) options.GetStream()->Printf("%c",quote); return true; |