CLion 2022.2 EAP2: Interval Analysis
News
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:
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:
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:
It also works for C-string and C++ std::string
:
Other Fixes
- CUDA:
- Code completion:
The full release notes are available here. Interested in what’s coming next? Check out our roadmap announcement!
Your CLion team
JetBrains
The Drive to Develop