[Lldb-commits] Fix for include/lldb/Core/FormatNavigator.h
Dmitry Vyukov
dvyukov at google.com
Mon Feb 20 23:18:55 PST 2012
On Tue, Feb 21, 2012 at 3:15 AM, Enrico Granata <granata.enrico at gmail.com>wrote:
> Hi,
>
> I have committed your patch with a slight change:
>
> Author: enrico
> Date: Mon Feb 20 17:06:07 2012
> New Revision: 150997
>
> URL: http://llvm.org/viewvc/llvm-project?rev=150997&view=rev
> Log:
> committing a patch from Dmitry Vyukov that solves compilation issues with
> FormatNavigator.h
>
>
> I have changed the final varargs (…) with a pointer of the correct type
> for an exact match. Hopefully this still solves your issue with compiling
> FormatNavigator.h. Having a vararg there seemed like a potential source for
> future maintenance issues. This looks cleaner and should get the job done
> anyway :-)
>
> If you still have issues, please let us know.
>
Thanks!
Ah, I see, there are just 2 types, I just thought that there are a lot of
types and we want to specialize for one of them. I've just successfully
build lldb with your changes.
>
> *- Enrico Granata*
>
> On Feb 20, 2012, at 5:27 AM, Dmitry Vyukov wrote:
>
> On Mon, Feb 20, 2012 at 5:10 PM, Dmitry Vyukov <dvyukov at google.com> wrote:
>
>> Hi,
>>
>> I would like to ask you to review and land this patch. Currently I get
>> the following error messages:
>>
>> lldb/source/API/../../include/lldb/Core/FormatNavigator.h: In member
>> function ‘bool lldb_private::FormatNavigator<KeyType,
>> ValueType>::GetExact(lldb_private::ConstString, typename
>> lldb_private::FormatMap<KeyType, ValueType>::MapType::mapped_type&) [with
>> KeyType = std::tr1::shared_ptr<lldb_private::RegularExpression>, ValueType
>> = lldb_private::TypeFilterImpl]’:
>> SBTypeCategory.cpp:159: instantiated from here
>> lldb/source/API/../../include/lldb/Core/FormatNavigator.h:318: error:
>> call of overloaded ‘GetExact_Impl(lldb_private::ConstString&,
>> std::tr1::shared_ptr<lldb_private::SyntheticChildren>&,
>> lldb_private::FormatNavigator<std::tr1::shared_ptr<lldb_private::RegularExpression>,
>> lldb_private::TypeFilterImpl>::Types<std::tr1::shared_ptr<lldb_private::RegularExpression>,
>> lldb_private::TypeFilterImpl>)’ is ambiguous
>> lldb/source/API/../../include/lldb/Core/FormatNavigator.h:411: note:
>> candidates are: bool lldb_private::FormatNavigator<KeyType,
>> ValueType>::GetExact_Impl(lldb_private::ConstString, typename
>> lldb_private::FormatMap<KeyType, ValueType>::MapType::mapped_type&,
>> lldb_private::FormatNavigator<KeyType, ValueType>::Types<K, V>) [with K =
>> std::tr1::shared_ptr<lldb_private::RegularExpression>, V =
>> lldb_private::TypeFilterImpl, KeyType =
>> std::tr1::shared_ptr<lldb_private::RegularExpression>, ValueType =
>> lldb_private::TypeFilterImpl]
>> lldb/source/API/../../include/lldb/Core/FormatNavigator.h:458: note:
>> bool lldb_private::FormatNavigator<KeyType,
>> ValueType>::GetExact_Impl(lldb_private::ConstString, typename
>> lldb_private::FormatMap<KeyType, ValueType>::MapType::mapped_type&,
>> lldb_private::FormatNavigator<KeyType,
>> ValueType>::Types<std::tr1::shared_ptr<lldb_private::RegularExpression>,
>> V>) [with V = lldb_private::TypeFilterImpl, KeyType =
>> std::tr1::shared_ptr<lldb_private::RegularExpression>, ValueType =
>> lldb_private::TypeFilterImpl]
>>
>
>
>
> Sorry, I see that you are using NULL's instead of 0's. Here is an updated
> patch:
>
>
> Index: include/lldb/Core/FormatNavigator.h
> ===================================================================
> --- include/lldb/Core/FormatNavigator.h (revision 150956)
> +++ include/lldb/Core/FormatNavigator.h (working copy)
> @@ -254,9 +254,6 @@
> protected:
> typedef FormatMap<KeyType,ValueType> BackEndType;
>
> - template<typename, typename>
> - struct Types { };
> -
> public:
> typedef typename BackEndType::MapType MapType;
> typedef typename MapType::iterator MapIterator;
> @@ -279,13 +276,13 @@
> void
> Add (const MapKeyType &type, const MapValueType& entry)
> {
> - Add_Impl(type, entry, Types<KeyType,ValueType>());
> + Add_Impl(type, entry, (KeyType*)NULL);
> }
>
> bool
> Delete (ConstString type)
> {
> - return Delete_Impl(type, Types<KeyType, ValueType>());
> + return Delete_Impl(type, (KeyType*)NULL);
> }
>
> bool
> @@ -309,13 +306,13 @@
> bool
> Get (ConstString type, MapValueType& entry)
> {
> - return Get_Impl(type, entry, Types<KeyType,ValueType>());
> + return Get_Impl(type, entry, (KeyType*)NULL);
> }
>
> bool
> GetExact (ConstString type, MapValueType& entry)
> {
> - return GetExact_Impl(type, entry, Types<KeyType,ValueType>());
> + return GetExact_Impl(type, entry, (KeyType*)NULL);
> }
>
> MapValueType
> @@ -327,7 +324,7 @@
> lldb::TypeNameSpecifierImplSP
> GetTypeNameSpecifierAtIndex (uint32_t index)
> {
> - return GetTypeNameSpecifierAtIndex_Impl(index,
> Types<KeyType,ValueType>());
> + return GetTypeNameSpecifierAtIndex_Impl(index, (KeyType*)NULL);
> }
>
> void
> @@ -358,29 +355,25 @@
>
> ConstString m_id_cs;
>
> - template<typename K, typename V>
> void
> - Add_Impl (const MapKeyType &type, const MapValueType& entry,
> Types<K,V>)
> + Add_Impl (const MapKeyType &type, const MapValueType& entry, ...)
> {
> m_format_map.Add(type,entry);
> }
>
> - template<typename V>
> - void Add_Impl (const ConstString &type, const MapValueType& entry,
> Types<ConstString,V>)
> + void Add_Impl (const ConstString &type, const MapValueType& entry,
> ConstString *dummy)
> {
> m_format_map.Add(GetValidTypeName_Impl(type), entry);
> }
>
> - template<typename K, typename V>
> bool
> - Delete_Impl (ConstString type, Types<K,V>)
> + Delete_Impl (ConstString type, ...)
> {
> return m_format_map.Delete(type);
> }
>
> - template<typename V>
> bool
> - Delete_Impl (ConstString type, Types<lldb::RegularExpressionSP,V>)
> + Delete_Impl (ConstString type, lldb::RegularExpressionSP *dummy)
> {
> Mutex& x_mutex = m_format_map.mutex();
> lldb_private::Mutex::Locker locker(x_mutex);
> @@ -399,23 +392,20 @@
> return false;
> }
>
> - template<typename K, typename V>
> bool
> - Get_Impl (ConstString type, MapValueType& entry, Types<K,V>)
> + Get_Impl (ConstString type, MapValueType& entry, ...)
> {
> return m_format_map.Get(type, entry);
> }
>
> - template<typename K, typename V>
> bool
> - GetExact_Impl (ConstString type, MapValueType& entry, Types<K,V>
> dummy)
> + GetExact_Impl (ConstString type, MapValueType& entry, ...)
> {
> - return Get_Impl(type,entry,dummy);
> + return Get_Impl(type,entry, (KeyType*)0);
> }
>
> - template<typename K, typename V>
> lldb::TypeNameSpecifierImplSP
> - GetTypeNameSpecifierAtIndex_Impl (uint32_t index, Types<K,V> dummy)
> + GetTypeNameSpecifierAtIndex_Impl (uint32_t index, ...)
> {
> ConstString key = m_format_map.GetKeyAtIndex(index);
> if (key)
> @@ -425,9 +415,8 @@
> return lldb::TypeNameSpecifierImplSP();
> }
>
> - template<typename V>
> lldb::TypeNameSpecifierImplSP
> - GetTypeNameSpecifierAtIndex_Impl (uint32_t index,
> Types<lldb::RegularExpressionSP,V> dummy)
> + GetTypeNameSpecifierAtIndex_Impl (uint32_t index,
> lldb::RegularExpressionSP *dummy)
> {
> lldb::RegularExpressionSP regex =
> m_format_map.GetKeyAtIndex(index);
> if (regex.get() == NULL)
> @@ -436,9 +425,8 @@
>
> true));
> }
>
> - template<typename V>
> bool
> - Get_Impl (ConstString key, MapValueType& value,
> Types<lldb::RegularExpressionSP,V>)
> + Get_Impl (ConstString key, MapValueType& value,
> lldb::RegularExpressionSP *dummy)
> {
> Mutex& x_mutex = m_format_map.mutex();
> lldb_private::Mutex::Locker locker(x_mutex);
> @@ -455,9 +443,8 @@
> return false;
> }
>
> - template<typename V>
> bool
> - GetExact_Impl (ConstString key, MapValueType& value,
> Types<lldb::RegularExpressionSP,V>)
> + GetExact_Impl (ConstString key, MapValueType& value,
> lldb::RegularExpressionSP *dummy)
> {
> Mutex& x_mutex = m_format_map.mutex();
> lldb_private::Mutex::Locker locker(x_mutex);
>
>
> <FormatNavigator.diff>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20120221/3fa9cce5/attachment.html>
More information about the lldb-commits
mailing list