[cfe-dev] Many .c files as input to scan-build
Дилян Палаузов via cfe-dev
cfe-dev at lists.llvm.org
Thu Jul 11 09:56:21 PDT 2019
Hello,
the clang static analyzer does a good job, performing on the individual source files. But it with a single .c/.cpp file
as input it cannot catch all codepaths of a program having many source files.
In particular, using GLibs g_hash_table_new allocates memory and g_hash_table_destroy() frees the memory, but scan-build
does not know this and does not check for it.
I mean, scan-build provides different results for the same program, depending on how source code is split into different
files.
One way to solve this is to create a huge .h file containing recursively all function definitions needed by a .c/.cpp
file, including sources from libraries and feeding this to scan-build.
It would be however easier, if scan-build is extended to accept as input many .c and .cpp files, glue them internally
into one and then handle that big file as input.
This will help finding troubles, that are split between source files.
Regards
Дилян
More information about the cfe-dev
mailing list