forked from qt-creator/qt-creator
Debugger: Add dumper for unordered_multi(set/map)
Change-Id: Ie1badb0cab0331c35e3094ab121a1a1170cc2bcf Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -763,6 +763,20 @@ def qdump__std__unordered_map(d, value):
|
||||
def qdump__std____debug__unordered_map(d, value):
|
||||
qdump__std__unordered_map(d, value)
|
||||
|
||||
|
||||
def qform__std__unordered_multimap():
|
||||
return qform__std__unordered_map()
|
||||
|
||||
def qform__std____debug__unordered_multimap():
|
||||
return qform__std____debug__unordered_map()
|
||||
|
||||
def qdump__std__unordered_multimap(d, value):
|
||||
qdump__std__unordered_map(d, value)
|
||||
|
||||
def qdump__std____debug__unordered_multimap(d, value):
|
||||
qdump__std__unordered_multimap(d, value)
|
||||
|
||||
|
||||
def qdump__std__unordered_set(d, value):
|
||||
if d.isQnxTarget() or d.isMsvcTarget():
|
||||
qdump__std__list__QNX(d, value["_List"])
|
||||
@@ -836,6 +850,12 @@ def qdump__std____1__unordered_set(d, value):
|
||||
def qdump__std____debug__unordered_set(d, value):
|
||||
qdump__std__unordered_set(d, value)
|
||||
|
||||
def qdump__std__unordered_multiset(d, value):
|
||||
qdump__std__unordered_set(d, value)
|
||||
|
||||
def qdump__std____debug__unordered_multiset(d, value):
|
||||
qdump__std__unordered_multiset(d, value)
|
||||
|
||||
|
||||
def qform__std__valarray():
|
||||
return arrayForms()
|
||||
|
@@ -215,12 +215,12 @@ QString simplifyType(const QString &typeIn)
|
||||
type.replace(setRE.cap(0), QString::fromLatin1("set<%1>").arg(inner));
|
||||
|
||||
// std::unordered_set
|
||||
QRegExp unorderedSetRE(QString::fromLatin1("unordered_set<%1, ?std::hash<%2>, ?std::equal_to<%3>, ?%4\\s*>")
|
||||
QRegExp unorderedSetRE(QString::fromLatin1("unordered_(multi)?set<%1, ?std::hash<%2>, ?std::equal_to<%3>, ?%4\\s*>")
|
||||
.arg(innerEsc, innerEsc, innerEsc, allocEsc));
|
||||
unorderedSetRE.setMinimal(true);
|
||||
QTC_ASSERT(unorderedSetRE.isValid(), return typeIn);
|
||||
if (unorderedSetRE.indexIn(type) != -1)
|
||||
type.replace(unorderedSetRE.cap(0), QString::fromLatin1("unordered_set<%1>").arg(inner));
|
||||
type.replace(unorderedSetRE.cap(0), QString::fromLatin1("unordered_%1set<%2>").arg(unorderedSetRE.cap(1), inner));
|
||||
|
||||
// boost::unordered_set
|
||||
QRegExp boostUnorderedSetRE(QString::fromLatin1("unordered_set<%1, ?boost::hash<%2>, ?std::equal_to<%3>, ?%4\\s*>")
|
||||
@@ -287,12 +287,12 @@ QString simplifyType(const QString &typeIn)
|
||||
pos++;
|
||||
const QString value = inner.mid(pos, inner.size() - pos - 1).trimmed();
|
||||
const QString valueEsc = QRegExp::escape(value);
|
||||
QRegExp mapRE1(QString::fromLatin1("unordered_map<%1, ?%2, ?std::hash<%3 ?>, ?std::equal_to<%4 ?>, ?%5\\s*>")
|
||||
QRegExp mapRE1(QString::fromLatin1("unordered_(multi)?map<%1, ?%2, ?std::hash<%3 ?>, ?std::equal_to<%4 ?>, ?%5\\s*>")
|
||||
.arg(keyEsc, valueEsc, keyEsc, keyEsc, allocEsc));
|
||||
mapRE1.setMinimal(true);
|
||||
QTC_ASSERT(mapRE1.isValid(), return typeIn);
|
||||
if (mapRE1.indexIn(type) != -1)
|
||||
type.replace(mapRE1.cap(0), QString::fromLatin1("unordered_map<%1, %2>").arg(key, value));
|
||||
type.replace(mapRE1.cap(0), QString::fromLatin1("unordered_%1map<%2, %3>").arg(mapRE1.cap(1), key, value));
|
||||
|
||||
if (isLibCpp) {
|
||||
QRegExp mapRE2(QString::fromLatin1("unordered_map<std::string, ?%1, "
|
||||
|
@@ -4823,7 +4823,12 @@ void tst_Dumpers::dumper_data()
|
||||
"std::unordered_map<std::string, float> map2;\n"
|
||||
"map2[\"11.0\"] = 11.0;\n"
|
||||
"map2[\"22.0\"] = 22.0;\n"
|
||||
"unused(&map2);\n")
|
||||
"unused(&map2);\n"
|
||||
|
||||
"std::unordered_multimap<int, std::string> map3;\n"
|
||||
"map3.insert({1, \"Foo\"});\n"
|
||||
"map3.insert({1, \"Bar\"});\n"
|
||||
"unused(&map3);\n" )
|
||||
|
||||
+ Cxx11Profile()
|
||||
|
||||
@@ -4847,7 +4852,13 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("map2.1", "\"22.0\"", FloatValue("22.0"),
|
||||
"std::pair<std::string, float>") % CdbEngine
|
||||
+ Check("map2.1.first", "\"22.0\"", "std::string") % CdbEngine
|
||||
+ Check("map2.1.second", FloatValue("22"), "float") % CdbEngine;
|
||||
+ Check("map2.1.second", FloatValue("22"), "float") % CdbEngine
|
||||
|
||||
+ Check("map3", "<2 items>", "std::unordered_multimap<int, std::string>")
|
||||
+ Check("map3.0", "[0] 1", "\"Bar\"", "") % NoCdbEngine
|
||||
+ Check("map3.1", "[1] 1", "\"Foo\"", "") % NoCdbEngine
|
||||
+ Check("map3.0", "1", "\"Foo\"", "std::pair<int const ,std::string>") % CdbEngine
|
||||
+ Check("map3.1", "1", "\"Bar\"", "std::pair<int const ,std::string>") % CdbEngine;
|
||||
|
||||
|
||||
QTest::newRow("StdUnorderedSet")
|
||||
@@ -4856,7 +4867,12 @@ void tst_Dumpers::dumper_data()
|
||||
"set1.insert(11);\n"
|
||||
"set1.insert(22);\n"
|
||||
"set1.insert(33);\n"
|
||||
"unused(&set1);\n")
|
||||
"unused(&set1);\n"
|
||||
|
||||
"std::unordered_multiset<int> set2;\n"
|
||||
"set2.insert(42);\n"
|
||||
"set2.insert(42);\n"
|
||||
"unused(&set2);\n")
|
||||
|
||||
+ Cxx11Profile()
|
||||
|
||||
@@ -4865,7 +4881,11 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("set1.0", "[0]", "11", "int") % CdbEngine
|
||||
+ Check("set1.1", "[1]", "22", "int")
|
||||
+ Check("set1.2", "[2]", "11", "int") % NoCdbEngine
|
||||
+ Check("set1.2", "[2]", "33", "int") % CdbEngine;
|
||||
+ Check("set1.2", "[2]", "33", "int") % CdbEngine
|
||||
|
||||
+ Check("set2", "<2 items>", "std::unordered_multiset<int>")
|
||||
+ Check("set2.0", "[0]", "42", "int")
|
||||
+ Check("set2.1", "[1]", "42", "int");
|
||||
|
||||
|
||||
// class Goo
|
||||
|
@@ -44,7 +44,9 @@ const char *description[] =
|
||||
"g++_stringvector",
|
||||
"g++_wstringvector",
|
||||
"g++_unordered_set",
|
||||
"g++_unordered_multiset",
|
||||
"g++_unordered_map",
|
||||
"g++_unordered_multimap",
|
||||
"g++_stdvector_int_ptr",
|
||||
"g++_stdmap_char_ptr",
|
||||
|
||||
@@ -82,7 +84,9 @@ const char *input[] =
|
||||
"std::vector<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >",
|
||||
|
||||
"std::unordered_set<int, std::hash<int>, std::equal_to<int>, std::allocator<int> >",
|
||||
"std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, std::allocator<int> >",
|
||||
"std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >",
|
||||
"std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, int> > >",
|
||||
|
||||
"std::vector<int *, std::allocator<int*> >",
|
||||
"std::map<const char *, Foo, std::less<const char *>, std::allocator<std::pair<char const* const, Foo> > >",
|
||||
@@ -124,7 +128,9 @@ const char *output[] =
|
||||
"std::vector<std::string>",
|
||||
"std::vector<std::wstring>",
|
||||
"std::unordered_set<int>",
|
||||
"std::unordered_multiset<int>",
|
||||
"std::unordered_map<int, int>",
|
||||
"std::unordered_multimap<int, int>",
|
||||
"std::vector<int *>",
|
||||
"std::map<const char *, Foo>",
|
||||
// libc++
|
||||
|
Reference in New Issue
Block a user