CLion constantly monitors your code for potential errors. If it finds anything, it highlights the suspicious piece of code in the editor. If you look in the right-hand editor gutter, you will see yellow and red error strips that, if clicked, navigate you to the detected issues. Another way to navigate from one highlighted issue to another is by pressing F2/Shift+F2. The status indicator at the top of the gutter summarizes the file status.
In addition to finding compilation errors, CLion identifies code inefficiencies and even performs data flow analysis over your code to locate unreachable/unused code, as well as other issues and 'code smells':
CLion’s on-the-fly code inspections cover about 40 potential problem cases in C/C++ code and quite a few for other languages as well.
When a problem is highlighted, place the caret on it, press Alt+Enter and choose from the suggested quick-fix solutions. (Alternatively, enter the context menu by clicking the light bulb next to the line.)
You can also choose to fix all similar issues across your project. Or, if you don’t find this inspection useful, you can suppress it for the desired scope:
CLion provides detailed descriptions for all of the available inspections. You can also manage their severity (choose from Typo, Warning, Error, etc.) or even in some cases adjust an inspection’s parameters to better reflect your requirements.
You can run multiple inspections (or even all of them) in this batch mode with
Code | Inspect Code.
If you’d like to eliminate a particular problem from your entire code base, you can use Run inspection by name (Ctrl+Alt+Shift+I) and select the desired scope. A separate window with inspection results will open in which you can regroup issues and batch-apply quick-fixes to all the issues, where possible: