forked from qt-creator/qt-creator
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:
@@ -3881,7 +3881,7 @@ void GetterSetterRefactoringHelper::performGeneration(ExistingGetterSetterData d
|
||||
}
|
||||
const FullySpecifiedType returnTypeHeader = [&] {
|
||||
if (!getSetTemplate.returnTypeTemplate.has_value())
|
||||
return parameterType;
|
||||
return m_settings->returnByConstRef ? parameterType : memberVariableType;
|
||||
QString typeTemplate = getSetTemplate.returnTypeTemplate.value();
|
||||
if (returnTypeTemplateParameter.has_value())
|
||||
typeTemplate.replace(Pattern::TEMPLATE_PARAMETER_PATTERN,
|
||||
@@ -3947,7 +3947,7 @@ void GetterSetterRefactoringHelper::performGeneration(ExistingGetterSetterData d
|
||||
data.clazz,
|
||||
targetFile,
|
||||
targetLoc);
|
||||
if (!isValueType)
|
||||
if (m_settings->returnByConstRef && !isValueType)
|
||||
return makeConstRef(returnType);
|
||||
return returnType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user