summaryrefslogtreecommitdiff
path: root/source/DataFormatters
diff options
context:
space:
mode:
Diffstat (limited to 'source/DataFormatters')
-rw-r--r--source/DataFormatters/CXXFunctionPointer.cpp7
-rw-r--r--source/DataFormatters/DataVisualization.cpp38
-rw-r--r--source/DataFormatters/DumpValueObjectOptions.cpp7
-rw-r--r--source/DataFormatters/FormatCache.cpp25
-rw-r--r--source/DataFormatters/FormatClasses.cpp7
-rw-r--r--source/DataFormatters/FormatManager.cpp43
-rw-r--r--source/DataFormatters/FormattersHelpers.cpp11
-rw-r--r--source/DataFormatters/LanguageCategory.cpp7
-rw-r--r--source/DataFormatters/StringPrinter.cpp19
-rw-r--r--source/DataFormatters/TypeCategory.cpp32
-rw-r--r--source/DataFormatters/TypeCategoryMap.cpp11
-rw-r--r--source/DataFormatters/TypeFormat.cpp9
-rw-r--r--source/DataFormatters/TypeSummary.cpp19
-rw-r--r--source/DataFormatters/TypeSynthetic.cpp36
-rw-r--r--source/DataFormatters/TypeValidator.cpp7
-rw-r--r--source/DataFormatters/ValueObjectPrinter.cpp14
-rw-r--r--source/DataFormatters/VectorType.cpp9
17 files changed, 106 insertions, 195 deletions
diff --git a/source/DataFormatters/CXXFunctionPointer.cpp b/source/DataFormatters/CXXFunctionPointer.cpp
index 9059891e5e9b..0ca000eb0529 100644
--- a/source/DataFormatters/CXXFunctionPointer.cpp
+++ b/source/DataFormatters/CXXFunctionPointer.cpp
@@ -1,9 +1,8 @@
//===-- CXXFunctionPointer.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
//
//===----------------------------------------------------------------------===//
diff --git a/source/DataFormatters/DataVisualization.cpp b/source/DataFormatters/DataVisualization.cpp
index 23b8b6e128c8..08b3b34447bb 100644
--- a/source/DataFormatters/DataVisualization.cpp
+++ b/source/DataFormatters/DataVisualization.cpp
@@ -1,10 +1,9 @@
//===-- DataVisualization.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
//
//===----------------------------------------------------------------------===//
@@ -51,32 +50,21 @@ DataVisualization::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) {
return GetFormatManager().GetSummaryForType(type_sp);
}
-#ifndef LLDB_DISABLE_PYTHON
lldb::SyntheticChildrenSP
DataVisualization::GetSyntheticChildren(ValueObject &valobj,
lldb::DynamicValueType use_dynamic) {
return GetFormatManager().GetSyntheticChildren(valobj, use_dynamic);
}
-#endif
-
-#ifndef LLDB_DISABLE_PYTHON
-lldb::SyntheticChildrenSP DataVisualization::GetSyntheticChildrenForType(
- lldb::TypeNameSpecifierImplSP type_sp) {
- return GetFormatManager().GetSyntheticChildrenForType(type_sp);
-}
-#endif
lldb::TypeFilterImplSP
DataVisualization::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
return GetFormatManager().GetFilterForType(type_sp);
}
-#ifndef LLDB_DISABLE_PYTHON
lldb::ScriptedSyntheticChildrenSP
DataVisualization::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
return GetFormatManager().GetSyntheticForType(type_sp);
}
-#endif
lldb::TypeValidatorImplSP
DataVisualization::GetValidator(ValueObject &valobj,
@@ -97,11 +85,11 @@ bool DataVisualization::AnyMatches(
matching_category, matching_type);
}
-bool DataVisualization::Categories::GetCategory(const ConstString &category,
+bool DataVisualization::Categories::GetCategory(ConstString category,
lldb::TypeCategoryImplSP &entry,
bool allow_create) {
entry = GetFormatManager().GetCategory(category, allow_create);
- return (entry.get() != NULL);
+ return (entry.get() != nullptr);
}
bool DataVisualization::Categories::GetCategory(
@@ -112,11 +100,11 @@ bool DataVisualization::Categories::GetCategory(
return (entry.get() != nullptr);
}
-void DataVisualization::Categories::Add(const ConstString &category) {
+void DataVisualization::Categories::Add(ConstString category) {
GetFormatManager().GetCategory(category);
}
-bool DataVisualization::Categories::Delete(const ConstString &category) {
+bool DataVisualization::Categories::Delete(ConstString category) {
GetFormatManager().DisableCategory(category);
return GetFormatManager().DeleteCategory(category);
}
@@ -125,12 +113,12 @@ void DataVisualization::Categories::Clear() {
GetFormatManager().ClearCategories();
}
-void DataVisualization::Categories::Clear(const ConstString &category) {
+void DataVisualization::Categories::Clear(ConstString category) {
GetFormatManager().GetCategory(category)->Clear(
eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
}
-void DataVisualization::Categories::Enable(const ConstString &category,
+void DataVisualization::Categories::Enable(ConstString category,
TypeCategoryMap::Position pos) {
if (GetFormatManager().GetCategory(category)->IsEnabled())
GetFormatManager().DisableCategory(category);
@@ -144,7 +132,7 @@ void DataVisualization::Categories::Enable(lldb::LanguageType lang_type) {
lang_category->Enable();
}
-void DataVisualization::Categories::Disable(const ConstString &category) {
+void DataVisualization::Categories::Disable(ConstString category) {
if (GetFormatManager().GetCategory(category)->IsEnabled())
GetFormatManager().DisableCategory(category);
}
@@ -193,17 +181,17 @@ DataVisualization::Categories::GetCategoryAtIndex(size_t index) {
}
bool DataVisualization::NamedSummaryFormats::GetSummaryFormat(
- const ConstString &type, lldb::TypeSummaryImplSP &entry) {
+ ConstString type, lldb::TypeSummaryImplSP &entry) {
return GetFormatManager().GetNamedSummaryContainer().Get(type, entry);
}
void DataVisualization::NamedSummaryFormats::Add(
- const ConstString &type, const lldb::TypeSummaryImplSP &entry) {
+ ConstString type, const lldb::TypeSummaryImplSP &entry) {
GetFormatManager().GetNamedSummaryContainer().Add(
FormatManager::GetValidTypeName(type), entry);
}
-bool DataVisualization::NamedSummaryFormats::Delete(const ConstString &type) {
+bool DataVisualization::NamedSummaryFormats::Delete(ConstString type) {
return GetFormatManager().GetNamedSummaryContainer().Delete(type);
}
diff --git a/source/DataFormatters/DumpValueObjectOptions.cpp b/source/DataFormatters/DumpValueObjectOptions.cpp
index 17f8d00ff493..84f21696e054 100644
--- a/source/DataFormatters/DumpValueObjectOptions.cpp
+++ b/source/DataFormatters/DumpValueObjectOptions.cpp
@@ -1,10 +1,9 @@
//===-- DumpValueObjectOptions.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
//
//===----------------------------------------------------------------------===//
diff --git a/source/DataFormatters/FormatCache.cpp b/source/DataFormatters/FormatCache.cpp
index bb5f379d3c73..7e328cb0dac8 100644
--- a/source/DataFormatters/FormatCache.cpp
+++ b/source/DataFormatters/FormatCache.cpp
@@ -1,10 +1,9 @@
//===-- FormatCache.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
//
//===----------------------------------------------------------------------===//
@@ -110,7 +109,7 @@ FormatCache::FormatCache()
{
}
-FormatCache::Entry &FormatCache::GetEntry(const ConstString &type) {
+FormatCache::Entry &FormatCache::GetEntry(ConstString type) {
auto i = m_map.find(type), e = m_map.end();
if (i != e)
return i->second;
@@ -118,7 +117,7 @@ FormatCache::Entry &FormatCache::GetEntry(const ConstString &type) {
return m_map[type];
}
-bool FormatCache::GetFormat(const ConstString &type,
+bool FormatCache::GetFormat(ConstString type,
lldb::TypeFormatImplSP &format_sp) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
auto entry = GetEntry(type);
@@ -136,7 +135,7 @@ bool FormatCache::GetFormat(const ConstString &type,
return false;
}
-bool FormatCache::GetSummary(const ConstString &type,
+bool FormatCache::GetSummary(ConstString type,
lldb::TypeSummaryImplSP &summary_sp) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
auto entry = GetEntry(type);
@@ -154,7 +153,7 @@ bool FormatCache::GetSummary(const ConstString &type,
return false;
}
-bool FormatCache::GetSynthetic(const ConstString &type,
+bool FormatCache::GetSynthetic(ConstString type,
lldb::SyntheticChildrenSP &synthetic_sp) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
auto entry = GetEntry(type);
@@ -172,7 +171,7 @@ bool FormatCache::GetSynthetic(const ConstString &type,
return false;
}
-bool FormatCache::GetValidator(const ConstString &type,
+bool FormatCache::GetValidator(ConstString type,
lldb::TypeValidatorImplSP &validator_sp) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
auto entry = GetEntry(type);
@@ -190,25 +189,25 @@ bool FormatCache::GetValidator(const ConstString &type,
return false;
}
-void FormatCache::SetFormat(const ConstString &type,
+void FormatCache::SetFormat(ConstString type,
lldb::TypeFormatImplSP &format_sp) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
GetEntry(type).SetFormat(format_sp);
}
-void FormatCache::SetSummary(const ConstString &type,
+void FormatCache::SetSummary(ConstString type,
lldb::TypeSummaryImplSP &summary_sp) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
GetEntry(type).SetSummary(summary_sp);
}
-void FormatCache::SetSynthetic(const ConstString &type,
+void FormatCache::SetSynthetic(ConstString type,
lldb::SyntheticChildrenSP &synthetic_sp) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
GetEntry(type).SetSynthetic(synthetic_sp);
}
-void FormatCache::SetValidator(const ConstString &type,
+void FormatCache::SetValidator(ConstString type,
lldb::TypeValidatorImplSP &validator_sp) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
GetEntry(type).SetValidator(validator_sp);
diff --git a/source/DataFormatters/FormatClasses.cpp b/source/DataFormatters/FormatClasses.cpp
index 1c595c3c04e5..271963b5f8f4 100644
--- a/source/DataFormatters/FormatClasses.cpp
+++ b/source/DataFormatters/FormatClasses.cpp
@@ -1,10 +1,9 @@
//===-- FormatClasses.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
//
//===----------------------------------------------------------------------===//
diff --git a/source/DataFormatters/FormatManager.cpp b/source/DataFormatters/FormatManager.cpp
index da03c64b0f8c..dd2808a7cf7c 100644
--- a/source/DataFormatters/FormatManager.cpp
+++ b/source/DataFormatters/FormatManager.cpp
@@ -1,9 +1,8 @@
//===-- FormatManager.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
//
//===----------------------------------------------------------------------===//
@@ -147,7 +146,7 @@ char FormatManager::GetFormatAsFormatChar(lldb::Format format) {
const char *FormatManager::GetFormatAsCString(Format format) {
if (format >= eFormatDefault && format < kNumFormats)
return g_format_infos[format].format_name;
- return NULL;
+ return nullptr;
}
void FormatManager::EnableAllCategories() {
@@ -298,7 +297,7 @@ FormatManager::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) {
lldb::TypeFormatImplSP format_current_sp =
category_sp->GetFormatForType(type_sp);
if (format_current_sp &&
- (format_chosen_sp.get() == NULL ||
+ (format_chosen_sp.get() == nullptr ||
(prio_category > category_sp->GetEnabledPosition()))) {
prio_category = category_sp->GetEnabledPosition();
format_chosen_sp = format_current_sp;
@@ -322,7 +321,7 @@ FormatManager::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) {
lldb::TypeSummaryImplSP summary_current_sp =
category_sp->GetSummaryForType(type_sp);
if (summary_current_sp &&
- (summary_chosen_sp.get() == NULL ||
+ (summary_chosen_sp.get() == nullptr ||
(prio_category > category_sp->GetEnabledPosition()))) {
prio_category = category_sp->GetEnabledPosition();
summary_chosen_sp = summary_current_sp;
@@ -346,7 +345,7 @@ FormatManager::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
lldb::TypeFilterImplSP filter_current_sp(
(TypeFilterImpl *)category_sp->GetFilterForType(type_sp).get());
if (filter_current_sp &&
- (filter_chosen_sp.get() == NULL ||
+ (filter_chosen_sp.get() == nullptr ||
(prio_category > category_sp->GetEnabledPosition()))) {
prio_category = category_sp->GetEnabledPosition();
filter_chosen_sp = filter_current_sp;
@@ -355,7 +354,6 @@ FormatManager::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
return filter_chosen_sp;
}
-#ifndef LLDB_DISABLE_PYTHON
lldb::ScriptedSyntheticChildrenSP
FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
if (!type_sp)
@@ -372,7 +370,7 @@ FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
(ScriptedSyntheticChildren *)category_sp->GetSyntheticForType(type_sp)
.get());
if (synth_current_sp &&
- (synth_chosen_sp.get() == NULL ||
+ (synth_chosen_sp.get() == nullptr ||
(prio_category > category_sp->GetEnabledPosition()))) {
prio_category = category_sp->GetEnabledPosition();
synth_chosen_sp = synth_current_sp;
@@ -380,21 +378,6 @@ FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
}
return synth_chosen_sp;
}
-#endif
-
-#ifndef LLDB_DISABLE_PYTHON
-lldb::SyntheticChildrenSP FormatManager::GetSyntheticChildrenForType(
- lldb::TypeNameSpecifierImplSP type_sp) {
- if (!type_sp)
- return lldb::SyntheticChildrenSP();
- lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
- lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp);
- if (filter_sp->GetRevision() > synth_sp->GetRevision())
- return lldb::SyntheticChildrenSP(filter_sp.get());
- else
- return lldb::SyntheticChildrenSP(synth_sp.get());
-}
-#endif
lldb::TypeValidatorImplSP
FormatManager::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
@@ -411,7 +394,7 @@ FormatManager::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
lldb::TypeValidatorImplSP validator_current_sp(
category_sp->GetValidatorForType(type_sp).get());
if (validator_current_sp &&
- (validator_chosen_sp.get() == NULL ||
+ (validator_chosen_sp.get() == nullptr ||
(prio_category > category_sp->GetEnabledPosition()))) {
prio_category = category_sp->GetEnabledPosition();
validator_chosen_sp = validator_current_sp;
@@ -432,7 +415,7 @@ void FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback) {
}
lldb::TypeCategoryImplSP
-FormatManager::GetCategory(const ConstString &category_name, bool can_create) {
+FormatManager::GetCategory(ConstString category_name, bool can_create) {
if (!category_name)
return GetCategory(m_default_category_name);
lldb::TypeCategoryImplSP category;
@@ -574,7 +557,7 @@ bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) {
return true;
}
-ConstString FormatManager::GetValidTypeName(const ConstString &type) {
+ConstString FormatManager::GetValidTypeName(ConstString type) {
return ::GetValidTypeName_Impl(type);
}
@@ -781,7 +764,6 @@ FormatManager::GetSummaryFormat(ValueObject &valobj,
return retval;
}
-#ifndef LLDB_DISABLE_PYTHON
lldb::SyntheticChildrenSP
FormatManager::GetHardcodedSyntheticChildren(FormattersMatchData &match_data) {
SyntheticChildrenSP retval_sp;
@@ -860,7 +842,6 @@ FormatManager::GetSyntheticChildren(ValueObject &valobj,
m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
return retval;
}
-#endif
lldb::TypeValidatorImplSP
FormatManager::GetValidator(ValueObject &valobj,
@@ -1009,14 +990,12 @@ void FormatManager::LoadSystemFormatters() {
sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("OSType"),
ostype_summary);
-#ifndef LLDB_DISABLE_PYTHON
TypeFormatImpl::Flags fourchar_flags;
fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(
true);
AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"),
fourchar_flags);
-#endif
}
void FormatManager::LoadVectorFormatters() {
diff --git a/source/DataFormatters/FormattersHelpers.cpp b/source/DataFormatters/FormattersHelpers.cpp
index 1a1321598966..8f007df03faa 100644
--- a/source/DataFormatters/FormattersHelpers.cpp
+++ b/source/DataFormatters/FormattersHelpers.cpp
@@ -1,10 +1,9 @@
//===-- FormattersHelpers.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
//
//===----------------------------------------------------------------------===//
@@ -74,7 +73,6 @@ void lldb_private::formatters::AddOneLineSummary(
category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
}
-#ifndef LLDB_DISABLE_PYTHON
void lldb_private::formatters::AddCXXSummary(
TypeCategoryImpl::SharedPointer category_sp,
CXXFunctionSummaryFormat::Callback funct, const char *description,
@@ -118,7 +116,6 @@ void lldb_private::formatters::AddFilter(
else
category_sp->GetTypeFiltersContainer()->Add(type_name, filter_sp);
}
-#endif
size_t lldb_private::formatters::ExtractIndexFromString(const char *item_name) {
if (!item_name || !*item_name)
@@ -126,7 +123,7 @@ size_t lldb_private::formatters::ExtractIndexFromString(const char *item_name) {
if (*item_name != '[')
return UINT32_MAX;
item_name++;
- char *endptr = NULL;
+ char *endptr = nullptr;
unsigned long int idx = ::strtoul(item_name, &endptr, 0);
if (idx == 0 && endptr == item_name)
return UINT32_MAX;
diff --git a/source/DataFormatters/LanguageCategory.cpp b/source/DataFormatters/LanguageCategory.cpp
index 4a4b7c544f09..969b02556548 100644
--- a/source/DataFormatters/LanguageCategory.cpp
+++ b/source/DataFormatters/LanguageCategory.cpp
@@ -1,10 +1,9 @@
//===-- LanguageCategory.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
//
//===----------------------------------------------------------------------===//
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);
diff --git a/source/DataFormatters/TypeCategory.cpp b/source/DataFormatters/TypeCategory.cpp
index 5740a095f8bd..fed2dfb3c7c5 100644
--- a/source/DataFormatters/TypeCategory.cpp
+++ b/source/DataFormatters/TypeCategory.cpp
@@ -1,9 +1,8 @@
//===-- TypeCategory.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
//
//===----------------------------------------------------------------------===//
@@ -20,9 +19,7 @@ TypeCategoryImpl::TypeCategoryImpl(
: m_format_cont("format", "regex-format", clist),
m_summary_cont("summary", "regex-summary", clist),
m_filter_cont("filter", "regex-filter", clist),
-#ifndef LLDB_DISABLE_PYTHON
m_synth_cont("synth", "regex-synth", clist),
-#endif
m_validator_cont("validator", "regex-validator", clist), m_enabled(false),
m_change_listener(clist), m_mutex(), m_name(name), m_languages() {
for (const lldb::LanguageType lang : langs)
@@ -139,7 +136,6 @@ bool TypeCategoryImpl::Get(ValueObject &valobj,
regex_filter = GetRegexTypeFiltersContainer()->Get(candidates, filter_sp,
&reason_filter);
-#ifndef LLDB_DISABLE_PYTHON
bool regex_synth = false;
uint32_t reason_synth = 0;
bool pick_synth = false;
@@ -170,14 +166,6 @@ bool TypeCategoryImpl::Get(ValueObject &valobj,
entry = filter_sp;
return true;
}
-
-#else
- if (filter_sp) {
- entry = filter_sp;
- return true;
- }
-#endif
-
return false;
}
@@ -213,12 +201,10 @@ void TypeCategoryImpl::Clear(FormatCategoryItems items) {
eFormatCategoryItemRegexFilter)
GetRegexTypeFiltersContainer()->Clear();
-#ifndef LLDB_DISABLE_PYTHON
if ((items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth)
GetTypeSyntheticsContainer()->Clear();
if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
GetRegexTypeSyntheticsContainer()->Clear();
-#endif
if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
GetTypeValidatorsContainer()->Clear();
@@ -247,12 +233,10 @@ bool TypeCategoryImpl::Delete(ConstString name, FormatCategoryItems items) {
eFormatCategoryItemRegexFilter)
success = GetRegexTypeFiltersContainer()->Delete(name) || success;
-#ifndef LLDB_DISABLE_PYTHON
if ((items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth)
success = GetTypeSyntheticsContainer()->Delete(name) || success;
if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
success = GetRegexTypeSyntheticsContainer()->Delete(name) || success;
-#endif
if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
success = GetTypeValidatorsContainer()->Delete(name) || success;
@@ -283,12 +267,10 @@ uint32_t TypeCategoryImpl::GetCount(FormatCategoryItems items) {
eFormatCategoryItemRegexFilter)
count += GetRegexTypeFiltersContainer()->GetCount();
-#ifndef LLDB_DISABLE_PYTHON
if ((items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth)
count += GetTypeSyntheticsContainer()->GetCount();
if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
count += GetRegexTypeSyntheticsContainer()->GetCount();
-#endif
if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
count += GetTypeValidatorsContainer()->GetCount();
@@ -309,9 +291,7 @@ bool TypeCategoryImpl::AnyMatches(ConstString type_name,
lldb::TypeFormatImplSP format_sp;
lldb::TypeSummaryImplSP summary_sp;
TypeFilterImpl::SharedPointer filter_sp;
-#ifndef LLDB_DISABLE_PYTHON
ScriptedSyntheticChildren::SharedPointer synth_sp;
-#endif
TypeValidatorImpl::SharedPointer validator_sp;
if ((items & eFormatCategoryItemValue) == eFormatCategoryItemValue) {
@@ -374,7 +354,6 @@ bool TypeCategoryImpl::AnyMatches(ConstString type_name,
}
}
-#ifndef LLDB_DISABLE_PYTHON
if ((items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth) {
if (GetTypeSyntheticsContainer()->Get(type_name, synth_sp)) {
if (matching_category)
@@ -394,7 +373,6 @@ bool TypeCategoryImpl::AnyMatches(ConstString type_name,
return true;
}
}
-#endif
if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator) {
if (GetTypeValidatorsContainer()->Get(type_name, validator_sp)) {
@@ -467,7 +445,6 @@ TypeCategoryImpl::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
return retval;
}
-#ifndef LLDB_DISABLE_PYTHON
TypeCategoryImpl::SynthContainer::MapValueType
TypeCategoryImpl::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
SynthContainer::MapValueType retval;
@@ -483,7 +460,6 @@ TypeCategoryImpl::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
return retval;
}
-#endif
TypeCategoryImpl::ValidatorContainer::MapValueType
TypeCategoryImpl::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
@@ -555,7 +531,6 @@ TypeCategoryImpl::GetTypeNameSpecifierForFilterAtIndex(size_t index) {
index - GetTypeFiltersContainer()->GetCount());
}
-#ifndef LLDB_DISABLE_PYTHON
TypeCategoryImpl::SynthContainer::MapValueType
TypeCategoryImpl::GetSyntheticAtIndex(size_t index) {
if (index < GetTypeSyntheticsContainer()->GetCount())
@@ -573,7 +548,6 @@ TypeCategoryImpl::GetTypeNameSpecifierForSyntheticAtIndex(size_t index) {
return GetRegexTypeSyntheticsContainer()->GetTypeNameSpecifierAtIndex(
index - GetTypeSyntheticsContainer()->GetCount());
}
-#endif
TypeCategoryImpl::ValidatorContainer::MapValueType
TypeCategoryImpl::GetValidatorAtIndex(size_t index) {
diff --git a/source/DataFormatters/TypeCategoryMap.cpp b/source/DataFormatters/TypeCategoryMap.cpp
index 3193f2703efa..69757c9844e1 100644
--- a/source/DataFormatters/TypeCategoryMap.cpp
+++ b/source/DataFormatters/TypeCategoryMap.cpp
@@ -1,10 +1,9 @@
//===-- TypeCategoryMap.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
//
//===----------------------------------------------------------------------===//
@@ -112,7 +111,7 @@ void TypeCategoryMap::EnableAllCategories() {
decltype(sorted_categories)::iterator viter = sorted_categories.begin(),
vend = sorted_categories.end();
for (; viter != vend; viter++)
- if (viter->get())
+ if (*viter)
Enable(*viter, Last);
}
@@ -250,7 +249,6 @@ TypeCategoryMap::GetSummaryFormat(FormattersMatchData &match_data) {
return lldb::TypeSummaryImplSP();
}
-#ifndef LLDB_DISABLE_PYTHON
lldb::SyntheticChildrenSP
TypeCategoryMap::GetSyntheticChildren(FormattersMatchData &match_data) {
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
@@ -292,7 +290,6 @@ TypeCategoryMap::GetSyntheticChildren(FormattersMatchData &match_data) {
"empty SP");
return lldb::SyntheticChildrenSP();
}
-#endif
lldb::TypeValidatorImplSP
TypeCategoryMap::GetValidator(FormattersMatchData &match_data) {
diff --git a/source/DataFormatters/TypeFormat.cpp b/source/DataFormatters/TypeFormat.cpp
index f00a679cecfd..b526e9a744bc 100644
--- a/source/DataFormatters/TypeFormat.cpp
+++ b/source/DataFormatters/TypeFormat.cpp
@@ -1,9 +1,8 @@
//===-- TypeFormat.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
//
//===----------------------------------------------------------------------===//
@@ -70,7 +69,7 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj,
// default value logic
if (GetFormat() == eFormatCString) {
lldb_private::Flags type_flags(compiler_type.GetTypeInfo(
- NULL)); // disambiguate w.r.t. TypeFormatImpl::Flags
+ nullptr)); // disambiguate w.r.t. TypeFormatImpl::Flags
if (type_flags.Test(eTypeIsPointer) &&
!type_flags.Test(eTypeIsObjC)) {
// if we are dumping a pointer as a c-string, get the pointee data
diff --git a/source/DataFormatters/TypeSummary.cpp b/source/DataFormatters/TypeSummary.cpp
index 492d3efc7f4c..7f6930fdf41f 100644
--- a/source/DataFormatters/TypeSummary.cpp
+++ b/source/DataFormatters/TypeSummary.cpp
@@ -1,9 +1,8 @@
//===-- TypeSummary.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
//
//===----------------------------------------------------------------------===//
@@ -30,16 +29,6 @@ using namespace lldb_private;
TypeSummaryOptions::TypeSummaryOptions()
: m_lang(eLanguageTypeUnknown), m_capping(eTypeSummaryCapped) {}
-TypeSummaryOptions::TypeSummaryOptions(const TypeSummaryOptions &rhs)
- : m_lang(rhs.m_lang), m_capping(rhs.m_capping) {}
-
-TypeSummaryOptions &TypeSummaryOptions::
-operator=(const TypeSummaryOptions &rhs) {
- m_lang = rhs.m_lang;
- m_capping = rhs.m_capping;
- return *this;
-}
-
lldb::LanguageType TypeSummaryOptions::GetLanguage() const { return m_lang; }
lldb::TypeSummaryCapping TypeSummaryOptions::GetCapping() const {
@@ -178,7 +167,7 @@ bool ScriptSummaryFormat::FormatObject(ValueObject *valobj, std::string &retval,
}
ScriptInterpreter *script_interpreter =
- target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ target_sp->GetDebugger().GetScriptInterpreter();
if (!script_interpreter) {
retval.assign("error: no ScriptInterpreter");
diff --git a/source/DataFormatters/TypeSynthetic.cpp b/source/DataFormatters/TypeSynthetic.cpp
index de46d505349b..23c80fc58d02 100644
--- a/source/DataFormatters/TypeSynthetic.cpp
+++ b/source/DataFormatters/TypeSynthetic.cpp
@@ -1,10 +1,9 @@
//===-- TypeSynthetic.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
//
//===----------------------------------------------------------------------===//
@@ -52,7 +51,7 @@ bool TypeFilterImpl::SetExpressionPathAtIndex(size_t i,
}
size_t
-TypeFilterImpl::FrontEnd::GetIndexOfChildWithName(const ConstString &name) {
+TypeFilterImpl::FrontEnd::GetIndexOfChildWithName(ConstString name) {
const char *name_cstr = name.GetCString();
if (name_cstr) {
for (size_t i = 0; i < filter->GetCount(); i++) {
@@ -126,12 +125,10 @@ lldb::ValueObjectSP SyntheticChildrenFrontEnd::CreateValueObjectFromData(
return valobj_sp;
}
-#ifndef LLDB_DISABLE_PYTHON
-
ScriptedSyntheticChildren::FrontEnd::FrontEnd(std::string pclass,
ValueObject &backend)
: SyntheticChildrenFrontEnd(backend), m_python_class(pclass),
- m_wrapper_sp(), m_interpreter(NULL) {
+ m_wrapper_sp(), m_interpreter(nullptr) {
if (backend == LLDB_INVALID_UID)
return;
@@ -140,10 +137,9 @@ ScriptedSyntheticChildren::FrontEnd::FrontEnd(std::string pclass,
if (!target_sp)
return;
- m_interpreter =
- target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ m_interpreter = target_sp->GetDebugger().GetScriptInterpreter();
- if (m_interpreter != NULL)
+ if (m_interpreter != nullptr)
m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(
m_python_class.c_str(), backend.GetSP());
}
@@ -163,48 +159,48 @@ bool ScriptedSyntheticChildren::FrontEnd::IsValid() {
}
size_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren() {
- if (!m_wrapper_sp || m_interpreter == NULL)
+ if (!m_wrapper_sp || m_interpreter == nullptr)
return 0;
return m_interpreter->CalculateNumChildren(m_wrapper_sp, UINT32_MAX);
}
size_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren(uint32_t max) {
- if (!m_wrapper_sp || m_interpreter == NULL)
+ if (!m_wrapper_sp || m_interpreter == nullptr)
return 0;
return m_interpreter->CalculateNumChildren(m_wrapper_sp, max);
}
bool ScriptedSyntheticChildren::FrontEnd::Update() {
- if (!m_wrapper_sp || m_interpreter == NULL)
+ if (!m_wrapper_sp || m_interpreter == nullptr)
return false;
return m_interpreter->UpdateSynthProviderInstance(m_wrapper_sp);
}
bool ScriptedSyntheticChildren::FrontEnd::MightHaveChildren() {
- if (!m_wrapper_sp || m_interpreter == NULL)
+ if (!m_wrapper_sp || m_interpreter == nullptr)
return false;
return m_interpreter->MightHaveChildrenSynthProviderInstance(m_wrapper_sp);
}
size_t ScriptedSyntheticChildren::FrontEnd::GetIndexOfChildWithName(
- const ConstString &name) {
- if (!m_wrapper_sp || m_interpreter == NULL)
+ ConstString name) {
+ if (!m_wrapper_sp || m_interpreter == nullptr)
return UINT32_MAX;
return m_interpreter->GetIndexOfChildWithName(m_wrapper_sp,
name.GetCString());
}
lldb::ValueObjectSP ScriptedSyntheticChildren::FrontEnd::GetSyntheticValue() {
- if (!m_wrapper_sp || m_interpreter == NULL)
+ if (!m_wrapper_sp || m_interpreter == nullptr)
return nullptr;
return m_interpreter->GetSyntheticValue(m_wrapper_sp);
}
ConstString ScriptedSyntheticChildren::FrontEnd::GetSyntheticTypeName() {
- if (!m_wrapper_sp || m_interpreter == NULL)
+ if (!m_wrapper_sp || m_interpreter == nullptr)
return ConstString();
return m_interpreter->GetSyntheticTypeName(m_wrapper_sp);
@@ -219,5 +215,3 @@ std::string ScriptedSyntheticChildren::GetDescription() {
return sstr.GetString();
}
-
-#endif // #ifndef LLDB_DISABLE_PYTHON
diff --git a/source/DataFormatters/TypeValidator.cpp b/source/DataFormatters/TypeValidator.cpp
index 6769a5a99856..5ce24cacfb55 100644
--- a/source/DataFormatters/TypeValidator.cpp
+++ b/source/DataFormatters/TypeValidator.cpp
@@ -1,9 +1,8 @@
//===-- TypeValidator.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
//
//===----------------------------------------------------------------------===//
diff --git a/source/DataFormatters/ValueObjectPrinter.cpp b/source/DataFormatters/ValueObjectPrinter.cpp
index 082158822dff..409cffed9b0f 100644
--- a/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/source/DataFormatters/ValueObjectPrinter.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectPrinter.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
//
//===----------------------------------------------------------------------===//
@@ -332,7 +331,7 @@ TypeSummaryImpl *ValueObjectPrinter::GetSummaryFormatter(bool null_if_omitted) {
: m_valobj->GetSummaryFormat().get();
if (m_options.m_omit_summary_depth > 0)
- entry = NULL;
+ entry = nullptr;
m_summary_formatter.first = entry;
m_summary_formatter.second = true;
}
@@ -416,8 +415,9 @@ bool ValueObjectPrinter::PrintValueAndSummaryIfNeeded(bool &value_printed,
// explicitly)
TypeSummaryImpl *entry = GetSummaryFormatter();
if (!IsNil() && !IsUninitialized() && !m_value.empty() &&
- (entry == NULL || (entry->DoesPrintValue(m_valobj) ||
- m_options.m_format != eFormatDefault) ||
+ (entry == nullptr ||
+ (entry->DoesPrintValue(m_valobj) ||
+ m_options.m_format != eFormatDefault) ||
m_summary.empty()) &&
!m_options.m_hide_value) {
if (m_options.m_hide_pointer_value &&
diff --git a/source/DataFormatters/VectorType.cpp b/source/DataFormatters/VectorType.cpp
index b11fb1456afa..18880f72ef2e 100644
--- a/source/DataFormatters/VectorType.cpp
+++ b/source/DataFormatters/VectorType.cpp
@@ -1,9 +1,8 @@
//===-- VectorType.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
//
//===----------------------------------------------------------------------===//
@@ -234,7 +233,7 @@ public:
bool MightHaveChildren() override { return true; }
- size_t GetIndexOfChildWithName(const ConstString &name) override {
+ size_t GetIndexOfChildWithName(ConstString name) override {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
if (idx < UINT32_MAX && idx >= CalculateNumChildren())