[analyzer] Add yaml parser to GenericTaintChecker
authorGabor Borsik <gabor.borsik@gmail.com>
Sun, 28 Jul 2019 13:38:04 +0000 (13:38 +0000)
committerGabor Borsik <gabor.borsik@gmail.com>
Sun, 28 Jul 2019 13:38:04 +0000 (13:38 +0000)
commit4bde15fe1e4a320b6f198588af4c73316e4d3dc9
tree7f5a9f9eb84c82975c5a696f7874c97803fedd58
parentd5bc4b09f11b794deecdfd2aabe5f870369c45ef
[analyzer] Add yaml parser to GenericTaintChecker

While we implemented taint propagation rules for several
builtin/standard functions, there's a natural desire for users to add
such rules to custom functions.

A series of patches will implement an option that allows users to
annotate their functions with taint propagation rules through a YAML
file. This one adds parsing of the configuration file, which may be
specified in the commands line with the analyzer config:
alpha.security.taint.TaintPropagation:Config. The configuration may
contain propagation rules, filter functions (remove taint) and sink
functions (give a warning if it gets a tainted value).

I also added a new header for future checkers to conveniently read YAML
files as checker options.

Differential Revision: https://reviews.llvm.org/D59555

llvm-svn: 367190
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
clang/lib/StaticAnalyzer/Checkers/Yaml.h [new file with mode: 0755]
clang/test/Analysis/Inputs/taint-generic-config-ill-formed.yaml [new file with mode: 0755]
clang/test/Analysis/Inputs/taint-generic-config-invalid-arg.yaml [new file with mode: 0755]
clang/test/Analysis/Inputs/taint-generic-config.yaml [new file with mode: 0755]
clang/test/Analysis/analyzer-config.c
clang/test/Analysis/taint-generic.c