Hello,
I want to be able to track memory bugs, e.g double frees over multiple
C-files. When one function allocates memory and passes the pointer to
another function in another file, then a double free is not found anymore.
Example
file1.c:
#include <stdlib.h>
#include "file2.h"
int main(int argc, void** argv) {
void* p = malloc(1);
foo(p);
free(p);
}
file2.c:
#include <stdlib.h>
void foo(void* p) {
free(p);
}
file2.h:
void foo(void* p);
There have been some question on this previously:
http://permalink.gmane.org/gmane.comp.compilers.clang.devel/23626
http://permalink.gmane.org/gmane.comp.compilers.clang.devel/17310
Has anything changed since then?
Also wouldn't it be possible to just merge the different ASTs together
and analyze the program as a whole?
Is there a specific reason why this hasn't been implemented? If it is
not too big a task I could extend clang for this scenario as part of my
bachelor's thesis.
I'm looking forward to your insights.
Thank you very much in advance
Florian Scheibner