Change signature
Refactor | Change signature
CtrlF6
Shortcut: CtrlF6
Refactoring settings: Settings | Editor | General
refactoring is available
The Change Signature refactoring combines several different modifications that can be applied to a function signature. You can use this refactoring to:
change the function name and return type
add, remove, and reorder parameters
When changing a function signature, CLion searches for all usages of the function and updates all the calls, implementations, and override replacements of the function that can be safely modified to reflect the change.
Click the
return
value that is highlighted in red color.Press AltEnter and select Create parameter '<parameter_name>'.
In the Change Signature dialog, adjust parameter settings or accept suggested settings.
Click Refactor.
Place the caret at the function you want to refactor.
Press CtrlF6 or select Refactor | Change Signature from the main menu or the context menu.
In the Change Signature dialog, make the necessary changes to the function signature.
Change the function name in the Name field.
Change the function return type in the Return type field.
Manage the function parameters using the table and the
/
/
/
buttons.
When adding a parameter, specify the new parameter's properties in the corresponding row: Type, Name, and Default value.
The Default value field sets the type value to be used as an argument to the usages. If you leave this field empty, CLion will use the default type value (for example,
0
for numerical andnullptr
for pointers).note
Completion is available in the Type and Default value fields.
You can also make a function
const
,constexpr
, ornoexcept
using the corresponding checkboxes.
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Thanks for your feedback!