CppEditor: Make value vs const ref return type configurable

... in the quickfix settings.
Also change the default: With mandatory RVO and move semantics, value
return types are the right choice most of the time.

Fixes: QTCREATORBUG-25790
Change-Id: I68fc6c616358478ba893101b3e04aa6bbbe79348
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Christian Kandeler
2022-09-12 17:36:52 +02:00
parent 75e35cc4f2
commit 4119181762
7 changed files with 27 additions and 15 deletions

View File

@@ -2722,6 +2722,7 @@ void QuickfixTest::testGenerateGetterSetterValueTypes()
s->getterInCppFileFrom = 0;
s->getterNameTemplate = "get<Name>";
s->valueTypes << "Value";
s->returnByConstRef = true;
GenerateGetterSetter factory;
QuickFixOperationTest(testDocuments, &factory, ProjectExplorer::HeaderPaths(), operation);
@@ -3434,6 +3435,7 @@ public:
s->getterOutsideClassFrom = 0;
s->getterInCppFileFrom = 0;
s->getterNameTemplate = "get<Name>";
s->returnByConstRef = true;
GenerateGetterSetter factory;
QuickFixOperationTest(testDocuments, &factory, ProjectExplorer::HeaderPaths(), 1);
@@ -3615,6 +3617,7 @@ void QuickfixTest::testGenerateGettersSetters()
s->setterParameterNameTemplate = "value";
s->setterOutsideClassFrom = 1;
s->getterOutsideClassFrom = 1;
s->returnByConstRef = true;
TestFactory factory;
QuickFixOperationTest({CppTestDocument::create("file.h", original, expected)}, &factory);