diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py index d14120f163b..30bb2e1835a 100644 --- a/share/qtcreator/debugger/stdtypes.py +++ b/share/qtcreator/debugger/stdtypes.py @@ -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() diff --git a/src/plugins/debugger/simplifytype.cpp b/src/plugins/debugger/simplifytype.cpp index 57d07ad1e75..a8a26a9f051 100644 --- a/src/plugins/debugger/simplifytype.cpp +++ b/src/plugins/debugger/simplifytype.cpp @@ -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 map2;\n" "map2[\"11.0\"] = 11.0;\n" "map2[\"22.0\"] = 22.0;\n" - "unused(&map2);\n") + "unused(&map2);\n" + + "std::unordered_multimap 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") % 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") + + Check("map3.0", "[0] 1", "\"Bar\"", "") % NoCdbEngine + + Check("map3.1", "[1] 1", "\"Foo\"", "") % NoCdbEngine + + Check("map3.0", "1", "\"Foo\"", "std::pair") % CdbEngine + + Check("map3.1", "1", "\"Bar\"", "std::pair") % 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 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") + + Check("set2.0", "[0]", "42", "int") + + Check("set2.1", "[1]", "42", "int"); // class Goo diff --git a/tests/auto/debugger/tst_simplifytypes.cpp b/tests/auto/debugger/tst_simplifytypes.cpp index 94693e92b4c..2d5444d3869 100644 --- a/tests/auto/debugger/tst_simplifytypes.cpp +++ b/tests/auto/debugger/tst_simplifytypes.cpp @@ -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::allocator >, std::allocator, std::allocator > > >", "std::unordered_set, std::equal_to, std::allocator >", +"std::unordered_multiset, std::equal_to, std::allocator >", "std::unordered_map, std::equal_to, std::allocator > >", +"std::unordered_multimap, std::equal_to, std::allocator > >", "std::vector >", "std::map, std::allocator > >", @@ -124,7 +128,9 @@ const char *output[] = "std::vector", "std::vector", "std::unordered_set", + "std::unordered_multiset", "std::unordered_map", + "std::unordered_multimap", "std::vector", "std::map", // libc++