To exclude thirdparty code.
To test:
With /tmp/foo.c
void test() { int x; x = 1; // warn }
$ scan-build --exclude non-existing/ --exclude /tmp/ -v gcc -c foo.c scan-build: Using '/usr/lib/llvm-7/bin/clang' for static analysis scan-build: Emitting reports for this run to '/tmp/scan-build-2018-09-16-214531-8410-1'. foo.c:3:3: warning: Value stored to 'x' is never read x = 1; // warn ^ ~ 1 warning generated. scan-build: File '/tmp/foo.c' deleted: part of an ignored directory. scan-build: 0 bugs found.