forked from OSchip/llvm-project
Reapply r253423 and r253424 (which cleanup the data formatters iteration model, as well as the type X list commands), along with a change by Zachary Turner to bypass a MSVC bug with SFINAE
llvm-svn: 253493
This commit is contained in:
parent
e7891d033e
commit
3de08c5f0c
|
@ -101,7 +101,7 @@ public:
|
|||
Clear ();
|
||||
|
||||
static void
|
||||
LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton);
|
||||
ForEach (std::function<bool(ConstString, const lldb::TypeSummaryImplSP&)> callback);
|
||||
|
||||
static uint32_t
|
||||
GetCount ();
|
||||
|
@ -157,9 +157,6 @@ public:
|
|||
static void
|
||||
DisableStar ();
|
||||
|
||||
static void
|
||||
LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton);
|
||||
|
||||
static void
|
||||
ForEach (TypeCategoryMap::ForEachCallback callback);
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ class FormatManager : public IFormatChangeListener
|
|||
public:
|
||||
typedef std::map<lldb::LanguageType, LanguageCategory::UniquePointer> LanguageCategories;
|
||||
|
||||
typedef TypeCategoryMap::CallbackType CategoryCallback;
|
||||
|
||||
FormatManager();
|
||||
|
||||
~FormatManager() override = default;
|
||||
|
@ -139,9 +137,6 @@ public:
|
|||
return m_categories_map.GetAtIndex(index);
|
||||
}
|
||||
|
||||
void
|
||||
LoopThroughCategories (CategoryCallback callback, void* param);
|
||||
|
||||
void
|
||||
ForEachCategory (TypeCategoryMap::ForEachCallback callback);
|
||||
|
||||
|
|
|
@ -80,8 +80,6 @@ public:
|
|||
typedef typename ValueType::SharedPointer ValueSP;
|
||||
typedef std::map<KeyType, ValueSP> MapType;
|
||||
typedef typename MapType::iterator MapIterator;
|
||||
typedef std::function<bool(void*, KeyType, const ValueSP&)> CallbackType;
|
||||
|
||||
typedef std::function<bool(KeyType, const ValueSP&)> ForEachCallback;
|
||||
|
||||
FormatMap(IFormatChangeListener* lst) :
|
||||
|
@ -140,22 +138,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
LoopThrough (CallbackType callback, void* param)
|
||||
{
|
||||
if (callback)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
MapIterator pos, end = m_map.end();
|
||||
for (pos = m_map.begin(); pos != end; pos++)
|
||||
{
|
||||
KeyType type = pos->first;
|
||||
if (!callback(param, type, pos->second))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ForEach (ForEachCallback callback)
|
||||
{
|
||||
|
@ -242,7 +224,6 @@ public:
|
|||
typedef typename MapType::iterator MapIterator;
|
||||
typedef typename MapType::key_type MapKeyType;
|
||||
typedef typename MapType::mapped_type MapValueType;
|
||||
typedef typename BackEndType::CallbackType CallbackType;
|
||||
typedef typename BackEndType::ForEachCallback ForEachCallback;
|
||||
typedef typename std::shared_ptr<FormattersContainer<KeyType, ValueType> > SharedPointer;
|
||||
|
||||
|
@ -315,12 +296,6 @@ public:
|
|||
m_format_map.Clear();
|
||||
}
|
||||
|
||||
void
|
||||
LoopThrough (CallbackType callback, void* param)
|
||||
{
|
||||
m_format_map.LoopThrough(callback,param);
|
||||
}
|
||||
|
||||
void
|
||||
ForEach (ForEachCallback callback)
|
||||
{
|
||||
|
|
|
@ -67,14 +67,6 @@ namespace lldb_private {
|
|||
return m_regex_sp;
|
||||
}
|
||||
|
||||
void
|
||||
LoopThrough (typename ExactMatchContainer::CallbackType exact_callback,
|
||||
typename RegexMatchContainer::CallbackType regex_callback)
|
||||
{
|
||||
GetExactMatch()->LoopThrough(exact_callback);
|
||||
GetRegexMatch()->LoopThrough(regex_callback);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetCount ()
|
||||
{
|
||||
|
@ -95,7 +87,7 @@ namespace lldb_private {
|
|||
typedef FormatterContainerPair<TypeValidatorImpl> ValidatorContainer;
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
typedef FormatterContainerPair<ScriptedSyntheticChildren> SynthContainer;
|
||||
typedef FormatterContainerPair<SyntheticChildren> SynthContainer;
|
||||
#endif // LLDB_DISABLE_PYTHON
|
||||
|
||||
public:
|
||||
|
@ -118,74 +110,84 @@ namespace lldb_private {
|
|||
typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP;
|
||||
typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP;
|
||||
|
||||
class ForEach
|
||||
template <typename T>
|
||||
class ForEachCallbacks
|
||||
{
|
||||
public:
|
||||
ForEach () = default;
|
||||
~ForEach () = default;
|
||||
ForEachCallbacks () = default;
|
||||
~ForEachCallbacks () = default;
|
||||
|
||||
ForEach&
|
||||
SetFormatExactCallback (FormatContainer::ExactMatchForEachCallback callback)
|
||||
template<typename U = TypeFormatImpl>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetExact (FormatContainer::ExactMatchForEachCallback callback)
|
||||
{
|
||||
m_format_exact = callback;
|
||||
return *this;
|
||||
}
|
||||
ForEach&
|
||||
SetFormatRegexCallback (FormatContainer::RegexMatchForEachCallback callback)
|
||||
template<typename U = TypeFormatImpl>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetWithRegex (FormatContainer::RegexMatchForEachCallback callback)
|
||||
{
|
||||
m_format_regex = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ForEach&
|
||||
SetSummaryExactCallback (SummaryContainer::ExactMatchForEachCallback callback)
|
||||
template<typename U = TypeSummaryImpl>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetExact (SummaryContainer::ExactMatchForEachCallback callback)
|
||||
{
|
||||
m_summary_exact = callback;
|
||||
return *this;
|
||||
}
|
||||
ForEach&
|
||||
SetSummaryRegexCallback (SummaryContainer::RegexMatchForEachCallback callback)
|
||||
template<typename U = TypeSummaryImpl>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetWithRegex (SummaryContainer::RegexMatchForEachCallback callback)
|
||||
{
|
||||
m_summary_regex = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ForEach&
|
||||
SetFilterExactCallback (FilterContainer::ExactMatchForEachCallback callback)
|
||||
template<typename U = TypeFilterImpl>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetExact (FilterContainer::ExactMatchForEachCallback callback)
|
||||
{
|
||||
m_filter_exact = callback;
|
||||
return *this;
|
||||
}
|
||||
ForEach&
|
||||
SetFilterRegexCallback (FilterContainer::RegexMatchForEachCallback callback)
|
||||
template<typename U = TypeFilterImpl>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetWithRegex (FilterContainer::RegexMatchForEachCallback callback)
|
||||
{
|
||||
m_filter_regex = callback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
ForEach&
|
||||
SetSynthExactCallback (SynthContainer::ExactMatchForEachCallback callback)
|
||||
template<typename U = SyntheticChildren>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetExact (SynthContainer::ExactMatchForEachCallback callback)
|
||||
{
|
||||
m_synth_exact = callback;
|
||||
return *this;
|
||||
}
|
||||
ForEach&
|
||||
SetSynthRegexCallback (SynthContainer::RegexMatchForEachCallback callback)
|
||||
template<typename U = SyntheticChildren>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetWithRegex (SynthContainer::RegexMatchForEachCallback callback)
|
||||
{
|
||||
m_synth_regex = callback;
|
||||
return *this;
|
||||
}
|
||||
#endif // LLDB_DISABLE_PYTHON
|
||||
|
||||
ForEach&
|
||||
SetValidatorExactCallback (ValidatorContainer::ExactMatchForEachCallback callback)
|
||||
template<typename U = TypeValidatorImpl>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetExact (ValidatorContainer::ExactMatchForEachCallback callback)
|
||||
{
|
||||
m_validator_exact = callback;
|
||||
return *this;
|
||||
}
|
||||
ForEach&
|
||||
SetValidatorRegexCallback (ValidatorContainer::RegexMatchForEachCallback callback)
|
||||
template<typename U = TypeValidatorImpl>
|
||||
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
|
||||
SetWithRegex (ValidatorContainer::RegexMatchForEachCallback callback)
|
||||
{
|
||||
m_validator_regex = callback;
|
||||
return *this;
|
||||
|
@ -271,8 +273,9 @@ namespace lldb_private {
|
|||
ConstString name,
|
||||
std::initializer_list<lldb::LanguageType> langs = {});
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
ForEach (const ForEach &foreach)
|
||||
ForEach (const ForEachCallbacks<T> &foreach)
|
||||
{
|
||||
GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
|
||||
GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
|
||||
|
|
|
@ -37,8 +37,6 @@ namespace lldb_private {
|
|||
public:
|
||||
typedef std::map<KeyType, ValueSP> MapType;
|
||||
typedef MapType::iterator MapIterator;
|
||||
typedef bool(*CallbackType)(void*, const ValueSP&);
|
||||
|
||||
typedef std::function<bool(const ValueSP&)> ForEachCallback;
|
||||
|
||||
typedef uint32_t Position;
|
||||
|
@ -87,9 +85,6 @@ namespace lldb_private {
|
|||
Get (uint32_t pos,
|
||||
ValueSP& entry);
|
||||
|
||||
void
|
||||
LoopThrough (CallbackType callback, void* param);
|
||||
|
||||
void
|
||||
ForEach (ForEachCallback callback);
|
||||
|
||||
|
|
|
@ -151,7 +151,6 @@ namespace lldb_private {
|
|||
TypeFormatImpl (const Flags& flags = Flags());
|
||||
|
||||
typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
|
||||
typedef std::function<bool(void*, ConstString, lldb::TypeFormatImplSP)> ValueCallback;
|
||||
|
||||
virtual ~TypeFormatImpl ();
|
||||
|
||||
|
@ -259,7 +258,6 @@ namespace lldb_private {
|
|||
const TypeFormatImpl::Flags& flags = Flags());
|
||||
|
||||
typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
|
||||
typedef std::function<bool(void*, ConstString, TypeFormatImpl_Format::SharedPointer)> ValueCallback;
|
||||
|
||||
~TypeFormatImpl_Format() override;
|
||||
|
||||
|
@ -302,7 +300,6 @@ namespace lldb_private {
|
|||
const TypeFormatImpl::Flags& flags = Flags());
|
||||
|
||||
typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
|
||||
typedef std::function<bool(void*, ConstString, TypeFormatImpl_EnumType::SharedPointer)> ValueCallback;
|
||||
|
||||
~TypeFormatImpl_EnumType() override;
|
||||
|
||||
|
|
|
@ -406,8 +406,6 @@ namespace lldb_private {
|
|||
}
|
||||
|
||||
typedef std::shared_ptr<TypeSummaryImpl> SharedPointer;
|
||||
typedef std::function<bool(void*, ConstString, TypeSummaryImpl::SharedPointer)> SummaryCallback;
|
||||
typedef std::function<bool(void*, lldb::RegularExpressionSP, TypeSummaryImpl::SharedPointer)> RegexSummaryCallback;
|
||||
|
||||
protected:
|
||||
uint32_t m_my_revision;
|
||||
|
|
|
@ -348,7 +348,6 @@ namespace lldb_private {
|
|||
GetFrontEnd (ValueObject &backend) = 0;
|
||||
|
||||
typedef std::shared_ptr<SyntheticChildren> SharedPointer;
|
||||
typedef std::function<bool(void*, ConstString, SyntheticChildren::SharedPointer)> SyntheticChildrenCallback;
|
||||
|
||||
uint32_t&
|
||||
GetRevision ()
|
||||
|
@ -479,6 +478,8 @@ namespace lldb_private {
|
|||
return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<TypeFilterImpl> SharedPointer;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
|
||||
};
|
||||
|
|
|
@ -150,7 +150,6 @@ public:
|
|||
TypeValidatorImpl (const Flags& flags = Flags());
|
||||
|
||||
typedef std::shared_ptr<TypeValidatorImpl> SharedPointer;
|
||||
typedef std::function<bool(void*, ConstString, TypeValidatorImpl::SharedPointer)> ValueCallback;
|
||||
|
||||
virtual ~TypeValidatorImpl ();
|
||||
|
||||
|
@ -265,7 +264,6 @@ public:
|
|||
TypeValidatorImpl_CXX (ValidatorFunction f, std::string d, const TypeValidatorImpl::Flags& flags = Flags());
|
||||
|
||||
typedef std::shared_ptr<TypeValidatorImpl_CXX> SharedPointer;
|
||||
typedef std::function<bool(void*, ConstString, TypeValidatorImpl_CXX::SharedPointer)> ValueCallback;
|
||||
|
||||
~TypeValidatorImpl_CXX() override;
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ SBTypeCategory::GetFilterForType (SBTypeNameSpecifier spec)
|
|||
if (!spec.IsValid())
|
||||
return SBTypeFilter();
|
||||
|
||||
lldb::SyntheticChildrenSP children_sp;
|
||||
lldb::TypeFilterImplSP children_sp;
|
||||
|
||||
if (spec.IsRegex())
|
||||
m_opaque_sp->GetRegexTypeFiltersContainer()->GetExact(ConstString(spec.GetName()), children_sp);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -225,12 +225,6 @@ DataVisualization::Categories::DisableStar ()
|
|||
GetFormatManager().DisableAllCategories();
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::Categories::LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton)
|
||||
{
|
||||
GetFormatManager().LoopThroughCategories(callback, callback_baton);
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::Categories::ForEach (TypeCategoryMap::ForEachCallback callback)
|
||||
{
|
||||
|
@ -274,9 +268,9 @@ DataVisualization::NamedSummaryFormats::Clear ()
|
|||
}
|
||||
|
||||
void
|
||||
DataVisualization::NamedSummaryFormats::LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton)
|
||||
DataVisualization::NamedSummaryFormats::ForEach (std::function<bool(ConstString, const lldb::TypeSummaryImplSP&)> callback)
|
||||
{
|
||||
GetFormatManager().GetNamedSummaryContainer().LoopThrough(callback, callback_baton);
|
||||
GetFormatManager().GetNamedSummaryContainer().ForEach(callback);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
|
|
@ -485,21 +485,6 @@ FormatManager::GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp)
|
|||
return validator_chosen_sp;
|
||||
}
|
||||
|
||||
void
|
||||
FormatManager::LoopThroughCategories (CategoryCallback callback, void* param)
|
||||
{
|
||||
m_categories_map.LoopThrough(callback, param);
|
||||
Mutex::Locker locker(m_language_categories_mutex);
|
||||
for (const auto& entry : m_language_categories_map)
|
||||
{
|
||||
if (auto category_sp = entry.second->GetCategory())
|
||||
{
|
||||
if (!callback(param, category_sp))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback)
|
||||
{
|
||||
|
|
|
@ -372,39 +372,6 @@ TypeCategoryMap::GetValidator (FormattersMatchData& match_data)
|
|||
return lldb::TypeValidatorImplSP();
|
||||
}
|
||||
|
||||
void
|
||||
TypeCategoryMap::LoopThrough(CallbackType callback, void* param)
|
||||
{
|
||||
if (callback)
|
||||
{
|
||||
Mutex::Locker locker(m_map_mutex);
|
||||
|
||||
// loop through enabled categories in respective order
|
||||
{
|
||||
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
||||
for (begin = m_active_categories.begin(); begin != end; begin++)
|
||||
{
|
||||
lldb::TypeCategoryImplSP category = *begin;
|
||||
if (!callback(param, category))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// loop through disabled categories in just any order
|
||||
{
|
||||
MapIterator pos, end = m_map.end();
|
||||
for (pos = m_map.begin(); pos != end; pos++)
|
||||
{
|
||||
if (pos->second->IsEnabled())
|
||||
continue;
|
||||
KeyType type = pos->first;
|
||||
if (!callback(param, pos->second))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TypeCategoryMap::ForEach(ForEachCallback callback)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue