Hi,
I am starting to use static analysis in my codebase for ESP32 project, and I read the guide in the IDF docs for using `idf.py clang-check`. This depends on installing the xtensa-clang binaries, but I wonder why it is recommended to use xtensa-clang instead of the native clang-tidy? I could install clang-tidy for my environment with `apt install clang-tidy`.
Because clang-tidy is analysing C code and not compiling it, can anyone explain why the clang-tidy from xtensa-clang is a better choice than the native clang-tidy?
Thank you
Why use xtensa-clang for clang-tidy in IDF Clang Tidy?
Re: Why use xtensa-clang for clang-tidy in IDF Clang Tidy?
This is necessary in order for clang-tidy to be able to resolve the system header files (i.e. newlib C library) , preprocessor macros, sizes of built-in types, etc. correctly.
Probably it won't be necessary any longer if https://github.com/llvm/llvm-project/issues/53468 gets implemented — that feature would allow clang-tidy to call GCC to resolve the headers; I don't know if the sizes of the built-in types will be determined correctly with that approach, though.
Probably it won't be necessary any longer if https://github.com/llvm/llvm-project/issues/53468 gets implemented — that feature would allow clang-tidy to call GCC to resolve the headers; I don't know if the sizes of the built-in types will be determined correctly with that approach, though.
Who is online
Users browsing this forum: Baidu [Spider] and 411 guests