forked from qt-creator/qt-creator
Debugger: Add libc++ std::unordered_set dumper
Change-Id: I0799791b2baffa61092c01699a4128f01151b53c Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -651,6 +651,19 @@ def qdump__std____1__unordered_map(d, value):
|
||||
d.putPair(node["__value_"], i)
|
||||
node = node["__next_"]
|
||||
|
||||
|
||||
def qdump__std____1__unordered_set(d, value):
|
||||
size = int(value["__table_"]["__p2_"]["__first_"])
|
||||
d.putItemCount(size)
|
||||
if d.isExpanded():
|
||||
node = value["__table_"]["__p1_"]["__first_"]["__next_"]
|
||||
valueType = d.templateArgument(value.type, 0)
|
||||
with Children(d, size, childType=valueType, maxNumChild=1000):
|
||||
for i in d.childRange():
|
||||
d.putSubItem(i, node["__value_"])
|
||||
node = node["__next_"]
|
||||
|
||||
|
||||
def qdump__std____debug__unordered_set(d, value):
|
||||
qdump__std__unordered_set(d, value)
|
||||
|
||||
|
||||
@@ -831,10 +831,19 @@ QString simplifySTLType(const QString &typeIn)
|
||||
if (ifstreamRE.indexIn(type) != -1)
|
||||
type.replace(ifstreamRE.cap(0), QLatin1String("std::ifstream"));
|
||||
|
||||
|
||||
// std::__1::hash_node<int, void *>::value_type -> int
|
||||
if (isLibCpp) {
|
||||
//QRegExp hashNodeRE(QLatin1String("std::__hash_node<([^<>]*),\\s*void\\s*@>::value_type"));
|
||||
QRegExp hashNodeRE(QLatin1String("std::__hash_node<([^<>]*),\\s*void\\s*@>::value_type"));
|
||||
QTC_ASSERT(hashNodeRE.isValid(), return typeIn);
|
||||
if (hashNodeRE.indexIn(type) != -1)
|
||||
type.replace(hashNodeRE.cap(0), hashNodeRE.cap(1));
|
||||
}
|
||||
|
||||
// Anything with a std::allocator
|
||||
int start = type.indexOf(QLatin1String("std::allocator<"));
|
||||
if (start == -1)
|
||||
break;
|
||||
if (start != -1) {
|
||||
// search for matching '>'
|
||||
int pos;
|
||||
int level = 0;
|
||||
@@ -960,7 +969,8 @@ QString simplifySTLType(const QString &typeIn)
|
||||
type.replace(mapRE1.cap(0), QString::fromLatin1("unordered_map<%1, %2>").arg(key, value));
|
||||
|
||||
if (isLibCpp) {
|
||||
QRegExp mapRE2(QString::fromLatin1("unordered_map<std::string, ?%1, ?std::hash<char>, ?std::equal_to<std::string>, ?%2\\s*>")
|
||||
QRegExp mapRE2(QString::fromLatin1("unordered_map<std::string, ?%1, "
|
||||
"?std::hash<char>, ?std::equal_to<std::string>, ?%2\\s*>")
|
||||
.arg(valueEsc, allocEsc));
|
||||
mapRE2.setMinimal(true);
|
||||
QTC_ASSERT(mapRE2.isValid(), return typeIn);
|
||||
@@ -968,9 +978,11 @@ QString simplifySTLType(const QString &typeIn)
|
||||
type.replace(mapRE2.cap(0), QString::fromLatin1("unordered_map<std::string, %2>").arg(value));
|
||||
}
|
||||
}
|
||||
} // with std::allocator
|
||||
}
|
||||
type.replace(QLatin1Char('@'), QLatin1Char('*'));
|
||||
type.replace(QLatin1String(" >"), QLatin1String(">"));
|
||||
qDebug() << "TYPE: " << type;
|
||||
return type;
|
||||
}
|
||||
} // namespace Internal
|
||||
|
||||
@@ -50,6 +50,7 @@ const char *description[] =
|
||||
|
||||
"libc++_stringvector",
|
||||
"libc++_unordered_map",
|
||||
"libc++_hash_node",
|
||||
|
||||
"msvc_stdstring",
|
||||
"msvc_stdwstring",
|
||||
@@ -81,8 +82,11 @@ const char *input[] =
|
||||
|
||||
// libc++
|
||||
"std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >",
|
||||
|
||||
"std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, float, std::__1::hash<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, float> > >",
|
||||
|
||||
"std::__1::__hash_node<int, void *>::value_type",
|
||||
|
||||
// MSVC
|
||||
"class std::basic_string<char,std::char_traits<char>,std::allocator<char> >",
|
||||
"class std::basic_string<unsigned short,std::char_traits<unsigned short>,std::allocator<unsigned short> >",
|
||||
@@ -114,6 +118,7 @@ const char *output[] =
|
||||
// libc++
|
||||
"std::vector<std::string>",
|
||||
"std::unordered_map<std::string, float>",
|
||||
"int",
|
||||
// MSVC
|
||||
"std::string",
|
||||
"std::wstring",
|
||||
@@ -137,15 +142,15 @@ public:
|
||||
SimplifyTypesTest();
|
||||
|
||||
private Q_SLOTS:
|
||||
void testCase1();
|
||||
void testCase1_data();
|
||||
void test();
|
||||
void test_data();
|
||||
};
|
||||
|
||||
SimplifyTypesTest::SimplifyTypesTest()
|
||||
{
|
||||
}
|
||||
|
||||
void SimplifyTypesTest::testCase1()
|
||||
void SimplifyTypesTest::test()
|
||||
{
|
||||
QFETCH(QString, input);
|
||||
QFETCH(QString, expected);
|
||||
@@ -153,7 +158,7 @@ void SimplifyTypesTest::testCase1()
|
||||
QCOMPARE(output, expected);
|
||||
}
|
||||
|
||||
void SimplifyTypesTest::testCase1_data()
|
||||
void SimplifyTypesTest::test_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<QString>("expected");
|
||||
|
||||
Reference in New Issue
Block a user