Skip to content

[clang-tidy] Add --query-driver option #53468

@ladislas

Description

@ladislas

when using clangd for cross-compilation projects, the option --query-driver allows clangd to find the standard headers used by the cross-compilation compiler.

For example, in our project we have in our vscode settings: "--query-driver=/opt/homebrew/bin/arm-none-eabi*"

1ca174b adds this feature to clangd.

We are also using clang-tidy to modernize our project. When using clang-tidy through clangd, everything works fine thanks to the aforementioned --query-driver.

But when running clang-tidy or run-clang-tidy.py from CLI, we hit stupid errors such as:

Error while processing /Users/ladislas/dev/leka/LekaOS/libs/LogKit/include/LogKit.h.
/Users/blablabla/LekaOS/drivers/CoreLED/include/RGB.h:8:10: error: 'cstdint' file not found [clang-diagnostic-error]
#include <cstdint>
         ^~~~~~~~~
/Users/blablabla/LekaOS/include/interface/drivers/LED.h:8:10: error: 'cstdint' file not found [clang-diagnostic-error]
#include <cstdint>
         ^~~~~~~~~
/Users/blablabla/LekaOS/libs/LogKit/include/LogKit.h:8:10: error: 'array' file not found [clang-diagnostic-error]
#include <array>
         ^~~~~~~
make: *** [clang_tidy_diff] Error 123

We've tried to fix this through CMake and the compilation database but with no success...

It would be amazing to also have clang-tidy accept the --query-driver option and generate the compiler standard include path to fix the kind of issue we are facing.

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