CLion 2021.3 Help

C++ support

CLion incorporates two language engines, the built-in one and the Clangd-based one, both working in parallel.

The Clangd-based engine detects warnings and errors to be shown in the editor and provides quick-fixes, performs certain navigation actions, highlighting, and completion, while CLion's own engine is used for other code insight features like refactorings. You can adjust the scope of Clangd functionality in Clangd settings.

The following table shows how the two engines handle CLion features by default:

IDE feature

Language engine

Syntax highlighting

Clangd

Errors/warnings and quick-fixes

Clangd

Completion

Clangd only, both, or built-in only*

Formatting: ClangFormat

Clangd

Formatting: Code Style settings

Built-in engine

Navigation

Both **

Parameter hints

Clangd

Refactorings

Built-in engine

* - As selected in Clangd settings.

** - Both engines are used. Clangd helps with highlighting references at caret, Go to declaration, Go to definition, Quick documentation, Quick definition, Find Usages.

Language standards compliance

CLion fully supports C++11, C++14, C++17, and partially C++20.

Support for C++11 and C++14 is provided by the built-in engine. It also supports a part of the C++17 features, while the rest of them are provided by Clangd.

Support for the C++20 standard relies on Clangd except for parsing and refactorings (handled by the built-in engine). Besides, the built-in engine extends the Clangd's support for C++20 Concepts (see the dedicated article for details).

The tables below give an overview of the standards support status, and the details of C++20 and C+17 support.

Standard

Clangd (CXX_status)

Built-in engine

C++20, C++2b

Partial support

  • Parsing and refactorings for the features supported by Clangd

  • Extended support for Concepts (based on Clangd): custom highlighting, code completion, dedicated inspections, Rename refactoring, navigation actions like Go to Definition and Find Usages.

C++17

Full support starting Clang 5

Partial support

C++14

Full support

Full support

C++11

Full support

Full support

C++2b

Language feature

Clang support status

Error highlighting and quick-fixes

Completion

Navigation

Parsing

Refactorings

Literal suffix uz, z for size_t, ssize_t (P0330R8)

Partially

-

-

-

-

-

Make () in lambdas optional in all cases (P1102R2)

Partially

-

-

-

-

-

Simpler implicit move (P2266R1)

Partially

-

-

-

-

-

if consteval (P1938R3)

-

-

-

-

-

-

Allow duplicate attributes (P2556R1)

Partial

-

-

-

-

-

Narrowing contextual conversions to bool (P1401R5)

Partial

-

-

-

-

-

Trimming whitespaces before line splicing (P2223R2)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Make declaration order layout mandated (P1874R4)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

C++ identifier syntax using UAX 31 (P1949R7)

Partial

-

-

-

-

-

Mixed string literal concatenation (P2201R1)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

C++20

Language feature

Clang support status

Error highlighting and quick-fixes

Completion

Navigation

Parsing

Refactorings

Default member initializers for bit-fields (P0683R1)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

const&-qualified pointers to members (P0704R1)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Allow lambda-capture [=, this] (P0409R2)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

__VA_OPT__ for preprocessor comma elision (P0306R4, P1042R1)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Designated initializers (P0329R4)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

template-parameter-list for generic lambdas (P0428R2)

+

Clangd

Clangd

Mixed

Built-in engine

-

Concepts: P0734R0P0857R0P1084R2P1141R2P1616R1P1452R2

+

Clangd

Clangd

Mixed

Built-in engine

Built-in engine, Rename only

Concepts: P0848R3P1972R0P1980R0P2103R0P2092R0P2113R0

-

-

-

-

-

-

Range-based for statements with initializer (P0614R1)

+

Clangd

Clangd

Mixed

Built-in engine

Built-in engine

ADL and function templates that are not visible (P0846R0)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

const mismatch with defaulted copy constructor (P0641R2)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Consistent comparison (operator<=>): P0515R3P0905R1P1120R0P1185R2P1186R3P1630R1P1946R0P1959R0

+

Clangd

Clangd

Mixed

Built-in engine

-

Consistent comparison (operator<=>): P2002R1

Partial

-

-

-

-

-

Consistent comparison (operator<=>): P2085R0

-

-

-

-

-

-

Access checking on specializations (P0692R1)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Default constructible and assignable stateless lambdas (P0624R2)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Lambdas in unevaluated contexts (P0315R4)

