For questions about clang-tidy as a static analyzer and code modernization tool. For more generic questions such as compiler diagnostic messages use the clang tag.
Questions tagged [clang-tidy]
404 questions
4
votes
1 answer
Make run-clang-tidy exclude a folder
I want the python script run-clang-tidy to:
check files with .cc, .h, or .hpp extension
exclude anything in any folder called build
For example,
check /src/../include/solitaire/helloworld.h
exclude

Crawl Cycle
- 257
- 2
- 8
4
votes
1 answer
What does Clang-Tidy "suppressed X warnings" mean?
Here's my scan command (using .clang-tidy config):
clang-tidy --
I see the output for the source code, which is fine. At the very bottom I see:
Suppressed 30000 (30000 in non-user…

helloworld95
- 366
- 7
- 17
4
votes
0 answers
Why am I getting `modernize-use-nullptr` clang tidy error when comparing `std::time_point`?
I don't understand why I am getting this warning when I run my code through clang tidy. I think that the error message is telling me that I am using NULL instead of nullptr, but I am not using NULL…

user1032677
- 363
- 2
- 11
4
votes
1 answer
clang-tidy 10 is ignoring my NOLINT commands
clang-tidy v10.0.0 appears to ignore my NOLINT or NOLINTNEXTLINE instructions. Using this trivial compile_commands.json:
[
{
"directory": "/home/cmannett85/workspace/scratch/build",
"command": "/usr/lib/ccache/g++-10 -g -Werror -Wall -Wextra…

cmannett85
- 21,725
- 8
- 76
- 119
4
votes
1 answer
How does Clang find it's default sysroot / target triple? (clang-tidy has stopped working)
Background:
On a Windows 10 PC, I have a c++ codebase. Using CMAKE I generate an Mingw-w64 project (using Eclipse IDE) and a Visual Studio 2017 project. I like compiling my projects with different build systems as each gives different warnings and…

MiloBloom
- 41
- 3
4
votes
0 answers
clang-tidy: member variable renaming only performed in header
I am trying apply clang-tidy to my project, but run into the problem that it only renames member variables in the header, but not the occurrences in the cpp files:
E.g. I have a class member named "my_member" in the header file. This gets renamed by…

veio
- 507
- 4
- 16
4
votes
0 answers
Do Clang-Tidy check aliases repeat the same check?
When running clang-tidy (with almost all checks enabled) I noticed I've had to suppress a warning under multiple aliases, and sometimes a warning shows up multiple times under different aliases.
Usually this is something I ignore, but after setting…

Farway
- 741
- 10
- 13
4
votes
1 answer
Exclude third_party from clang-tidy checks
I'm trying to run clang-tidy on a big project with a lot of files that include third party libraries:
#include "third_party/..."
And thus I receive a lot of errors corresponding to these third party libraries.
Adding NOLINT to each include is not…

Ivan
- 139
- 1
- 10
4
votes
0 answers
Suppressing clang-tidy false-positive warnings about Eigen
Clang-tidy reports warnings with a simple code involving Eigen. My questions are:
Are they really false-positive warnings?
How can I suppress them? They cannot be suppressed completely by adding //…

Jiro
- 83
- 5
4
votes
1 answer
How can I use unions without clang-tidy warnings?
Clang-tidy's cppcoreguidelines-pro-type-union-access rule is essentially a complete ban on unions, it flags all access to union members.
My library has an extern "C" interface with a structure which contains an union. I cannot use variants in…

Calmarius
- 18,570
- 18
- 110
- 157
4
votes
1 answer
Disabling clang-tidy diagnostic
I'm trying to set up clang-tidy for enforcing naming conventions in a C project. This project is composed of multiple external sources and uses a plain makefile environment, thus no tool like cmake or bear is available to generate a compilation…

martin
- 591
- 1
- 8
- 17
4
votes
0 answers
Automatically apply clang-tidy refactoring to CLion project folder
Is there a way to run and automatically refactor the entire CLion project source code by applying all the clang-tidy quick-fixes?

Francesco Borzi
- 56,083
- 47
- 179
- 252
4
votes
1 answer
android studio 3.3 clang-tidy
Yesterday, Google updated Android Studio to version 3.3 and there it was possible to use a static analyzer for libraries supporting C ++. So, how exactly to use it? I include in:
Preferences->Editor->Inspections->General->Clang-tidy
(Use IDE…

SergeyLoskutnikov
- 41
- 3
- 6
4
votes
1 answer
CMAKE_CXX_CLANG_TIDY: avoid clang-diagnostic-error interrupting build
I am building a C++ project using clang-tidy as linter (cmake -DCMAKE_CXX_CLANG_TIDY=clang-tidy).
After updating my system (Fedora 28->29, cmake 3.11->3.12 I believe), I cannot build any more when clang-tidy reports some clang-diagnostic-error…

Sergio Losilla
- 730
- 1
- 5
- 14
4
votes
1 answer
How to constraint clang-tidy to FIX-IT only in the source file and not all headers
Does anyone know if its possible to have clang-tidy -fix to NOT make modifications in header files. (either at all or headers only in the current directory)
I'd like to clean selected source files first before attempting to work on the hundred of…

MyDeveloperDay
- 2,485
- 1
- 17
- 20