diff options
Diffstat (limited to 'source/DataFormatters/StringPrinter.cpp')
-rw-r--r-- | source/DataFormatters/StringPrinter.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/DataFormatters/StringPrinter.cpp b/source/DataFormatters/StringPrinter.cpp index 6a000f0f6431..27d649bfc370 100644 --- a/source/DataFormatters/StringPrinter.cpp +++ b/source/DataFormatters/StringPrinter.cpp @@ -1,10 +1,9 @@ //===-- StringPrinter.cpp ----------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -21,6 +20,7 @@ #include <ctype.h> #include <locale> +#include <memory> using namespace lldb; using namespace lldb_private; @@ -271,7 +271,7 @@ static bool DumpUTFBufferToStream( llvm::ConversionFlags), const StringPrinter::ReadBufferAndDumpToStreamOptions &dump_options) { Stream &stream(*dump_options.GetStream()); - if (dump_options.GetPrefixToken() != 0) + if (dump_options.GetPrefixToken() != nullptr) stream.Printf("%s", dump_options.GetPrefixToken()); if (dump_options.GetQuote() != 0) stream.Printf("%c", dump_options.GetQuote()); @@ -307,7 +307,8 @@ static bool DumpUTFBufferToStream( llvm::UTF8 *utf8_data_end_ptr = nullptr; if (ConvertFunction) { - utf8_data_buffer_sp.reset(new DataBufferHeap(4 * bufferSPSize, 0)); + utf8_data_buffer_sp = + std::make_shared<DataBufferHeap>(4 * bufferSPSize, 0); utf8_data_ptr = (llvm::UTF8 *)utf8_data_buffer_sp->GetBytes(); utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize(); ConvertFunction(&data_ptr, data_end_ptr, &utf8_data_ptr, @@ -372,7 +373,7 @@ static bool DumpUTFBufferToStream( } if (dump_options.GetQuote() != 0) stream.Printf("%c", dump_options.GetQuote()); - if (dump_options.GetSuffixToken() != 0) + if (dump_options.GetSuffixToken() != nullptr) stream.Printf("%s", dump_options.GetSuffixToken()); if (dump_options.GetIsTruncated()) stream.Printf("..."); @@ -448,7 +449,7 @@ bool StringPrinter::ReadStringAndDumpToStream< const char *prefix_token = options.GetPrefixToken(); char quote = options.GetQuote(); - if (prefix_token != 0) + if (prefix_token != nullptr) options.GetStream()->Printf("%s%c", prefix_token, quote); else if (quote != 0) options.GetStream()->Printf("%c", quote); @@ -496,7 +497,7 @@ bool StringPrinter::ReadStringAndDumpToStream< const char *suffix_token = options.GetSuffixToken(); - if (suffix_token != 0) + if (suffix_token != nullptr) options.GetStream()->Printf("%c%s", quote, suffix_token); else if (quote != 0) options.GetStream()->Printf("%c", quote); |