summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/DataFormatters/StringPrinter.cpp53
-rw-r--r--lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp10
2 files changed, 33 insertions, 30 deletions
diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp
index d373b34381e..0ee16fa39d6 100644
--- a/lldb/source/DataFormatters/StringPrinter.cpp
+++ b/lldb/source/DataFormatters/StringPrinter.cpp
@@ -133,7 +133,7 @@ GetPrintableImpl<StringPrinter::StringElementType::UTF8>(uint8_t *buffer,
uint8_t *&next) {
StringPrinter::StringPrinterBufferPointer<> retval{nullptr};
- unsigned utf8_encoded_len = getNumBytesForUTF8(*buffer);
+ unsigned utf8_encoded_len = llvm::getNumBytesForUTF8(*buffer);
if (1 + buffer_end - buffer < utf8_encoded_len) {
// I don't have enough bytes - print whatever I have left
@@ -266,9 +266,10 @@ StringPrinter::GetDefaultEscapingHelper(GetPrintableElementType elem_type) {
// use this call if you already have an LLDB-side buffer for the data
template <typename SourceDataType>
static bool DumpUTFBufferToStream(
- ConversionResult (*ConvertFunction)(const SourceDataType **,
- const SourceDataType *, UTF8 **, UTF8 *,
- ConversionFlags),
+ llvm::ConversionResult (*ConvertFunction)(const SourceDataType **,
+ const SourceDataType *,
+ llvm::UTF8 **, llvm::UTF8 *,
+ llvm::ConversionFlags),
const StringPrinter::ReadBufferAndDumpToStreamOptions &dump_options) {
Stream &stream(*dump_options.GetStream());
if (dump_options.GetPrefixToken() != 0)
@@ -303,30 +304,29 @@ static bool DumpUTFBufferToStream(
}
lldb::DataBufferSP utf8_data_buffer_sp;
- UTF8 *utf8_data_ptr = nullptr;
- UTF8 *utf8_data_end_ptr = nullptr;
+ llvm::UTF8 *utf8_data_ptr = nullptr;
+ llvm::UTF8 *utf8_data_end_ptr = nullptr;
if (ConvertFunction) {
utf8_data_buffer_sp.reset(new DataBufferHeap(4 * bufferSPSize, 0));
- utf8_data_ptr = (UTF8 *)utf8_data_buffer_sp->GetBytes();
+ 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,
- utf8_data_end_ptr, lenientConversion);
+ utf8_data_end_ptr, llvm::lenientConversion);
if (false == zero_is_terminator)
utf8_data_end_ptr = utf8_data_ptr;
+ // needed because the ConvertFunction will change the value of the
+ // data_ptr.
utf8_data_ptr =
- (UTF8 *)utf8_data_buffer_sp->GetBytes(); // needed because the
- // ConvertFunction will
- // change the value of the
- // data_ptr
+ (llvm::UTF8 *)utf8_data_buffer_sp->GetBytes();
} else {
// just copy the pointers - the cast is necessary to make the compiler
// happy
// but this should only happen if we are reading UTF8 data
- utf8_data_ptr =
- const_cast<UTF8 *>(reinterpret_cast<const UTF8 *>(data_ptr));
- utf8_data_end_ptr =
- const_cast<UTF8 *>(reinterpret_cast<const UTF8 *>(data_end_ptr));
+ utf8_data_ptr = const_cast<llvm::UTF8 *>(
+ reinterpret_cast<const llvm::UTF8 *>(data_ptr));
+ utf8_data_end_ptr = const_cast<llvm::UTF8 *>(
+ reinterpret_cast<const llvm::UTF8 *>(data_end_ptr));
}
const bool escape_non_printables = dump_options.GetEscapeNonPrintables();
@@ -512,9 +512,10 @@ bool StringPrinter::ReadStringAndDumpToStream<
template <typename SourceDataType>
static bool ReadUTFBufferAndDumpToStream(
const StringPrinter::ReadStringAndDumpToStreamOptions &options,
- ConversionResult (*ConvertFunction)(const SourceDataType **,
- const SourceDataType *, UTF8 **, UTF8 *,
- ConversionFlags)) {
+ llvm::ConversionResult (*ConvertFunction)(const SourceDataType **,
+ const SourceDataType *,
+ llvm::UTF8 **, llvm::UTF8 *,
+ llvm::ConversionFlags)) {
assert(options.GetStream() && "need a Stream to print the string to");
if (options.GetLocation() == 0 ||
@@ -591,21 +592,23 @@ template <>
bool StringPrinter::ReadStringAndDumpToStream<
StringPrinter::StringElementType::UTF8>(
const ReadStringAndDumpToStreamOptions &options) {
- return ReadUTFBufferAndDumpToStream<UTF8>(options, nullptr);
+ return ReadUTFBufferAndDumpToStream<llvm::UTF8>(options, nullptr);
}
template <>
bool StringPrinter::ReadStringAndDumpToStream<
StringPrinter::StringElementType::UTF16>(
const ReadStringAndDumpToStreamOptions &options) {
- return ReadUTFBufferAndDumpToStream<UTF16>(options, ConvertUTF16toUTF8);
+ return ReadUTFBufferAndDumpToStream<llvm::UTF16>(options,
+ llvm::ConvertUTF16toUTF8);
}
template <>
bool StringPrinter::ReadStringAndDumpToStream<
StringPrinter::StringElementType::UTF32>(
const ReadStringAndDumpToStreamOptions &options) {
- return ReadUTFBufferAndDumpToStream<UTF32>(options, ConvertUTF32toUTF8);
+ return ReadUTFBufferAndDumpToStream<llvm::UTF32>(options,
+ llvm::ConvertUTF32toUTF8);
}
template <>
@@ -614,7 +617,7 @@ bool StringPrinter::ReadBufferAndDumpToStream<
const ReadBufferAndDumpToStreamOptions &options) {
assert(options.GetStream() && "need a Stream to print the string to");
- return DumpUTFBufferToStream<UTF8>(nullptr, options);
+ return DumpUTFBufferToStream<llvm::UTF8>(nullptr, options);
}
template <>
@@ -632,7 +635,7 @@ bool StringPrinter::ReadBufferAndDumpToStream<
const ReadBufferAndDumpToStreamOptions &options) {
assert(options.GetStream() && "need a Stream to print the string to");
- return DumpUTFBufferToStream(ConvertUTF16toUTF8, options);
+ return DumpUTFBufferToStream(llvm::ConvertUTF16toUTF8, options);
}
template <>
@@ -641,7 +644,7 @@ bool StringPrinter::ReadBufferAndDumpToStream<
const ReadBufferAndDumpToStreamOptions &options) {
assert(options.GetStream() && "need a Stream to print the string to");
- return DumpUTFBufferToStream(ConvertUTF32toUTF8, options);
+ return DumpUTFBufferToStream(llvm::ConvertUTF32toUTF8, options);
}
} // namespace formatters
diff --git a/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp b/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
index e8867803842..5f8aa59397f 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
@@ -49,7 +49,7 @@ lldb_private::minidump::parseMinidumpString(llvm::ArrayRef<uint8_t> &data) {
if (error.Fail() || *source_length > data.size() || *source_length % 2 != 0)
return llvm::None;
- auto source_start = reinterpret_cast<const UTF16 *>(data.data());
+ auto source_start = reinterpret_cast<const llvm::UTF16 *>(data.data());
// source_length is the length of the string in bytes
// we need the length of the string in UTF-16 characters/code points (16 bits
// per char)
@@ -57,12 +57,12 @@ lldb_private::minidump::parseMinidumpString(llvm::ArrayRef<uint8_t> &data) {
const auto source_end = source_start + (*source_length) / 2;
// resize to worst case length
result.resize(UNI_MAX_UTF8_BYTES_PER_CODE_POINT * (*source_length) / 2);
- auto result_start = reinterpret_cast<UTF8 *>(&result[0]);
+ auto result_start = reinterpret_cast<llvm::UTF8 *>(&result[0]);
const auto result_end = result_start + result.size();
- ConvertUTF16toUTF8(&source_start, source_end, &result_start, result_end,
- strictConversion);
+ llvm::ConvertUTF16toUTF8(&source_start, source_end, &result_start, result_end,
+ llvm::strictConversion);
const auto result_size =
- std::distance(reinterpret_cast<UTF8 *>(&result[0]), result_start);
+ std::distance(reinterpret_cast<llvm::UTF8 *>(&result[0]), result_start);
result.resize(result_size); // shrink to actual length
return result;
OpenPOWER on IntegriCloud