Clang: Fix access specifier for variables

Static members have a variable declaration kind so
we need to check their access specifiers in order to
provide proper information about tokens.

Fixes: QTCREATORBUG-22082
Change-Id: If455174bd346398a2df3499fa6cf1ea2b4e26965
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-03-12 13:55:51 +01:00
parent a78bbe48cc
commit 1b0cba38dd
3 changed files with 28 additions and 0 deletions

View File

@@ -1704,6 +1704,24 @@ TEST_F(TokenProcessor, LambdaLocalVariableCapture)
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::LocalVariable));
}
TEST_F(TokenProcessor, StaticProtectedMember)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRange(693, 31));
ClangBackEnd::TokenInfoContainer container(infos[2]);
ASSERT_THAT(container.extraInfo.accessSpecifier, ClangBackEnd::AccessSpecifier::Protected);
}
TEST_F(TokenProcessor, StaticPrivateMember)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRange(696, 29));
ClangBackEnd::TokenInfoContainer container(infos[2]);
ASSERT_THAT(container.extraInfo.accessSpecifier, ClangBackEnd::AccessSpecifier::Private);
}
Data *TokenProcessor::d;
void TokenProcessor::SetUpTestCase()