Revert 2 commits breaking the MSVC build

Revert "Remove a few vestigial typedefs from the old world"
This reverts commit 05872cda2a00fbd988c4fc761b1f87fe9edce224.

Revert "Cleanup the type X list commands to use the new ForEach goodness"
This reverts commit 85b1d83819a22cdc9ef12f58fd4fa92b473a4f81.

llvm-svn: 253455
This commit is contained in:
Tamas Berghammer 2015-11-18 12:11:34 +00:00
parent ea3bb626d4
commit 68aa90a11e
14 changed files with 918 additions and 226 deletions

View File

@ -101,7 +101,7 @@ public:
Clear ();
static void
ForEach (std::function<bool(ConstString, const lldb::TypeSummaryImplSP&)> callback);
LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton);
static uint32_t
GetCount ();
@ -157,6 +157,9 @@ public:
static void
DisableStar ();
static void
LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton);
static void
ForEach (TypeCategoryMap::ForEachCallback callback);

View File

@ -43,6 +43,8 @@ class FormatManager : public IFormatChangeListener
public:
typedef std::map<lldb::LanguageType, LanguageCategory::UniquePointer> LanguageCategories;
typedef TypeCategoryMap::CallbackType CategoryCallback;
FormatManager();
~FormatManager() override = default;
@ -137,6 +139,9 @@ public:
return m_categories_map.GetAtIndex(index);
}
void
LoopThroughCategories (CategoryCallback callback, void* param);
void
ForEachCategory (TypeCategoryMap::ForEachCallback callback);

View File

