We used the llvm pass skeleton from here cloned from here. It is released under the MIT license. See SKELETON-LICENSE.
Build:
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cd ..
Run:
# Run manually:
$ clang -Xclang -load -Xclang build/skeleton/libNullDereferenceDetection.* examples/hello.c
# Or use one of the bash scripts:
$ ./opt <folder>/<example> # compile with clang and run with opt
$ ./compile <folder>/<example> # compile and run pass with clang
- Null detection for local variables within a function. If a variable with a pointer type has 0 assigned to it, then track it and warn when dereferenced. (done)
- Detect
nullcheck: stop complaining if anullcheck has been done. (interesting, but not done) - Track
maybenull return values. Analyse a function implementation to see if there exists a possibility of null. (done, but no warnings)