forked from qt-creator/qt-creator
ClangCodeModel: Do not offer completion for inaccessible symbols
We should not offer to auto-complete e.g. private members from contexts where they cannot legally be accessed. This is also consistent with the existing behavior of not offering non-const members on const objects. Fixes: QTCREATORBUG-1984 Change-Id: Ic58c1ba2dc0b8023299feebc20bec4f2a5a6ea38 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -552,6 +552,30 @@ void ClangCodeCompletionTest::testCompleteMembers()
|
||||
QVERIFY(!hasSnippet(t.proposal, "class")); // Snippet
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteMembersFromInside()
|
||||
{
|
||||
ProjectLessCompletionTest t("membercompletion-inside.cpp");
|
||||
|
||||
QVERIFY(hasItem(t.proposal, "publicFunc"));
|
||||
QVERIFY(hasItem(t.proposal, "privateFunc"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteMembersFromOutside()
|
||||
{
|
||||
ProjectLessCompletionTest t("membercompletion-outside.cpp");
|
||||
|
||||
QVERIFY(hasItem(t.proposal, "publicFunc"));
|
||||
QVERIFY(!hasItem(t.proposal, "privateFunc"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteMembersFromFriend()
|
||||
{
|
||||
ProjectLessCompletionTest t("membercompletion-friend.cpp");
|
||||
|
||||
QVERIFY(hasItem(t.proposal, "publicFunc"));
|
||||
QVERIFY(hasItem(t.proposal, "privateFunc"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteFunctions()
|
||||
{
|
||||
ProjectLessCompletionTest t("functionCompletion.cpp");
|
||||
|
||||
Reference in New Issue
Block a user