CLion 2017.1 EAP: precompiled headers and -include

Posted on by Anastasia Kazakova

Hi,

CLion 2017.1 EAP builds were mainly focused on C++14 features support and various code analysis improvements, as well as zero latency typing mode (that seems to improve the editor performance in many cases). Today we are happy to announce new EAP build, 171.3019.8.


Download CLion 2017.1 EAP

C++14: Variable templates and generalized lambda captures

We are moving forward with C++14 support in CLion and today we are glad to announce that variable templates (CPP-6419) and generalized lambda captures (CPP-4545) are now supported in CLion. That means that the only thing left from C++14 is constexpr.

Precompiled headers and -include support

To reduce compilation time and keep the code well-structured, especially on a large-scale code bases, precompiled headers and -include compiler option can be used. They guide the compiler to reuse the information about expensive includes (like many header files included everywhere).
In this case the IDE has to understand where to locate the precompiled headers and headers included via -include option, in order to correctly resolve symbols from such files and provide correct code highlighting, code generation and navigation, refactorings, etc.
The work on this feature in CLion has started in this EAP build:
pch

Current limitations

In case of GCC, it’s impossible to get original PCH filename using preprocessor options like -E, -fpch-preprocess. Thus for CLion to resolve symbols from the precompiled headers correctly, you need to compiler PCH with dependency tracking enabled (with option like -MD or -MMD).

Alternatively, you can put the original file near the PCH. (CPP-8729).

Other fixes

This build also addresses a problem with TArray widely used in Unreal Engine 4 projects – no more incorrect ‘not a valid range type’ warning there.

The full release notes are available here.

The CLion Team
JetBrains
The Drive to Develop

Comments below can no longer be edited.

11 Responses to CLion 2017.1 EAP: precompiled headers and -include

  1. Signer says:

    February 14, 2017

    C++14 support is really appreciated. Now that variable templates are supported, it would be very nice to have formatting options for them (and for alias templates too).

    • Anastasia Kazakova says:

      February 14, 2017

      What exact parameters do you expect?

      • Signer says:

        February 15, 2017

        The same as for function and class templates: wrapping after “template” part of declaration.

        • Anastasia Kazakova says:

          February 16, 2017

          We agree that is important. We’ve created a corresponding issue where you can track the progress or leave comments: https://youtrack.jetbrains.com/issue/CPP-8941

          • Signer says:

            February 16, 2017

            Thank you!

          • Andrew says:

            March 29, 2017

            I would think that any kind of formatting you want would be supported if you integrated clang format, which I think is possible in clion?

  2. Andrew says:

    March 30, 2017

    Oh, I was confused and thinking about one of the existing plug-ins for clion that supports clang-format, I know that exists.

    • Anastasia Kazakova says:

      March 30, 2017

      Do you mean this https://plugins.jetbrains.com/plugin/8396-clangformatij? This is a 3rd party plugin, so we don’t have much information about it. But it doesn’t have deep integration into CLion, just an external executor for the command.

  3. sancelot says:

    June 28, 2018

    We have really big scale projects in which this feature will be needed.
    But really lacks of good documentation. This page is interesting but not enough complete,
    regarding gcc usage . I understand I shouyld use MD flags, where …?

Subscribe

Subscribe for updates