CppEditor: Do not add redundant access specifier

... when inserting a member function declaration for a definition.

Fixes: QTCREATORBUG-5591
Change-Id: Ie85b435a1595832d0085abdcc0a4187d939820e0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-02-05 13:12:41 +01:00
parent 8cd9300eda
commit 33d2d736ea
4 changed files with 36 additions and 19 deletions

View File

@@ -4707,6 +4707,9 @@ void insertToSectionDeclFromDef(const QByteArray &section, int sectionIndex)
QByteArray original;
QByteArray expected;
QByteArray sectionString = section + ":\n";
if (sectionIndex == 4)
sectionString.clear();
// Header File
original =
@@ -4716,7 +4719,7 @@ void insertToSectionDeclFromDef(const QByteArray &section, int sectionIndex)
expected =
"class Foo\n"
"{\n"
+ section + ":\n" +
+ sectionString +
" Foo();\n"
"@};\n";
testDocuments << QuickFixTestDocument::create("file.h", original, expected);