I confirm that I get some processes in the background while I type, including clang-tidy and other clion/.jar related processes. They show up and disappear but it's not a big deal when my CPUs are not saturated. You may also verify that you do not run out of clion-allocated memory: there is a memory meter in the bottom-right corner. There are dozens of refactorings, code analysis (including Data Flow Analysis and Clang-Tidy integration) and integration with GDB and LLDB. CLion uses the well-known CMake build system, supports Google test, Boost.Test, and Catch unit testing.
Clang Tidy Configuration
clang-tidy is a clang-based C++ “linter” tool. Its purpose is toprovide an extensible framework for diagnosing and fixing typical programmingerrors, like style violations, interface misuse, or bugs that can be deduced viastatic analysis. clang-tidy is modular and provides a convenientinterface for writing new checks.
clang-tidy is a LibTooling-based tool, and it’s easier to workwith if you set up a compile command database for your project (for an exampleof how to do this see How To Setup Tooling For LLVM). You can also specifycompilation options on the command line after
clang-tidy has its own checks and can also run Clang static analyzerchecks. Each check has a name and the checks to run can be chosen using the
-checks= option, which specifies a comma-separated list of positive andnegative (prefixed with
-) globs. Positive globs add subsets of checks,negative globs remove them. For example,
will disable all default checks (
-*) and enable all
clang-analyzer-*checks except for
-list-checks option lists all the enabled checks. When used without
-checks=, it shows checks enabled by default. Use
-checks=* to see allavailable checks or with any other value of
-checks= to see which checks areenabled by this value.
There are currently the following groups of checks:
|Checks related to Abseil library.|
|Checks related to OpenCL programming for FPGAs.|
|Checks related to Android.|
|Checks related to Boost library.|
|Checks that target bugprone code constructs.|
|Checks related to CERT Secure Coding Guidelines.|
|Clang Static Analyzer checks.|
|Checks related to concurrent programming (includingthreads, fibers, coroutines, etc.).|
|Checks related to C++ Core Guidelines.|
|Checks related to Darwin coding conventions.|
|Checks related to Fuchsia coding conventions.|
|Checks related to Google coding conventions.|
|Checks related to High Integrity C++ Coding Standard.|
|Checks related to the Linux Kernel coding conventions.|
|Checks related to the LLVM coding conventions.|
|Checks related to the LLVM-libc coding standards.|
|Checks that we didn’t have a better category for.|
|Checks that advocate usage of modern (currently “modern”means “C++11”) language constructs.|
|Checks related to MPI (Message Passing Interface).|
|Checks related to Objective-C coding conventions.|
|Checks related to OpenMP API.|
|Checks that target performance-related issues.|
|Checks that target portability-related issues that don’trelate to any particular coding style.|
|Checks that target readability-related issues that don’trelate to any particular coding style.|
|Checks related to Zircon kernel coding conventions.|
Clang diagnostics are treated in a similar way as check diagnostics. Clangdiagnostics are displayed by clang-tidy and can be filtered out using
-checks= option. However, the
-checks= option does not affectcompilation arguments, so it can not turn on Clang warnings which are notalready turned on in build configuration. The
-warnings-as-errors= optionupgrades any warnings emitted under the
-checks= flag to errors (but itdoes not enable any checks itself).
Clang Tidy Suppress Warning
Clang diagnostics have check names starting with
clang-diagnostic-.Diagnostics which have a corresponding warning option, are named
clang-diagnostic-<warning-option>, e.g. Clang warning controlled by
-Wliteral-conversion will be reported with check name
-fix flag instructs clang-tidyThe Other Side of the Night PDF Free download. to fix found errors ifsupported by corresponding checks.
Clang Tidy Checks
An overview of all the command-line options:
clang-tidy diagnostics are intended to call out code that does notadhere to a coding standard, or is otherwise problematic in some way. However,if the code is known to be correct, it may be useful to silence the warning.Some clang-tidy checks provide a check-specific way to silence the diagnostics,e.g. bugprone-use-after-move can besilenced by re-initializing the variable after it has been moved out,bugprone-string-integer-assignment can be suppressed byexplicitly casting the integer to
char,readability-implicit-bool-conversion can also be suppressed byusing explicit casts, etc.
If a specific suppression mechanism is not available for a certain warning, orits use is not desired for some reason, clang-tidy has a genericmechanism to suppress diagnostics using
NOLINT comment instructs clang-tidy to ignore warnings on thesame line (it doesn’t apply to a function, a block of code or any otherlanguage construct, it applies to the line of code it is on). If introducing thecomment in the same line would change the formatting in undesired way, the
NOLINTNEXTLINE comment allows to suppress clang-tidy warnings on the nextline.
Clang Tidy Options
Both comments can be followed by an optional list of check names in parentheses(see below for the formal syntax).
The formal syntax of
NOLINTNEXTLINE is the following:
Note that whitespaces between
NOLINTNEXTLINE and the openingparenthesis are not allowed (in this case the comment will be treated just as
NOLINTNEXTLINE), whereas in check names list (inside theparenthesis) whitespaces can be used and will be ignored.