I'm trying to use clang-tidy to parse my project, compiled by arm-none-eabi-g++.
Unfortunately, clang-tidy is not able to find compiler headers, even when given the include path to them.
My compile_commands.json is
[
{
"directory": "C:/LMA/repo/clang-tidy",
"arguments": [
"arm-none-eabi-c++",
"-IC:/nxp/MCUXpressoIDE_11.2.1_4149/ide/tools/arm-none-eabi/include/c++/9.2.1",
"-IC:/nxp/MCUXpressoIDE_11.2.1_4149/ide/tools/arm-none-eabi/include/c++/9.2.1/arm-none-eabi/arm/v5te/hard",
"test.cpp"
],
"file": "./test.cpp" } ]
And the example test.cpp file is:
#include <cstdint>
#include <cstdlib>
int test()
{
int temp;
return 0;
}
Clang-tidy shows error:
C:/nxp/MCUXpressoIDE_11.2.1_4149/ide/tools/arm-none-eabi/include/c++/9.2.1\cstdlib:75:15: error: 'stdlib.h' file not found [clang-diagnostic-error]
#include_next <stdlib.h>
So, it properly finds and includes cstdlib, however it is not able to find stdint.h, which is located in the exactly same folder. What's even more irritaiting, it does not include stdlib.h, even when I add
-include C:/nxp/MCUXpressoIDE_11.2.1_4149/ide/tools/arm-none-eabi/include/c++/9.2.1/stdlib.h to compiler arguments in order to force preinclude.
Any suggestions how to fix this issue are very much appreciated.