Clang: introduce more data in TokenInfo

Data added:
- return type spelling for functions
- parent spelling
- access specifier for class fields and methods
- storage class

New highlighting types are added, therefore
types are now categorized by class, struct, etc.

Change-Id: I1739b94a6f777045fde655060d8b9a12b6e0889b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-01-12 09:44:05 +01:00
parent 730a8186af
commit bdd5066665
17 changed files with 449 additions and 72 deletions

View File

@@ -78,9 +78,30 @@ TextEditor::TextStyle toTextStyle(ClangBackEnd::HighlightingType type)
case HighlightingType::Invalid:
QTC_CHECK(false); // never called
return TextEditor::C_TEXT;
default:
break;
}
Q_UNREACHABLE();
}
bool ignore(ClangBackEnd::HighlightingType type)
{
using ClangBackEnd::HighlightingType;
switch (type) {
default:
break;
case HighlightingType::Namespace:
case HighlightingType::Class:
case HighlightingType::Struct:
case HighlightingType::Enum:
case HighlightingType::Union:
case HighlightingType::TypeAlias:
case HighlightingType::Typedef:
return true;
}
Q_UNREACHABLE();
return false;
}
TextEditor::TextStyles toTextStyles(ClangBackEnd::HighlightingTypes types)
@@ -90,8 +111,10 @@ TextEditor::TextStyles toTextStyles(ClangBackEnd::HighlightingTypes types)
textStyles.mainStyle = toTextStyle(types.mainHighlightingType);
for (ClangBackEnd::HighlightingType type : types.mixinHighlightingTypes)
textStyles.mixinStyles.push_back(toTextStyle(type));
for (ClangBackEnd::HighlightingType type : types.mixinHighlightingTypes) {
if (!ignore(type))
textStyles.mixinStyles.push_back(toTextStyle(type));
}
return textStyles;
}