Skip to content

Ignore unknown flags in clang-tidy #108455

@aminya

Description

@aminya

Now, cmake has started passing gcc-specific flags for modules support, which breaks clang-tidy. Is there a way to tell clang-tidy to ignore the flags it doesn't understand instead of erroring out?

https://gitlab.kitware.com/cmake/cmake/-/issues/26283

FAILED: my_exe/test/CMakeFiles/my_exe_lib_tests.dir/Debug/tests.cpp.o /opt/homebrew/Cellar/cmake/3.30.3/bin/cmake -E __run_co_compile --launcher=/opt/homebrew/bin/ccache --tidy="/Users/runner/llvm/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;--extra-arg-before=--driver-mode=g++" --source=/Users/runner/work/cpp_vcpkg_project/cpp_vcpkg_project/my_exe/test/tests.cpp -- /opt/homebrew/bin/g++-14 -DDO_NOT_USE_WMAIN -DCMAKE_INTDIR=\"Debug\" -I/Users/runner/work/cpp_vcpkg_project/cpp_vcpkg_project/my_exe/include -isystem /Users/runner/work/cpp_vcpkg_project/cpp_vcpkg_project/build/vcpkg_installed/arm64-osx/include -g -std=c++20 -arch arm64 -isysroot /Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fdiagnostics-color=always -Wall -Wextra -Wextra-semi -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast --coverage -O0 -g -MD -MT my_exe/test/CMakeFiles/my_exe_lib_tests.dir/Debug/tests.cpp.o -MF my_exe/test/CMakeFiles/my_exe_lib_tests.dir/Debug/tests.cpp.o.d -fmodules-ts -fmodule-mapper=my_exe/test/CMakeFiles/my_exe_lib_tests.dir/Debug/tests.cpp.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o my_exe/test/CMakeFiles/my_exe_lib_tests.dir/Debug/tests.cpp.o -c /Users/runner/work/cpp_vcpkg_project/cpp_vcpkg_project/my_exe/test/tests.cpp error: unknown argument: '-fdeps-format=p1689r5' [clang-diagnostic-error] error: unknown argument: '-fmodule-mapper=my_exe/test/CMakeFiles/my_exe_lib_tests.dir/Debug/tests.cpp.o.modmap' [clang-diagnostic-error] error: unknown argument: '-fmodules-ts' [clang-diagnostic-error] 

This is also related to clangd/clangd#662
Perhaps a remove-flag option could solve the problem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions