Closed Yanpas closed 4 years ago
I don't think that's possible, unfortunately. Clang-Tidy doesn't seem to provide a way to disable the compiler flags it decides to use. You can only add more.
The best I can do is support the -p
flag.
-p <build-path> is used to read a compile command database.
For example, it can be a CMake build directory in which a file named
compile_commands.json exists (use -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
CMake option to get this output). When no build path is specified,
a search for compile_commands.json will be attempted through all
parent paths of the first input file .
Would this help?
That won't solve my problem.
I've tried to run it from cmdline:
7 warnings and 1 error generated.
Error while processing /home/yanpas/work/trunk/main.cpp
error: unknown warning option '-Wno-stringop-overflow'; did you mean '-Wno-shift-overflow'? [clang-diagnostic-unknown-warning-option]
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
It turns out that it doesn't stop clang from parsing. So extension can filter such kind of errors on one of these criteria:
Passing -extra-arg=-Wno-unknown-warning-option
to clang-tidy should disable those warnings.
https://stackoverflow.com/questions/47006405/clang-tidy-reporting-unknown-warnings
You can do that in settings.json
like this:
"clang-tidy.compilerArgs": [
"-Wno-unknown-warning-option"
]
I'd rather not add a setting to filter out diagnostics unless it's necessary.
That's fine, may be closed then
My project uses gcc-specific flags in compile_commands.json and I get following error:
Maybe it would be nice to exclude any unknown for clang flag.