CLion 2016.3 Help

Change Signature

In this section:

Basics

The Change Signature refactoring combines several different modifications that can be applied to a function signature. You can use this refactoring for the following purposes:

  • To change the function name.
  • To change the function return type.
  • To add new parameters and remove the existing ones.
  • To 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.

Example

The following table shows one of the possible ways of performing the Change Signature refactoring.

BeforeAfter
/help/img/idea/2016.3/cl_changeSignatureBefore.png
/help/img/idea/2016.3/cl_changeSignatureAfter.png

Changing a function signature

  1. In the editor, place the cursor within the name of the function whose signature you want to change.
  2. Do one of the following:
    • Press Ctrl+F6.
    • Choose Refactor | Change Signature on the main menu or context menu .
  3. In the Change Signature dialog, make the necessary changes to the function signature and specify what other, related, changes are required.

    You can:

    • Change the function name. To do that, edit the text in the Name field.
    • Manage the function parameters using the table and the buttons in the Parameters area:
      • To add a new parameter, click /help/img/idea/2016.3/new.png and specify the properties of the new parameter in the corresponding table row.
      • To remove a parameter, click any of the cells in the corresponding row and click /help/img/idea/2016.3/delete.png.
      • To reorder the parameters, use the /help/img/idea/2016.3/arrowUp.png and /help/img/idea/2016.3/arrowDown.png buttons. For example, if you wanted to put a certain parameter first in the list, click any of the cells in the row corresponding to that parameter, and then click /help/img/idea/2016.3/arrowUp.png the required number of times.
  4. To perform the refactoring right away, click Refactor.

    To see the expected changes and make the necessary adjustments prior to actually performing the refactoring, click Preview.

    /help/img/idea/2016.3/cl_changeSignatureDialog.png

See Also

Last modified: 29 March 2017