forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user