Debugger: Fix target type parsing for array types

Task-number: QTCREATORBUG-20639
Task-number: QTCREATORBUG-21677
Change-Id: I233ad175f9f4d1b7859e4a066505880eb975f49b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2018-12-14 09:29:10 +01:00
parent 168533ee78
commit 5e61e0aa73

View File

@@ -329,8 +329,15 @@ std::string PyType::targetName() const
const std::string &typeName = name(); const std::string &typeName = name();
if (isPointerType(typeName)) if (isPointerType(typeName))
return stripPointerType(typeName); return stripPointerType(typeName);
if (isArrayType(typeName)) if (isArrayType(typeName)) {
return typeName.substr(0, typeName.find_last_of('[')); const auto openArrayPos = typeName.find_first_of('[');
if (openArrayPos == std::string::npos)
return typeName;
const auto closeArrayPos = typeName.find_first_of(']', openArrayPos);
if (closeArrayPos == std::string::npos)
return typeName;
return typeName.substr(0, openArrayPos) + typeName.substr(closeArrayPos + 1);
}
return typeName; return typeName;
} }