summaryrefslogtreecommitdiffstats
path: root/lldb/source/DataFormatters
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/DataFormatters')
-rw-r--r--lldb/source/DataFormatters/CMakeLists.txt1
-rw-r--r--lldb/source/DataFormatters/DataVisualization.cpp11
-rw-r--r--lldb/source/DataFormatters/FormatCache.cpp27
-rw-r--r--lldb/source/DataFormatters/FormatManager.cpp30
-rw-r--r--lldb/source/DataFormatters/LanguageCategory.cpp19
-rw-r--r--lldb/source/DataFormatters/TypeCategory.cpp88
-rw-r--r--lldb/source/DataFormatters/TypeCategoryMap.cpp5
-rw-r--r--lldb/source/DataFormatters/TypeValidator.cpp53
-rw-r--r--lldb/source/DataFormatters/ValueObjectPrinter.cpp38
9 files changed, 6 insertions, 266 deletions
diff --git a/lldb/source/DataFormatters/CMakeLists.txt b/lldb/source/DataFormatters/CMakeLists.txt
index b8596779005..e727432da4f 100644
--- a/lldb/source/DataFormatters/CMakeLists.txt
+++ b/lldb/source/DataFormatters/CMakeLists.txt
@@ -13,7 +13,6 @@ add_lldb_library(lldbDataFormatters
TypeFormat.cpp
TypeSummary.cpp
TypeSynthetic.cpp
- TypeValidator.cpp
ValueObjectPrinter.cpp
VectorType.cpp
diff --git a/lldb/source/DataFormatters/DataVisualization.cpp b/lldb/source/DataFormatters/DataVisualization.cpp
index e73d44f60f0..99c303c9f0b 100644
--- a/lldb/source/DataFormatters/DataVisualization.cpp
+++ b/lldb/source/DataFormatters/DataVisualization.cpp
@@ -66,17 +66,6 @@ DataVisualization::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
return GetFormatManager().GetSyntheticForType(type_sp);
}
-lldb::TypeValidatorImplSP
-DataVisualization::GetValidator(ValueObject &valobj,
- lldb::DynamicValueType use_dynamic) {
- return GetFormatManager().GetValidator(valobj, use_dynamic);
-}
-
-lldb::TypeValidatorImplSP
-DataVisualization::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
- return GetFormatManager().GetValidatorForType(type_sp);
-}
-
bool DataVisualization::AnyMatches(
ConstString type_name, TypeCategoryImpl::FormatCategoryItems items,
bool only_enabled, const char **matching_category,
diff --git a/lldb/source/DataFormatters/FormatCache.cpp b/lldb/source/DataFormatters/FormatCache.cpp
index 0876673cfa8..231e7ed0c0a 100644
--- a/lldb/source/DataFormatters/FormatCache.cpp
+++ b/lldb/source/DataFormatters/FormatCache.cpp
@@ -17,7 +17,7 @@ using namespace lldb_private;
FormatCache::Entry::Entry()
: m_format_cached(false), m_summary_cached(false),
- m_synthetic_cached(false), m_validator_cached(false) {}
+ m_synthetic_cached(false) {}
bool FormatCache::Entry::IsFormatCached() { return m_format_cached; }
@@ -25,8 +25,6 @@ bool FormatCache::Entry::IsSummaryCached() { return m_summary_cached; }
bool FormatCache::Entry::IsSyntheticCached() { return m_synthetic_cached; }
-bool FormatCache::Entry::IsValidatorCached() { return m_validator_cached; }
-
void FormatCache::Entry::Get(lldb::TypeFormatImplSP &retval) {
retval = m_format_sp;
}
@@ -39,10 +37,6 @@ void FormatCache::Entry::Get(lldb::SyntheticChildrenSP &retval) {
retval = m_synthetic_sp;
}
-void FormatCache::Entry::Get(lldb::TypeValidatorImplSP &retval) {
- retval = m_validator_sp;
-}
-
void FormatCache::Entry::Set(lldb::TypeFormatImplSP format_sp) {
m_format_cached = true;
m_format_sp = format_sp;
@@ -58,11 +52,6 @@ void FormatCache::Entry::Set(lldb::SyntheticChildrenSP synthetic_sp) {
m_synthetic_sp = synthetic_sp;
}
-void FormatCache::Entry::Set(lldb::TypeValidatorImplSP validator_sp) {
- m_validator_cached = true;
- m_validator_sp = validator_sp;
-}
-
FormatCache::FormatCache()
: m_map(), m_mutex()
#ifdef LLDB_CONFIGURATION_DEBUG
@@ -89,9 +78,6 @@ template<> bool FormatCache::Entry::IsCached<lldb::TypeSummaryImplSP> () {
template<> bool FormatCache::Entry::IsCached<lldb::SyntheticChildrenSP>() {
return IsSyntheticCached();
}
-template<> bool FormatCache::Entry::IsCached<lldb::TypeValidatorImplSP>() {
- return IsValidatorCached();
-}
template <typename ImplSP>
bool FormatCache::Get(ConstString type, ImplSP &format_impl_sp) {
@@ -111,12 +97,9 @@ bool FormatCache::Get(ConstString type, ImplSP &format_impl_sp) {
return false;
}
-/// Explicit instantiations for the four types.
+/// Explicit instantiations for the three types.
/// \{
template bool
-FormatCache::Get<lldb::TypeValidatorImplSP>(ConstString,
- lldb::TypeValidatorImplSP &);
-template bool
FormatCache::Get<lldb::TypeFormatImplSP>(ConstString, lldb::TypeFormatImplSP &);
template bool
FormatCache::Get<lldb::TypeSummaryImplSP>(ConstString,
@@ -142,12 +125,6 @@ void FormatCache::Set(ConstString type,
GetEntry(type).Set(synthetic_sp);
}
-void FormatCache::Set(ConstString type,
- lldb::TypeValidatorImplSP &validator_sp) {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- GetEntry(type).Set(validator_sp);
-}
-
void FormatCache::Clear() {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_map.clear();
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 8c7967aaf1e..08fc56a72ea 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -386,30 +386,6 @@ FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
return synth_chosen_sp;
}
-lldb::TypeValidatorImplSP
-FormatManager::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
- if (!type_sp)
- return lldb::TypeValidatorImplSP();
- lldb::TypeValidatorImplSP validator_chosen_sp;
- uint32_t num_categories = m_categories_map.GetCount();
- lldb::TypeCategoryImplSP category_sp;
- uint32_t prio_category = UINT32_MAX;
- for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
- category_sp = GetCategoryAtIndex(category_id);
- if (!category_sp->IsEnabled())
- continue;
- lldb::TypeValidatorImplSP validator_current_sp(
- category_sp->GetValidatorForType(type_sp).get());
- if (validator_current_sp &&
- (validator_chosen_sp.get() == nullptr ||
- (prio_category > category_sp->GetEnabledPosition()))) {
- prio_category = category_sp->GetEnabledPosition();
- validator_chosen_sp = validator_current_sp;
- }
- }
- return validator_chosen_sp;
-}
-
void FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback) {
m_categories_map.ForEach(callback);
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
@@ -699,12 +675,6 @@ FormatManager::GetSyntheticChildren(ValueObject &valobj,
return Get<lldb::SyntheticChildrenSP>(valobj, use_dynamic);
}
-lldb::TypeValidatorImplSP
-FormatManager::GetValidator(ValueObject &valobj,
- lldb::DynamicValueType use_dynamic) {
- return Get<lldb::TypeValidatorImplSP>(valobj, use_dynamic);
-}
-
FormatManager::FormatManager()
: m_last_revision(0), m_format_cache(), m_language_categories_mutex(),
m_language_categories_map(), m_named_summaries_map(this),
diff --git a/lldb/source/DataFormatters/LanguageCategory.cpp b/lldb/source/DataFormatters/LanguageCategory.cpp
index d4d8bb9cc8d..e18ec0feaa8 100644
--- a/lldb/source/DataFormatters/LanguageCategory.cpp
+++ b/lldb/source/DataFormatters/LanguageCategory.cpp
@@ -14,7 +14,6 @@
#include "lldb/DataFormatters/TypeFormat.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
-#include "lldb/DataFormatters/TypeValidator.h"
#include "lldb/Target/Language.h"
using namespace lldb;
@@ -22,14 +21,12 @@ using namespace lldb_private;
LanguageCategory::LanguageCategory(lldb::LanguageType lang_type)
: m_category_sp(), m_hardcoded_formats(), m_hardcoded_summaries(),
- m_hardcoded_synthetics(), m_hardcoded_validators(), m_format_cache(),
- m_enabled(false) {
+ m_hardcoded_synthetics(), m_format_cache(), m_enabled(false) {
if (Language *language_plugin = Language::FindPlugin(lang_type)) {
m_category_sp = language_plugin->GetFormatters();
m_hardcoded_formats = language_plugin->GetHardcodedFormats();
m_hardcoded_summaries = language_plugin->GetHardcodedSummaries();
m_hardcoded_synthetics = language_plugin->GetHardcodedSynthetics();
- m_hardcoded_validators = language_plugin->GetHardcodedValidators();
}
Enable();
}
@@ -58,12 +55,9 @@ bool LanguageCategory::Get(FormattersMatchData &match_data,
return result;
}
-/// Explicit instantiations for the four types.
+/// Explicit instantiations for the three types.
/// \{
template bool
-LanguageCategory::Get<lldb::TypeValidatorImplSP>(FormattersMatchData &,
- lldb::TypeValidatorImplSP &);
-template bool
LanguageCategory::Get<lldb::TypeFormatImplSP>(FormattersMatchData &,
lldb::TypeFormatImplSP &);
template bool
@@ -89,11 +83,6 @@ auto &LanguageCategory::GetHardcodedFinder<lldb::SyntheticChildrenSP>() {
return m_hardcoded_synthetics;
}
-template <>
-auto &LanguageCategory::GetHardcodedFinder<lldb::TypeValidatorImplSP>() {
- return m_hardcoded_validators;
-}
-
template <typename ImplSP>
bool LanguageCategory::GetHardcoded(FormatManager &fmt_mgr,
FormattersMatchData &match_data,
@@ -113,10 +102,8 @@ bool LanguageCategory::GetHardcoded(FormatManager &fmt_mgr,
return (bool)retval_sp;
}
-/// Explicit instantiations for the four types.
+/// Explicit instantiations for the three types.
/// \{
-template bool LanguageCategory::GetHardcoded<lldb::TypeValidatorImplSP>(
- FormatManager &, FormattersMatchData &, lldb::TypeValidatorImplSP &);
template bool LanguageCategory::GetHardcoded<lldb::TypeFormatImplSP>(
FormatManager &, FormattersMatchData &, lldb::TypeFormatImplSP &);
template bool LanguageCategory::GetHardcoded<lldb::TypeSummaryImplSP>(
diff --git a/lldb/source/DataFormatters/TypeCategory.cpp b/lldb/source/DataFormatters/TypeCategory.cpp
index 7a04b59b1c8..cc86983fbb9 100644
--- a/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -19,7 +19,6 @@ TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist,
m_summary_cont("summary", "regex-summary", clist),
m_filter_cont("filter", "regex-filter", clist),
m_synth_cont("synth", "regex-synth", clist),
- m_validator_cont("validator", "regex-validator", clist), m_enabled(false),
m_change_listener(clist), m_mutex(), m_name(name), m_languages() {}
static bool IsApplicable(lldb::LanguageType category_lang,
@@ -158,20 +157,6 @@ bool TypeCategoryImpl::Get(lldb::LanguageType lang,
return false;
}
-bool TypeCategoryImpl::Get(lldb::LanguageType lang,
- const FormattersMatchVector &candidates,
- lldb::TypeValidatorImplSP &entry, uint32_t *reason) {
- if (!IsEnabled())
- return false;
- if (GetTypeValidatorsContainer()->Get(candidates, entry, reason))
- return true;
- bool regex =
- GetRegexTypeValidatorsContainer()->Get(candidates, entry, reason);
- if (regex && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
- return regex;
-}
-
void TypeCategoryImpl::Clear(FormatCategoryItems items) {
if ((items & eFormatCategoryItemValue) == eFormatCategoryItemValue)
GetTypeFormatsContainer()->Clear();
@@ -194,12 +179,6 @@ void TypeCategoryImpl::Clear(FormatCategoryItems items) {
GetTypeSyntheticsContainer()->Clear();
if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
GetRegexTypeSyntheticsContainer()->Clear();
-
- if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
- GetTypeValidatorsContainer()->Clear();
- if ((items & eFormatCategoryItemRegexValidator) ==
- eFormatCategoryItemRegexValidator)
- GetRegexTypeValidatorsContainer()->Clear();
}
bool TypeCategoryImpl::Delete(ConstString name, FormatCategoryItems items) {
@@ -227,12 +206,6 @@ bool TypeCategoryImpl::Delete(ConstString name, FormatCategoryItems items) {
if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
success = GetRegexTypeSyntheticsContainer()->Delete(name) || success;
- if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
- success = GetTypeValidatorsContainer()->Delete(name) || success;
- if ((items & eFormatCategoryItemRegexValidator) ==
- eFormatCategoryItemRegexValidator)
- success = GetRegexTypeValidatorsContainer()->Delete(name) || success;
-
return success;
}
@@ -261,12 +234,6 @@ uint32_t TypeCategoryImpl::GetCount(FormatCategoryItems items) {
if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
count += GetRegexTypeSyntheticsContainer()->GetCount();
- if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
- count += GetTypeValidatorsContainer()->GetCount();
- if ((items & eFormatCategoryItemRegexValidator) ==
- eFormatCategoryItemRegexValidator)
- count += GetRegexTypeValidatorsContainer()->GetCount();
-
return count;
}
@@ -281,7 +248,6 @@ bool TypeCategoryImpl::AnyMatches(ConstString type_name,
lldb::TypeSummaryImplSP summary_sp;
TypeFilterImpl::SharedPointer filter_sp;
ScriptedSyntheticChildren::SharedPointer synth_sp;
- TypeValidatorImpl::SharedPointer validator_sp;
if ((items & eFormatCategoryItemValue) == eFormatCategoryItemValue) {
if (GetTypeFormatsContainer()->Get(type_name, format_sp)) {
@@ -363,26 +329,6 @@ bool TypeCategoryImpl::AnyMatches(ConstString type_name,
}
}
- if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator) {
- if (GetTypeValidatorsContainer()->Get(type_name, validator_sp)) {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemValidator;
- return true;
- }
- }
- if ((items & eFormatCategoryItemRegexValidator) ==
- eFormatCategoryItemRegexValidator) {
- if (GetRegexTypeValidatorsContainer()->Get(type_name, validator_sp)) {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemRegexValidator;
- return true;
- }
- }
-
return false;
}
@@ -450,22 +396,6 @@ TypeCategoryImpl::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
return retval;
}
-TypeCategoryImpl::ValidatorContainer::MapValueType
-TypeCategoryImpl::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
- ValidatorContainer::MapValueType retval;
-
- if (type_sp) {
- if (type_sp->IsRegex())
- GetRegexTypeValidatorsContainer()->GetExact(
- ConstString(type_sp->GetName()), retval);
- else
- GetTypeValidatorsContainer()->GetExact(ConstString(type_sp->GetName()),
- retval);
- }
-
- return retval;
-}
-
lldb::TypeNameSpecifierImplSP
TypeCategoryImpl::GetTypeNameSpecifierForSummaryAtIndex(size_t index) {
if (index < GetTypeSummariesContainer()->GetCount())
@@ -538,24 +468,6 @@ TypeCategoryImpl::GetTypeNameSpecifierForSyntheticAtIndex(size_t index) {
index - GetTypeSyntheticsContainer()->GetCount());
}
-TypeCategoryImpl::ValidatorContainer::MapValueType
-TypeCategoryImpl::GetValidatorAtIndex(size_t index) {
- if (index < GetTypeValidatorsContainer()->GetCount())
- return GetTypeValidatorsContainer()->GetAtIndex(index);
- else
- return GetRegexTypeValidatorsContainer()->GetAtIndex(
- index - GetTypeValidatorsContainer()->GetCount());
-}
-
-lldb::TypeNameSpecifierImplSP
-TypeCategoryImpl::GetTypeNameSpecifierForValidatorAtIndex(size_t index) {
- if (index < GetTypeValidatorsContainer()->GetCount())
- return GetTypeValidatorsContainer()->GetTypeNameSpecifierAtIndex(index);
- else
- return GetRegexTypeValidatorsContainer()->GetTypeNameSpecifierAtIndex(
- index - GetTypeValidatorsContainer()->GetCount());
-}
-
void TypeCategoryImpl::Enable(bool value, uint32_t position) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if ((m_enabled = value))
diff --git a/lldb/source/DataFormatters/TypeCategoryMap.cpp b/lldb/source/DataFormatters/TypeCategoryMap.cpp
index 9bbecd9f420..ac515154299 100644
--- a/lldb/source/DataFormatters/TypeCategoryMap.cpp
+++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp
@@ -208,11 +208,8 @@ void TypeCategoryMap::Get(FormattersMatchData &match_data, ImplSP &retval) {
LLDB_LOGF(log, "[%s] nothing found - returning empty SP", __FUNCTION__);
}
-/// Explicit instantiations for the four types.
+/// Explicit instantiations for the three types.
/// \{
-template void TypeCategoryMap::Get<lldb::TypeValidatorImplSP>(
- FormattersMatchData &match_data, lldb::TypeValidatorImplSP &retval);
-
template void
TypeCategoryMap::Get<lldb::TypeFormatImplSP>(FormattersMatchData &match_data,
lldb::TypeFormatImplSP &retval);
diff --git a/lldb/source/DataFormatters/TypeValidator.cpp b/lldb/source/DataFormatters/TypeValidator.cpp
deleted file mode 100644
index 5ce24cacfb5..00000000000
--- a/lldb/source/DataFormatters/TypeValidator.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===-- TypeValidator.cpp ---------------------------------------*- C++ -*-===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-
-
-
-#include "lldb/DataFormatters/TypeValidator.h"
-#include "lldb/Utility/StreamString.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-TypeValidatorImpl::TypeValidatorImpl(const Flags &flags)
- : m_flags(flags), m_my_revision(0) {}
-
-TypeValidatorImpl::~TypeValidatorImpl() {}
-
-TypeValidatorImpl::ValidationResult TypeValidatorImpl::Success() {
- return ValidationResult{TypeValidatorResult::Success, ""};
-}
-
-TypeValidatorImpl::ValidationResult
-TypeValidatorImpl::Failure(std::string message) {
- return ValidationResult{TypeValidatorResult::Failure, message};
-}
-
-TypeValidatorImpl_CXX::TypeValidatorImpl_CXX(
- ValidatorFunction f, std::string d, const TypeValidatorImpl::Flags &flags)
- : TypeValidatorImpl(flags), m_description(d), m_validator_function(f) {}
-
-TypeValidatorImpl_CXX::~TypeValidatorImpl_CXX() {}
-
-TypeValidatorImpl::ValidationResult
-TypeValidatorImpl_CXX::FormatObject(ValueObject *valobj) const {
- if (!valobj)
- return Success(); // I guess there's nothing wrong with a null valueobject..
-
- return m_validator_function(valobj);
-}
-
-std::string TypeValidatorImpl_CXX::GetDescription() {
- StreamString sstr;
- sstr.Printf("%s%s%s%s", m_description.c_str(),
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "");
- return sstr.GetString();
-}
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index fa43c677a19..466cf398ec2 100644
--- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -75,8 +75,6 @@ bool ValueObjectPrinter::PrintValueObject() {
return false;
if (ShouldPrintValueObject()) {
- PrintValidationMarkerIfNeeded();
-
PrintLocationIfNeeded();
m_stream->Indent();
@@ -94,8 +92,6 @@ bool ValueObjectPrinter::PrintValueObject() {
else
m_stream->EOL();
- PrintValidationErrorIfNeeded();
-
return true;
}
@@ -790,37 +786,3 @@ void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed,
} else
m_stream->EOL();
}
-
-bool ValueObjectPrinter::ShouldPrintValidation() {
- return m_options.m_run_validator;
-}
-
-bool ValueObjectPrinter::PrintValidationMarkerIfNeeded() {
- if (!ShouldPrintValidation())
- return false;
-
- m_validation = m_valobj->GetValidationStatus();
-
- if (TypeValidatorResult::Failure == m_validation.first) {
- m_stream->Printf("! ");
- return true;
- }
-
- return false;
-}
-
-bool ValueObjectPrinter::PrintValidationErrorIfNeeded() {
- if (!ShouldPrintValidation())
- return false;
-
- if (TypeValidatorResult::Success == m_validation.first)
- return false;
-
- if (m_validation.second.empty())
- m_validation.second.assign("unknown error");
-
- m_stream->Printf(" ! validation error: %s", m_validation.second.c_str());
- m_stream->EOL();
-
- return true;
-}
OpenPOWER on IntegriCloud