CLion 2023.1 Help

Fix problems

By default, CLion analyses the code in all open files and highlights the detected code issues. You can fix most of the issues immediately by applying quick-fixes.

Place the caret at the highlighted piece of code and press Alt+Enter:

Applying a quick-fix in the editor

You can also hover the mouse over the highlighted element and apply a quick-fix from the inspection popup:

Applying a quick-fix in the editor

For some inspections, you can open a preview by pressing Control+Shift+I.

If you perform code analysis or execute a single inspection in a larger scope of source files, CLion displays the detected code issues in the Problems tool window. When you select a specific issue in this window, its report is shown in the right part of the window.

Apply quick-fixes from inspection results

In the Problems tool window, select the issue and do one of the following:

  • If CLion suggests any fixes to the issue as described above, you can use one of them to fix the problem immediately:

    Quick-fixes for inspection results

    You can also batch-apply quick fixes for several issues at a time. Click Fix partially in the results description tab:

    Applying quick-fixes to several inspection results

    Alternatively, you can select several issues and choose a proper quick-fix from the context menu.

  • If no resolutions are suggested, use the Jump to source command in the context menu and fix the problem manually.

Export results

After you run inspections, results are displayed on a dedicated tab of the Problems tool window. You can export them to one of the available formats.

  1. In the Problems tool window (View | Tool Windows | Problems or Alt+6), switch to the tab that contains the inspection results that you want to export and click the Export button.

    The Export button in the Inspection Results tool window
  2. Select the format in which you want to save the report: HTML, Sarif (JSON file formatted according to the SARIF specification), or XML.

  3. Specify the target directory and click Save.

Last modified: 28 April 2023