CLion 2022.2 EAP2: Interval Analysis

Early Access Program

A new CLion 2022.2 EAP2, 222.2680.4, is available from our website via the Toolbox App or as a snap package (if you are using Ubuntu). If you are on macOS, there is a separate build for Apple Silicon (M1 chip). Those who are already using EAP1 can apply a patch to update to EAP2.


Interval Analysis in DFA

As we shared in the roadmap, we are working on enhancing the accuracy of CLion’s Data Flow Analysis with interval analysis. The main idea is for every integral variable to calculate the upper and lower bounds of the possible values, and then use this information in the data flow analysis.

This analysis enables support for comparisons (<, >, <=, >=) of integral types to help with assumptions like unreachable code, constant conditions, and others. Now Data Flow Analysis in CLion can capture cases like the following:
Condition is always true check

On top of interval analysis, we’ve also built the Array index is out of bounds check. It reports array or pointer variable access expressions where the index may be out of bounds of an array or allocated buffer. You can find it in the Inspection settings:
Index out of bounds inspection

This check works in various cases, including regular fix-sized arrays, arrays with size initialized by the sizeof() function, or std::array with a given size:
Bounds in the array

It also works for C-string and C++ std::string:
String bounds

Other Fixes

  • CUDA:
    • In the debugger, stepping out from CUDA calls now works (CPP-28489).
    • Compilation database projects with CUDA can now be opened in CLion (CPP-25075).
  • Code completion:
    • CLion no longer suggests consteval functions in postfix completion for runtime executed functions (CPP-28781).
    • Code completion and other code assistance actions now work for generic lambda parameters (CPP-28921).

The full release notes are available here. Interested in what’s coming next? Check out our roadmap announcement!


Your CLion team
The Drive to Develop