Please give a warm welcome to CLion 2017.1!
Our first big update this year includes:
- Extended support for C++14 (in brief, all except constexpr are there!)
- First step towards C++17 support (nested namespaces!)
- First step to modernizing your C++ code: make auto intention
- Support for precompiled headers and headers included via -include compile option
- Disassembly view in debugger (GDB)
- Support for the Catch unit test framework
- Experimental support for Microsoft Visual C++ compiler
- Find in Path in popup
- Enhanced Log viewer and branches popup
- Swift plugin: SourceKit inspections and ability to generate type from usage
Modern C++ standards
As C++17 has already been approved, we’ve sped up to support the latest C++ standards. The following features of C++14 are recognized in v2017.1:
- auto return type,
- generic lambdas,
- variable templates, and
- generalized lambda captures.
Support for these language features includes correct highlighting and no false-positives in code analysis, as well as correct code completion, navigation and refactorings. For example, earlier you couldn’t get the code completion in the case below as CLion was not able to correctly infer the type of
Now this works fine in CLion.
This means that only constexpr is actually missing from C++14. As for C++17, we’ve started with the most upvoted feature, nested namespaces.
There are dozens of fixes for incorrect code resolve and thus no more false code analysis and other related issues. Check out the build to see if CLion got better for you!
Support for C++11 and C++14 will be polished in 2017.1.x and 2017.2 releases, and hopefully we’ll be able to devote more time to C++17.
While working on modern C++ standards, developers see how new language features can help make their code more accurate and readable. What if an IDE could assist you with the task of modernizing your code? Sounds good, doesn’t it?
The first step we’ve taken in this direction is to add a ‘convert variable type to auto’ intention in CLion 2017.1. Just put the caret on the type or variable name, and invoke the available intentions list with
Be careful – keep the code modern, but self-documented. The best general cases to convert variable type to auto are iterators, type casts and new-expressions.
Precompiled headers and more
Precompiled headers and the -include compiler option is a way to reduce compilation time and keep large-scale codebases structured and clear. When using this, you simply compile expensive includes once and then guide the compiler to reuse that information.
CLion 2017.1 correctly resolves symbols from such headers, suggests code completion, navigate to the declarations and definitions.
The debugger in CLion 2017.1 received several important bug fixes and a workaround for the GDB timeout issue (which unfortunately still happens to some CLion users).
However, the most important and long-awaited change is the disassembly view in the debugger. When the sources are unavailable, you still can step into and view the disassembly code. Step through it to investigate the issue in your program deeper or to understand what’s happening inside a library call.
For now this only works for GDB. For more about the limitations and known issues, see this.
Besides, if you just open a .s or .asm file in CLion (or other extensions, if you add them to
Settings | Editor | File Types | Assembly Language) which uses the AT&T dialect and no preprocessor, it will be appropriately highlighted in the editor.
There are lots of unit test frameworks for C++: Google Test, Boost, CppUnit, CppTest and many more. Catch is one that’s known for its easy starting process (just include a simple header) and convenient and flexible test cases.
CLion has had Google Test support for a while, and now we’ve introduced Catch support. It includes a built-in test runner that allows you to view the test results and sort them by duration, rerun failed tests, export test results, navigate instantly to the source code, etc.
The special Catch Run/Debug configuration is flexible enough to run any preferred set of tests within CLion. For your convenience, it provides you with completion of Catch tags and wildcard-based matching templates to speed up configuration.
To learn more about Catch and how it’s supported in CLion, read this detailed blog post.
Microsoft Visual C++ compiler
One more feature that many of our users have requested is support for Microsoft Visual C++ compiler.
There are three important things you need to know if you’d like to try it in CLion:
- Use the Registry option clion.enable.msvc to enable this support (in Find Action dialog (
⇧⌘Aon macOS) type Registry; open Registry, type clion.enable.msvc to search for the settings and turn it on).
- CLion supports Microsoft Visual C++ compiler that ships with Visual Studio 2013, 2015 and 2017.
- There’s no support for msbuild. CLion works through CMake with the NMake generator. Besides, debugger is not yet supported.
CLion auto-detects the Visual Studio versions installed on your machine; provides settings to configure the Microsoft Visual C++ compiler path, architecture and platform; and finally runs Microsoft Visual C++ compiler to compile your program. It also helps with navigation through the compiler errors in the Messages Build tool window.
It’s important to understand that this support is currently experimental, meaning there are known issues, the biggest being that there’s no support yet for specific Microsoft C++ language extensions. We will continue to work on it within the 2017.2 EAP.
Find in Path
In CLion it’s possible to search for text across the whole project or any selected scope, with the Find in Path dialog (
Shift+Ctrl+F on Linux/Windows,
⇧⌘F on macOS). Now it has a popup window with immediate preview, though you can still open a separate Find Window if you wish:
VCS: enhanced log view and branches popup
CLion 2017.1 enhances its Log View, making search easier with regular expressions and the ability to match/ignore case.
If you have lots of branches in your project and are afraid of getting lost in them, mark the most important ones as Favorites. The redesigned branches popup then allows you to filter them and view only the favorites.
Swift and other plugins
- Create new project wizard provides ability to create Swift projects
- SourceKit-based inspections and intentions are available in the plugin
- Generate type and initializers from usage
That’s it! Explore all the new features in more detail on our website and watch this overview video:
To play with the new features, check our special repository that we maintain in order to illustrate changes in CLion 2017.1 in a very code-centric way.
Start your 30-day free evaluation and check all the new features and fixes.
Your CLion Team
The Drive to Develop