forked from qt-creator/qt-creator
Clang: Fix highlighting lambda captures
This fixes the basic case, but e.g. captures with initializers, e.g. [foo=bar] are not properly reported by libclang and thus "bar" is still not highlighted for this case. Task-number: QTCREATORBUG-15271 Change-Id: I1a2d465f71b0ae1a0406ef9e77d88898e8637958 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -372,7 +372,8 @@ void TokenInfo::identifierKind(const Cursor &cursor, Recursion recursion)
|
|||||||
break;
|
break;
|
||||||
case CXCursor_ParmDecl:
|
case CXCursor_ParmDecl:
|
||||||
case CXCursor_VarDecl:
|
case CXCursor_VarDecl:
|
||||||
variableKind(cursor);
|
case CXCursor_VariableRef:
|
||||||
|
variableKind(cursor.referenced());
|
||||||
break;
|
break;
|
||||||
case CXCursor_DeclRefExpr:
|
case CXCursor_DeclRefExpr:
|
||||||
identifierKind(cursor.referenced(), Recursion::RecursivePass);
|
identifierKind(cursor.referenced(), Recursion::RecursivePass);
|
||||||
|
@@ -1697,6 +1697,13 @@ TEST_F(TokenProcessor, DISABLED_NonConstArgumentConstructor)
|
|||||||
ASSERT_THAT(infos[3], HasMixin(HighlightingType::OutputArgument));
|
ASSERT_THAT(infos[3], HasMixin(HighlightingType::OutputArgument));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(TokenProcessor, LambdaLocalVariableCapture)
|
||||||
|
{
|
||||||
|
const auto infos = translationUnit.tokenInfosInRange(sourceRange(442, 47));
|
||||||
|
|
||||||
|
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
|
}
|
||||||
|
|
||||||
Data *TokenProcessor::d;
|
Data *TokenProcessor::d;
|
||||||
|
|
||||||
void TokenProcessor::SetUpTestCase()
|
void TokenProcessor::SetUpTestCase()
|
||||||
|
Reference in New Issue
Block a user