CLion 2020.2 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 featureLanguage engine
Syntax highlightingClangd
Errors/warnings and quick-fixesClangd
CompletionClangd only, both, or built-in only*
Formatting: ClangFormatClangd
Formatting: Code Style settingsBuilt-in engine
NavigationBoth **
Parameter hintsClangd
RefactoringsBuilt-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.

StandardClangd (CXX_status)Built-in engine
C++20Partial 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++17Full support starting Clang 5Partial support
C++14Full supportFull support
C++11Full supportFull support

C++20

Language featureClang support statusError highlighting and quick-fixesCompletionNavigationParsingRefactorings
Default member initializers for bit-fields (P0683R1)+ClangdClangdMixed, relying on Clangd--
const&-qualified pointers to members(P0704R1) +ClangdClangdMixed, relying on Clangd--
Allow lambda-capture [=, this] (P0409R2) +ClangdClangdMixed, relying on Clangd--
__VA_OPT__ for preprocessor comma elision (P0306R4, P1042R1)+ClangdClangdMixed, relying on Clangd--
Designated initializers (P0329R4) +ClangdClangdMixed, relying on Clangd--
template-parameter-list for generic lambdas (P0428R2) +ClangdClangdMixedBuilt-in engine-
Concepts: P0734R0 P0857R0 P1084R2 P1141R2 P1616R1 P1452R2+ClangdClangdMixedBuilt-in engineBuilt-in engine, Rename only
Concepts: P0848R3 P1972R0 P1980R0 P2103R0 P2092R0 P2113R0------
Range-based for statements with initializer (P0614R1) +ClangdClangdMixedBuilt-in engineBuilt-in engine
ADL and function templates that are not visible (P0846R0) +ClangdClangdMixed, relying on Clangd--
const mismatch with defaulted copy constructor (P0641R2) +ClangdClangdMixed, relying on Clangd--
Consistent comparison (operator<=>): P0515R3 P0905R1 P1120R0 P1185R2 P1186R3 P1630R1 P1946R0 P1959R0+ClangdClangdMixedBuilt-in engine-
Consistent comparison (operator<=>): P2002R1Partial-----
Consistent comparison (operator<=>): P2085R0------
Access checking on specializations (P0692R1)Partial-----
Default constructible and assignable stateless lambdas (P0624R2) +ClangdClangdMixed, relying on Clangd--
Lambdas in unevaluated contexts (P0315R4)------
[[no_unique_address]] attribute (P0840R2) +ClangdClangdMixedBuilt-in engine-
[[likely]] and [[unlikely]] attributes (P0479R5) -Built-in engineBuilt-in engineBuilt-in engineBuilt-in engine-
typename optional in more contexts (P0634R3) ------
Pack expansion in lambda init-capture (P0780R2) +ClangdClangdMixedBuilt-in engine-
Class types as non-type template parameters (P0732R2, P1907R1------
Destroying operator delete (P0722R3) +ClangdClangdMixed, relying on Clangd--
Relaxations of constexpr restrictions (P1064R0, P1002R1, P1327R1, P1330R0, P1331R2, P1668R1, P0784R7) +ClangdClangdMixed, relying on Clangd--
Prohibit aggregates with user-declared constructors (P1008R1) +ClangdClangdMixed, relying on Clangd--
Feature test macros (P0941R2) +ClangdClangdMixed, relying on Clangd--
explicit(bool) (P0892R2) +ClangdClangdMixedBuilt-in engineBuilt-in engine
Signed integers are two's complement (P1236R1) +ClangdClangdMixed, relying on Clangd--
char8_t (P0482R6) +ClangdClangdMixedBuilt-in engine-
Immediate functions (consteval) (P1073R3, P1937R2) +ClangdClangdMixedBuilt-in engine-
std::is_constant_evaluated (P0595R2) +ClangdClangdMixed, relying on Clangd--
Nested inline namespaces (P1094R2) +ClangdClangdMixed, relying on Clangd--
Structured binding extensions (P1091R3, P1381R1) Partially-----
Stronger Unicode requirements (P1041R4, P1139R2) +ClangdClangdMixed, relying on Clangd--
Parenthesized initialization of aggregates (P0960R3, P1975R0) ------
Modules: P1766R1 (DR)+ (Clang 11)-----
Modules: (P1874R1), P2115R0, P1103R3Partially-----
Modules: P1979R0, P1779R3, P1857R3, P1815R2, P1811R0, P1703R1------
Coroutines (P0912R5) PartiallyClangdClangdMixedBuilt-in engine-
Deprecate a[b,c] (P1161R3) +ClangdClangdMixed, relying on Clangd--
Deprecate some problematic uses of volatile (P1152R4)+ClangdClangdMixed, relying on Clangd--
[[nodiscard("with reason")]] (P1301R4) +ClangdClangdMixed, relying on Clangd--
using enum (P1099R5) ------
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) +ClangdClangdMixedBuilt-in engine-
Pseudo-destructors end object lifetimes P0593R6 (DR) + (Clang 11)-----

C++17

Language featureError highlighting and quick-fixesCompletionNavigationRefactorings
auto non-type parametersClangdClangdMixed, relying on Clangd-
UTF-8 character literalsClangdClangdMixed, relying on Clangd-
lambda capture of *thisClangdClangdMixed, relying on Clangd-
[[nodiscard]] attributeClangdClangdMixed, relying on Clangd-
[[fallthrough]] attributeClangdClangdMixed, relying on Clangd-
[[maybe_unused]] attributeClangdClangdMixed, relying on Clangd-
'noexcept' as part of a function typeClangdClangdMixed, relying on Clangd-
one-argument static assertClangdClangdMixed, relying on Clangd-
if constexprClangdClangdMixed, relying on Clangd-
inline variablesClangdClangdMixed, relying on Clangd-
new rules for auto deduction from braced-init-listClangdClangdMixed, relying on Clangd-
constexpr lambdasClangdClangdMixed, relying on Clangd-
nested namespace definitionClangdClangd only, both, or built-in only *Mixed **Build-in engine
fold expressionsClangdClangd only, both, or built-in only *Mixed **-
class template argument deductionClangdClangd only, both, or built-in only *Mixed **-
__has_includeClangdClangd--

* - 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.

InspectionProvided by
Data flow analysisClangd
FunctionsBuild-in engine
General: Argument selection defectsClangd
General: Clang-tidyClangd or built-in, as selected
General: Constrain a function's resultBuilt-in engine (based on Clangd)
General: Empty declaration or statementClangd
General: Format specifiersFor C/C++, this check is covered by Clang’s -Wformat diagnostic.
General: '=' in conditional expressionFor C/C++, this check is covered by Clang’s -Wparentheses diagnostic.
General: Inconsistent namingBuilt-in engine
General: Missing switch caseFor C/C++, this check is covered by Clang’s -Wswitch diagnostic.
General: Simplifiable statementClangd
General: Virtual call from constructor or destructorClangd
Unused code: Unused concept Built-in engine (based on Clangd)
Unused code: Unused expression resultFor C/C++, this check is covered by Clangd’s DFA.
Unused code: Unused global declarationClangd
Unused code: Unused include directiveClangd
Unused code: Unused macroClangd
Unused code: Unused structClangd
Unused code: Unused template parameterClangd
Unused code: Unused type aliasClangd
Last modified: 17 September 2020