Partially (doesn't implement temp.deduct/9)

Clangd

Clangd

Mixed, relying on Clangd

-

-

[[no_unique_address]] attribute (P0840R2)

+

Clangd

Clangd

Mixed

Built-in engine

-

[[likely]] and [[unlikely]] attributes (P0479R5)

+

Built-in engine

Built-in engine

Built-in engine

Built-in engine

-

typename optional in more contexts (P0634R3)

-

-

-

-

-

-

Pack expansion in lambda init-capture (P0780R2)

+

Clangd

Clangd

Mixed

Built-in engine

-

Class types as non-type template parameters (P0732R2, P1907R1

Partial

Clangd

Clang

-

-

-

Destroying operator delete (P0722R3)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Relaxations of constexpr restrictions (P1064R0, P1002R1, P1327R1, P1330R0, P1331R2, P1668R1, P0784R7)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Prohibit aggregates with user-declared constructors (P1008R1)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Feature test macros (P0941R2)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

explicit(bool) (P0892R2)

+

Clangd

Clangd

Mixed

Built-in engine

Built-in engine

Signed integers are two's complement (P1236R1)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

char8_t (P0482R6)

+

Clangd

Clangd

Mixed

Built-in engine

-

Immediate functions (consteval) (P1073R3, P1937R2)

+

Clangd

Clangd

Mixed

Built-in engine

-

std::is_constant_evaluated (P0595R2)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Nested inline namespaces (P1094R2)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Structured binding extensions (P1091R3, P1381R1)

Partially

-

-

-

-

-

Stronger Unicode requirements (P1041R4, P1139R2)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Parenthesized initialization of aggregates (P0960R3, P1975R0)

-

-

-

-

-

-

Modules: P1766R1 (DR)

+ (Clang 11)

-

-

-

-

-

Modules: (P1874R1), P2115R0, P1103R3

Partially

-

-

-

-

-

Modules: P1979R0, P1779R3, P1857R3, P1815R2, P1811R0, P1703R1

-

-

-

-

-

-

Coroutines (P0912R5)

Partially

Clangd

Clangd

Mixed

Built-in engine

-

Deprecate a[b,c] (P1161R3)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Deprecate some problematic uses of volatile (P1152R4)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

[[nodiscard("with reason")]] (P1301R4)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

using enum (P1099R5)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

Class template argument deduction for aggregates (P1816R0, P2082R1)

-

-

-

-

-

-

Class template argument deduction for alias templates (P1814R0)

-

-

-

-

-

-

Permit conversions to arrays of unknown bound (P0388R4)

-

-

-

-

-

-

constinit (P1143R2)

+

Clangd

Clangd

Mixed

Built-in engine

-

Pseudo-destructors end object lifetimes P0593R6 (DR)

+ (Clang 11)

-

-

-

-

-

More implicit moves P1825R0 (DR)

+

Clangd

Clangd

Mixed, relying on Clangd

-

-

C++17

Language feature

Error highlighting and quick-fixes

Completion

Navigation

Refactorings

auto non-type parameters

Clangd

Clangd

Mixed, relying on Clangd

-

UTF-8 character literals

Clangd

Clangd

Mixed, relying on Clangd

-

lambda capture of *this

Clangd

Clangd

Mixed, relying on Clangd

-

[[nodiscard]] attribute

Clangd

Clangd

Mixed, relying on Clangd

-

[[fallthrough]] attribute

Clangd

Clangd

Mixed, relying on Clangd

-

[[maybe_unused]] attribute

Clangd

Clangd

Mixed, relying on Clangd

-

'noexcept' as part of a function type

Clangd

Clangd

Mixed, relying on Clangd

-

one-argument static assert

Clangd

Clangd

Mixed, relying on Clangd

-

if constexpr

Clangd

Clangd

Mixed, relying on Clangd

-

inline variables

Clangd

Clangd

Mixed, relying on Clangd

-

new rules for auto deduction from braced-init-list

Clangd

Clangd

Mixed, relying on Clangd

-

constexpr lambdas

Clangd

Clangd

Mixed, relying on Clangd

-

nested namespace definition

Clangd

Clangd only, both, or built-in only *

Mixed **

Build-in engine

fold expressions

Clangd

Clangd only, both, or built-in only *

Mixed **

-

class template argument deduction

Clangd

Clangd only, both, or built-in only *

Mixed **

-

__has_include

Clangd

Clangd

-

-

* - As selected in Clangd settings.

** - Both engines are used. Clangd helps with highlighting references at caret, Go to declaration, Go to definition, Quick documentation, Quick definition, Find Usages.

C++ code inspections

CLion performs static analysis on your C/C++ code using a set of inspections, configurable in Settings / Preferences | Editor | Inspections | C/C++. Some of the C/C++ inspections are provided by Clangd, while the others work as part of the built-in engine.

The table below shows which engine is used for a particular inspection or a set of inspections. Note that Objective-C checks are not listed except for those with similar Clang diagnostics.

Inspection

Provided by

Data flow analysis

Clangd

Functions

Build-in engine

General: Argument selection defects

Clangd

General: Clang-tidy

Clangd or built-in, as selected

General: Unconstrained variable type

Built-in engine (based on Clangd)

General: Empty declaration or statement

Clangd

General: Format specifiers

For C/C++, this check is covered by Clang’s -Wformat diagnostic.

General: '=' in conditional expression

For C/C++, this check is covered by Clang’s -Wparentheses diagnostic.

General: Inconsistent naming

Built-in engine

General: Missing switch case

For C/C++, this check is covered by Clang’s -Wswitch diagnostic.

General: Simplifiable statement

Clangd

General: Virtual call from constructor or destructor

Clangd

Unused code: Unused concept

Built-in engine (based on Clangd)

Unused code: Unused expression result

For C/C++, this check is covered by Clangd’s DFA.

Unused code: Unused global declaration

Clangd

Unused code: Unused include directive

Clangd

Unused code: Unused macro

Clangd

Unused code: Unused struct

Clangd

Unused code: Unused template parameter

Clangd

Unused code: Unused type alias

Clangd

Last modified: 29 September 2021