@ -80,6 +80,8 @@ 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) :
@ -138,6 +140,22 @@ 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)
{
@ -224,6 +242,7 @@ 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;
@ -296,6 +315,12 @@ public:
m_format_map.Clear();
}
void
LoopThrough (CallbackType callback, void* param)
{
m_format_map.LoopThrough(callback,param);
}
void
ForEach (ForEachCallback callback)
{

View File

@ -67,6 +67,14 @@ 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 ()
{
@ -87,7 +95,7 @@ namespace lldb_private {
typedef FormatterContainerPair<TypeValidatorImpl> ValidatorContainer;
#ifndef LLDB_DISABLE_PYTHON
typedef FormatterContainerPair<SyntheticChildren> SynthContainer;
typedef FormatterContainerPair<ScriptedSyntheticChildren> SynthContainer;
#endif // LLDB_DISABLE_PYTHON
public:
@ -110,84 +118,74 @@ namespace lldb_private {
typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP;
typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP;
template <typename T>
class ForEachCallbacks
class ForEach
{
public:
ForEachCallbacks () = default;
~ForEachCallbacks () = default;
ForEach () = default;
~ForEach () = default;
template<typename U = TypeFormatImpl>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (FormatContainer::ExactMatchForEachCallback callback)
ForEach&
SetFormatExactCallback (FormatContainer::ExactMatchForEachCallback callback)
{
m_format_exact = callback;
return *this;
}
template<typename U = TypeFormatImpl>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (FormatContainer::RegexMatchForEachCallback callback)
ForEach&
SetFormatRegexCallback (FormatContainer::RegexMatchForEachCallback callback)
{
m_format_regex = callback;
return *this;
}
template<typename U = TypeSummaryImpl>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (SummaryContainer::ExactMatchForEachCallback callback)
ForEach&
SetSummaryExactCallback (SummaryContainer::ExactMatchForEachCallback callback)
{
m_summary_exact = callback;
return *this;
}
template<typename U = TypeSummaryImpl>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (SummaryContainer::RegexMatchForEachCallback callback)
ForEach&
SetSummaryRegexCallback (SummaryContainer::RegexMatchForEachCallback callback)
{
m_summary_regex = callback;
return *this;
}
template<typename U = TypeFilterImpl>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (FilterContainer::ExactMatchForEachCallback callback)
ForEach&
SetFilterExactCallback (FilterContainer::ExactMatchForEachCallback callback)
{
m_filter_exact = callback;
return *this;
}
template<typename U = TypeFilterImpl>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (FilterContainer::RegexMatchForEachCallback callback)
ForEach&
SetFilterRegexCallback (FilterContainer::RegexMatchForEachCallback callback)
{
m_filter_regex = callback;
return *this;
}
#ifndef LLDB_DISABLE_PYTHON
template<typename U = SyntheticChildren>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (SynthContainer::ExactMatchForEachCallback callback)
ForEach&
SetSynthExactCallback (SynthContainer::ExactMatchForEachCallback callback)
{
m_synth_exact = callback;
return *this;
}
template<typename U = SyntheticChildren>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (SynthContainer::RegexMatchForEachCallback callback)
ForEach&
SetSynthRegexCallback (SynthContainer::RegexMatchForEachCallback callback)
{
m_synth_regex = callback;
return *this;
}
#endif // LLDB_DISABLE_PYTHON
template<typename U = TypeValidatorImpl>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (ValidatorContainer::ExactMatchForEachCallback callback)
ForEach&
SetValidatorExactCallback (ValidatorContainer::ExactMatchForEachCallback callback)
{
m_validator_exact = callback;
return *this;
}
template<typename U = TypeValidatorImpl>
typename std::enable_if<std::is_same<U,T>::value, ForEachCallbacks&>::type
Set (ValidatorContainer::RegexMatchForEachCallback callback)
ForEach&
SetValidatorRegexCallback (ValidatorContainer::RegexMatchForEachCallback callback)
{
m_validator_regex = callback;
return *this;
@ -273,9 +271,8 @@ namespace lldb_private {
ConstString name,
std::initializer_list<lldb::LanguageType> langs = {});
template <typename T>
void
ForEach (const ForEachCallbacks<T> &foreach)
ForEach (const ForEach &foreach)
{
GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());

View File

@ -37,6 +37,8 @@ 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;
@ -85,6 +87,9 @@ namespace lldb_private {
Get (uint32_t pos,
ValueSP& entry);
void
LoopThrough (CallbackType callback, void* param);
void
ForEach (ForEachCallback callback);

View File

@ -151,6 +151,7 @@ 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 ();
@ -258,6 +259,7 @@ 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;
@ -300,6 +302,7 @@ 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;

View File

@ -406,6 +406,8 @@ 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;

View File

@ -348,6 +348,7 @@ 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 ()
@ -478,8 +479,6 @@ namespace lldb_private {
return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
}
typedef std::shared_ptr<TypeFilterImpl> SharedPointer;
private:
DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
};

View File

@ -150,6 +150,7 @@ public:
TypeValidatorImpl (const Flags& flags = Flags());
typedef std::shared_ptr<TypeValidatorImpl> SharedPointer;
typedef std::function<bool(void*, ConstString, TypeValidatorImpl::SharedPointer)> ValueCallback;
virtual ~TypeValidatorImpl ();
@ -264,6 +265,7 @@ 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;

View File

@ -180,7 +180,7 @@ SBTypeCategory::GetFilterForType (SBTypeNameSpecifier spec)
if (!spec.IsValid())
return SBTypeFilter();
lldb::TypeFilterImplSP children_sp;
lldb::SyntheticChildrenSP 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

View File

@ -225,6 +225,12 @@ 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)
{
@ -268,9 +274,9 @@ DataVisualization::NamedSummaryFormats::Clear ()
}
void
DataVisualization::NamedSummaryFormats::ForEach (std::function<bool(ConstString, const lldb::TypeSummaryImplSP&)> callback)
DataVisualization::NamedSummaryFormats::LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton)
{
GetFormatManager().GetNamedSummaryContainer().ForEach(callback);
GetFormatManager().GetNamedSummaryContainer().LoopThrough(callback, callback_baton);
}
uint32_t

View File

@ -485,6 +485,21 @@ 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)
{

View File

@ -372,6 +372,39 @@ 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)
{