CLion 2021.1 Help

Extract Function

Refactor | Extract | Method
Ctrl+Alt+M

In the C++ context, the title of the dialog is Extract Function. For more information, see Extract Function Refactoring.
ItemDescription
NameIn this field, specify the name of the function or method to be generated on the basis of the selected source code.
Declaration placeIn the drop down list, select a place to declare a new function (above or below).

Note: This option is available for global functions only.

Return typeIn this field, specify the return type of the new function.
Signature previewIn this read-only field, view the declaration of the new function.

Extract Function Parameters Pane

ItemDescription
TypeSpecify the type of the added parameter.
NameSpecify the name of the added parameter.
List of parametersContains the full parameters list of created function.

Toolbar

ItemShortcutDescription
Icons general addAlt+InsertClick this button to add a new parameter to the list.
Icons general removeAlt+DeleteClick this button to remove the selected parameter from the list.
Icons actions previous occurence or Icons actions next occurence  Alt+Up or Alt+DownUse these buttons to move the selected parameter up and down in the list.

The order of parameters in the list defines the order in which parameters appear in the function.

Last modified: 08 March 2021