Clang: Simplify name and type in FullTokenInfo for functions

Take Cursor displayName instead of token name.
From now on type spelling can serve the return type
role for functions because together with 'token' member
they form the full type.

Change-Id: Ic8eec533f4a11458f99f070b6a6aa80714097b4d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-04-19 14:59:22 +02:00
parent fccff5982f
commit ef660d8bd0
6 changed files with 10 additions and 32 deletions

View File

@@ -86,14 +86,7 @@ void buildTree(const TokenContainers &containers,
addFirstItem(root);
}
static QString addResultTypeToFunctionSignature(const QString &signature,
const ClangBackEnd::ExtraInfo &extraInfo)
{
return signature + extraInfo.typeSpelling.toString() + QLatin1String(" -> ", 4)
+ extraInfo.resultTypeSpelling.toString();
}
static QString addTypeToVariableName(const QString &name, const ClangBackEnd::ExtraInfo &extraInfo)
static QString addType(const QString &name, const ClangBackEnd::ExtraInfo &extraInfo)
{
return name + QLatin1String(" -> ", 4) + extraInfo.typeSpelling.toString();
}
@@ -116,11 +109,11 @@ QVariant TokenTreeItem::data(int column, int role) const
if (mainType == ClangBackEnd::HighlightingType::VirtualFunction
|| mainType == ClangBackEnd::HighlightingType::Function) {
name = addResultTypeToFunctionSignature(name, token.extraInfo);
name = addType(name, token.extraInfo);
} else if (mainType == ClangBackEnd::HighlightingType::GlobalVariable
|| mainType == ClangBackEnd::HighlightingType::Field
|| mainType == ClangBackEnd::HighlightingType::QtProperty) {
name = addTypeToVariableName(name, token.extraInfo);
name = addType(name, token.extraInfo);
if (token.types.mixinHighlightingTypes.contains(
ClangBackEnd::HighlightingType::ObjectiveCProperty)) {
name = QLatin1String("@property ") + name;