CLion 2019.3 EAP: Code Coverage and CMake Defaults
A new CLion 2019.3 EAP (build 193.4932.12) is now available! Get it from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu). A patch-update for anyone using the previous EAP build will be available shortly.
Code coverage in CLion relies on llvm-cov/gcov integration to perform and show you statements coverage measuring for your code. In general, statements coverage answers the question, "Was this statement executed during the configuration run?". The configuration can be either a unit tests run or a regular configuration run.
How to launch a configuration with coverage?
To get coverage measurement, you have to pass special coverage compile options. There are a few options depending on what compiler you use and what kind of results you expect:
-fprofile-arcs -ftest-coverageor an equivalent
--coverage– for GCC (uses
gcov) and Clang (uses
llvm-cov gcov, gcov-style coverage, which means it will compatible with the gcov tool from version 4.2 of GCC)
-fprofile-instr-generate -fcoverage-mapping– for Clang (uses
llvm-profdata merge / llvm-cov export, a clang’s instrumentation based profiling).
How to read the results
When rerunning the coverage analysis, CLion will ask you how you’d like the results presented:
- Add to active suites – to enrich the current results.
- Replace active suites – to start from scratch.
- Do not apply collected coverage data – to simply ignore the current results.
Click the gutter area to see how many times the line was hit.
Configuration and known issue
A few important known issues are worth mentioning:
- Code coverage doesn’t work with Ninja generator (CPP-17864). We’ll do our best to address this issue before the release.
- Code Coverage is not supported for the remote toolchain (CPP-17709).
- Generate Coverage Report – an action you may be familiar with if you use IntelliJ IDEA – is not available yet (CPP-17710).
Other bugs and requests are linked to the parent ticket, CPP-9678. Please try the EAP build with code coverage support and share your feedback with us!
If you have to work with a lot of new projects in CLion, you may want to simplify the process of configuring CMake Profiles, for example by configuring a common pattern for the CMake generation folder.
You can set the default:
- Generator used in CMake
- Options passed to CMake
- Build type
- Generation path
- Build options
When a new project is started, these default CMake Profiles will be used. Note that currently, this doesn’t apply when File | New CMake Project from Sources is used (CPP-17686).
That’s it for today! The full release notes are available here.
Your CLion Team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
CLion 2023.3 Release Candidate
CLion 2023.3 is on its way, and the release candidate for v2023.3 is already available! To install CLion 2023.3 RC (build 233.11799.171), download it from the website, update via the Toolbox App, or use this snap package (for Ubuntu). You need an active subscription or a trial license to use CLi…
CLion Nova: A New Update With Various Bug Fixes
CLion Nova, a free preview of CLion with the ReSharper C++/Rider C++ language engine, was announced recently. We’re excited to see how well you liked the first build! There are about 3,700 users right now and the overall feedback is mostly positive, especially that which is related to performance an…
CLion 2023.3 Goes Beta
The Beta version of CLion Classic 2023.3 is now available with key improvements and changes that are expected in the upcoming release. Download build 233.11799.37 from our website, via the Toolbox App, or as a snap package for Ubuntu. If you are using CLion Nova, note that we do not plan to release…
CLion Nova Explodes onto the C and C++ Development Scene
TL;DR Today, we’re announcing a free early preview of CLion, which uses the ReSharper C++/Rider C++ language engine instead of the CLion "legacy" engine. The Preview build is available via our dedicated Toolbox App feed. At some point in 2024, depending on the results of the feedback coll…