CppEditor: Do not consider generated access specifiers

... when looking for places to insert class members.
Apparently, these can come from other translation units and thus have
invalid offsets.

Fixes: QTCREATORBUG-27063
Change-Id: Ia9a318284c0a8f4dd280315a5b47eac7ffd96a30
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2022-02-15 14:56:48 +01:00
parent 7fedb56c65
commit 3f0cf6d6ac

View File

@@ -177,6 +177,8 @@ QList<AccessRange> collectAccessRanges(const CPlusPlus::TranslationUnit *tu,
if (AccessDeclarationAST *xsDecl = decl->asAccessDeclaration()) {
const unsigned token = xsDecl->access_specifier_token;
if (tu->tokenAt(token).generated())
continue;
InsertionPointLocator::AccessSpec newXsSpec = initialXs;
bool isSlot = xsDecl->slots_token && tu->tokenKind(xsDecl->slots_token) == T_Q_SLOTS;