aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-06-21 08:28:50 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-07-09 09:24:35 +0000
commit534aa02163f7782a792334aa14071fa041f1ff33 (patch)
tree108381d276e240665b6104ab87d53d588602b87a
parent91cbbd39ac97bd32b699a76e19a7f316855d2f4b (diff)
Clang: For definitions show their parent class qualification
Append methods and class members with the scope they belong to extracting the parent name. It was like that in old code model. Example: namespace Foo { void Bar::function() {} } Old result: Foo function() -> void New result: Foo Bar::function() -> void Change-Id: I9dad86a6738baafb1a210c5e1146d8de33828c44 Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/clangcodemodel/clangoverviewmodel.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/plugins/clangcodemodel/clangoverviewmodel.cpp b/src/plugins/clangcodemodel/clangoverviewmodel.cpp
index fc6dce919a..e663eec27a 100644
--- a/src/plugins/clangcodemodel/clangoverviewmodel.cpp
+++ b/src/plugins/clangcodemodel/clangoverviewmodel.cpp
@@ -96,6 +96,20 @@ static QString addType(const QString &name, const ClangBackEnd::ExtraInfo &extra
return name + QLatin1String(" -> ", 4) + extraInfo.typeSpelling.toString();
}
+static QString fullName(const ClangBackEnd::ExtraInfo &extraInfo, TokenTreeItem *parent)
+{
+ const QString parentType = parent->token.extraInfo.typeSpelling.toString();
+ if (extraInfo.semanticParentTypeSpelling.startsWith(parentType)) {
+ const QString parentQualification = parentType.isEmpty()
+ ? extraInfo.semanticParentTypeSpelling
+ : extraInfo.semanticParentTypeSpelling.mid(parentType.length() + 2);
+ if (!parentQualification.isEmpty())
+ return parentQualification + "::" + extraInfo.token.toString();
+ }
+
+ return extraInfo.token.toString();
+}
+
QVariant TokenTreeItem::data(int column, int role) const
{
Q_UNUSED(column)
@@ -109,7 +123,8 @@ QVariant TokenTreeItem::data(int column, int role) const
switch (role) {
case Qt::DisplayRole: {
- QString name = token.extraInfo.token.toString();
+ QString name = fullName(token.extraInfo, static_cast<TokenTreeItem *>(parent()));
+
ClangBackEnd::HighlightingType mainType = token.types.mainHighlightingType;
if (mainType == ClangBackEnd::HighlightingType::VirtualFunction