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:
@@ -132,6 +132,12 @@ static QList<AssistProposalItemInterface *> toAssistProposalItems(
|
||||
if (codeCompletion.text.isEmpty())
|
||||
continue; // It's an OverloadCandidate which has text but no typedText.
|
||||
|
||||
// Don't offer symbols that are not accessible here.
|
||||
if (codeCompletion.availability == CodeCompletion::NotAvailable
|
||||
|| codeCompletion.availability == CodeCompletion::NotAccessible) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString name = codeCompletion.completionKind == CodeCompletion::KeywordCompletionKind
|
||||
? CompletionChunksToTextConverter::convertToName(codeCompletion.chunks)
|
||||
: codeCompletion.text.toString();
|
||||
|
||||
Reference in New Issue
Block a user