ClangCodeModel: Fix template highlighting bug

We need to take into account that the ">>" in constructs such as
std::vector<std::pair<int, int>> is only one token on the clang side.

Change-Id: I90f002ca56f236032f6d39c338593a2ff7590061
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-04-15 13:54:02 +02:00
parent 8e8236e9e0
commit c80c724b52
8 changed files with 30 additions and 7 deletions

View File

@@ -597,14 +597,17 @@ void TokenInfo::punctuationOrOperatorKind()
break;
}
if (m_types.mixinHighlightingTypes.empty()
&& kind != CXCursor_InclusionDirective
&& kind != CXCursor_PreprocessingDirective) {
if (m_types.mainHighlightingType == HighlightingType::Punctuation
&& m_types.mixinHighlightingTypes.empty()
&& kind != CXCursor_InclusionDirective
&& kind != CXCursor_PreprocessingDirective) {
const ClangString spelling = m_token->spelling();
if (spelling == "<")
m_types.mixinHighlightingTypes.push_back(HighlightingType::AngleBracketOpen);
else if (spelling == ">")
m_types.mixinHighlightingTypes.push_back(HighlightingType::AngleBracketClose);
else if (spelling == ">>")
m_types.mixinHighlightingTypes.push_back(HighlightingType::DoubleAngleBracketClose);
}
if (isOutputArgument())