Change signature
Last modified: 11 January 2023Shortcut for the action: Ctrl+F6
General 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.
Change a function signature
Place the caret at the function you want to refactor.
Press Ctrl+F6 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).Gifnote
Completion is available in the Type and Default value fields.
Examples
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Before | After |
---|---|
|
|
Change signature dialog
The Change Signature refactoring combines modifications that can be applied to a function signature: changing the function name or return type, adding/removing/reordering the parameters.
Item | Description |
---|---|
Name | Name of a function, method, or a method specification. |
Parameters | List of parameters in the signature. In the Parameters field, you can perform the following actions with parameters:
|
Thanks for your feedback!