forked from qt-creator/qt-creator
Remove the inline keyword when moving implementation to cpp
Since the implementation has been moved to the cpp file, then the inline keyword has to be removed otherwise it will cause a build error. Change-Id: I145bbaeb02674bd68501f1a41787bd4aa2a75f53 Fixes: QTCREATORBUG-20703 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -194,6 +194,8 @@ private slots:
|
||||
void test_quickfix_MoveFuncDefOutside_macroUses();
|
||||
void test_quickfix_MoveFuncDefOutside_template();
|
||||
void test_quickfix_MoveFuncDefOutside_unnamedTemplate();
|
||||
void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_Static();
|
||||
void test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_WithInlinePartOfName();
|
||||
|
||||
void test_quickfix_MoveAllFuncDefOutside_MemberFuncToCpp();
|
||||
void test_quickfix_MoveAllFuncDefOutside_MemberFuncOutside();
|
||||
|
@@ -5897,7 +5897,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCpp()
|
||||
"};\n";
|
||||
expected =
|
||||
"class Foo {\n"
|
||||
" inline int number() const;\n"
|
||||
" int number() const;\n"
|
||||
"\n"
|
||||
" void bar();\n"
|
||||
"};\n";
|
||||
@@ -5920,6 +5920,86 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCpp()
|
||||
QuickFixOperationTest(testDocuments, &factory);
|
||||
}
|
||||
|
||||
void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_Static()
|
||||
{
|
||||
QList<QuickFixTestDocument::Ptr> testDocuments;
|
||||
QByteArray original;
|
||||
QByteArray expected;
|
||||
|
||||
// Header File
|
||||
original =
|
||||
"class Foo {\n"
|
||||
" static inline int numbe@r() const\n"
|
||||
" {\n"
|
||||
" return 5;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" void bar();\n"
|
||||
"};\n";
|
||||
expected =
|
||||
"class Foo {\n"
|
||||
" static int number() const;\n"
|
||||
"\n"
|
||||
" void bar();\n"
|
||||
"};\n";
|
||||
testDocuments << QuickFixTestDocument::create("file.h", original, expected);
|
||||
|
||||
// Source File
|
||||
original =
|
||||
"#include \"file.h\"\n";
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"int Foo::number() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
"}\n";
|
||||
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
|
||||
|
||||
MoveFuncDefOutside factory;
|
||||
QuickFixOperationTest(testDocuments, &factory);
|
||||
}
|
||||
|
||||
void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCpp_WithInlinePartOfName()
|
||||
{
|
||||
QList<QuickFixTestDocument::Ptr> testDocuments;
|
||||
QByteArray original;
|
||||
QByteArray expected;
|
||||
|
||||
// Header File
|
||||
original =
|
||||
"class Foo {\n"
|
||||
" static inline int numbe@r_inline () const\n"
|
||||
" {\n"
|
||||
" return 5;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" void bar();\n"
|
||||
"};\n";
|
||||
expected =
|
||||
"class Foo {\n"
|
||||
" static int number_inline () const;\n"
|
||||
"\n"
|
||||
" void bar();\n"
|
||||
"};\n";
|
||||
testDocuments << QuickFixTestDocument::create("file.h", original, expected);
|
||||
|
||||
// Source File
|
||||
original =
|
||||
"#include \"file.h\"\n";
|
||||
expected =
|
||||
"#include \"file.h\"\n"
|
||||
"\n"
|
||||
"int Foo::number_inline() const\n"
|
||||
"{\n"
|
||||
" return 5;\n"
|
||||
"}\n";
|
||||
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
|
||||
|
||||
MoveFuncDefOutside factory;
|
||||
QuickFixOperationTest(testDocuments, &factory);
|
||||
}
|
||||
|
||||
void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppInsideNS()
|
||||
{
|
||||
QList<QuickFixTestDocument::Ptr> testDocuments;
|
||||
@@ -5984,7 +6064,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncOutside1()
|
||||
QByteArray expected =
|
||||
"class Foo {\n"
|
||||
" void f1();\n"
|
||||
" inline int f2@() const;\n"
|
||||
" int f2@() const;\n"
|
||||
" void f3();\n"
|
||||
" void f4();\n"
|
||||
"};\n"
|
||||
@@ -6062,7 +6142,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppNS()
|
||||
expected =
|
||||
"namespace MyNs {\n"
|
||||
"class Foo {\n"
|
||||
" inline int number() const;\n"
|
||||
" int number() const;\n"
|
||||
"};\n"
|
||||
"}\n";
|
||||
testDocuments << QuickFixTestDocument::create("file.h", original, expected);
|
||||
@@ -6103,7 +6183,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppNSUsing()
|
||||
expected =
|
||||
"namespace MyNs {\n"
|
||||
"class Foo {\n"
|
||||
" inline int number() const;\n"
|
||||
" int number() const;\n"
|
||||
"};\n"
|
||||
"}\n";
|
||||
testDocuments << QuickFixTestDocument::create("file.h", original, expected);
|
||||
@@ -6140,7 +6220,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncOutsideWithNs()
|
||||
QByteArray expected =
|
||||
"namespace MyNs {\n"
|
||||
"class Foo {\n"
|
||||
" inline int number() const;\n"
|
||||
" int number() const;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"int Foo::number() const\n"
|
||||
|
@@ -6262,6 +6262,10 @@ public:
|
||||
} else {
|
||||
QString textFuncDecl = m_fromFile->textOf(funcAST);
|
||||
textFuncDecl.truncate(startPosition - m_fromFile->startOf(funcAST));
|
||||
if (textFuncDecl.left(7) == QLatin1String("inline "))
|
||||
textFuncDecl = textFuncDecl.mid(7);
|
||||
else
|
||||
textFuncDecl.replace(" inline ", QLatin1String(" "));
|
||||
textFuncDecl = textFuncDecl.trimmed() + QLatin1Char(';');
|
||||
m_fromFileChangeSet.replace(m_fromFile->range(funcAST), textFuncDecl);
|
||||
}
|
||||
|
Reference in New Issue
Block a user