On this page:
To make sure that deletion is safe, CLion looks for the usages of the file being deleted. If such usages are found, you can explore them and make the necessary corrections in your code before the symbol is actually deleted.
Performing the refactoring
- Select the item to be deleted.
- Do one of the following:
- In the Safe Delete dialog, select the necessary options and click OK.
If the refactoring is potentially unsafe,
the Usages Detected dialog opens.
- View Usages. Click this button to see where in your code the item you are
about to delete is used. As a result, the Find tool window opens.
Analyze your code and make the necessary corrections. Then click Do Refactor. (If you want to rerun the refactoring from its start, click Rerun Safe Delete. CLion will check if the refactoring is safe once more.)
- Delete Anyway. Click this button to delete the item without looking at its usages.
- View Usages. Click this button to see where in your code the item you are about to delete is used. As a result, the Find tool window opens.
Safe Delete for File and CMakeWhen deleting files, in case these files are referenced as the arguments of the particular CMake commands, Safe Delete is performed. Upon deleting, the IDE performs the automatic CMake reload, if the autoreload feature is enabled.
- In case the file you are going to delete is the only argument of some CMake command (for example
add_executable(foobar foo.cpp)), this command may become incorrect after deletion.
- The described behaviour is supported for the following list of CMake commands: