llvm with tablegen backend for capstone disassembler
Go to file
Kristof Umann 8fd74ebfc0 [analyzer] Reimplement dependencies between checkers
Unfortunately, up until now, the fact that certain checkers depended on one
another was known, but how these actually unfolded was hidden deep within the
implementation. For example, many checkers (like RetainCount, Malloc or CString)
modelled a certain functionality, and exposed certain reportable bug types to
the user. For example, while MallocChecker models many many different types of
memory handling, the actual "unix.MallocChecker" checker the user was exposed to
was merely and option to this modeling part.

Other than this being an ugly mess, this issue made resolving the checker naming
issue almost impossible. (The checker naming issue being that if a checker
registered more than one checker within its registry function, both checker
object recieved the same name) Also, if the user explicitly disabled a checker
that was a dependency of another that _was_ explicitly enabled, it implicitly,
without "telling" the user, reenabled it.

Clearly, changing this to a well structured, declarative form, where the
handling of dependencies are done on a higher level is very much preferred.

This patch, among the detailed things later, makes checkers declare their
dependencies within the TableGen file Checkers.td, and exposes the same
functionality to plugins and statically linked non-generated checkers through
CheckerRegistry::addDependency. CheckerRegistry now resolves these dependencies,
makes sure that checkers are added to CheckerManager in the correct order,
and makes sure that if a dependency is disabled, so will be every checker that
depends on it.

In detail:

* Add a new field to the Checker class in CheckerBase.td called Dependencies,
which is a list of Checkers.
* Move unix checkers before cplusplus, as there is no forward declaration in
tblgen :/
* Add the following new checkers:
  - StackAddrEscapeBase
  - StackAddrEscapeBase
  - CStringModeling
  - DynamicMemoryModeling (base of the MallocChecker family)
  - IteratorModeling (base of the IteratorChecker family)
  - ValistBase
  - SecuritySyntaxChecker (base of bcmp, bcopy, etc...)
  - NSOrCFErrorDerefChecker (base of NSErrorChecker and  CFErrorChecker)
  - IvarInvalidationModeling (base of IvarInvalidation checker family)
  - RetainCountBase (base of RetainCount and OSObjectRetainCount)
* Clear up and registry functions in MallocChecker, happily remove old FIXMEs.
* Add a new addDependency function to CheckerRegistry.
* Neatly format RUN lines in files I looked at while debugging.

Big thanks to Artem Degrachev for all the guidance through this project!

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

llvm-svn: 352287
2019-01-26 20:06:54 +00:00
clang [analyzer] Reimplement dependencies between checkers 2019-01-26 20:06:54 +00:00
clang-tools-extra [clang-tidy] fix unit tests for dropped _Float16 support in X86 2019-01-25 19:05:12 +00:00
compiler-rt [libFuzzer] add CompressedTest.cpp, a real-life-ish test for a custom mutator 2019-01-26 02:38:56 +00:00
debuginfo-tests Set config.lit_tools_dir, which is needed by lit.llvm.initialize. 2018-11-06 21:54:27 +00:00
libclc Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
libcxx Mark awk.pass.cpp as XFAIL for NetBSD 2019-01-24 20:26:02 +00:00
libcxxabi [libcxxabi] Support building hermetic static library 2019-01-24 03:18:29 +00:00
libunwind [libunwind] Use placement new to avoid dependency C++ library 2019-01-25 21:39:46 +00:00
lld Remove dead declaration. 2019-01-26 00:31:49 +00:00
lldb [lldb] Update shebang python2 -> python 2019-01-26 01:05:02 +00:00
llgo Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
llvm Generate test results for combine-fcopysign.ll using update_llc_test_checks.py . NFC 2019-01-26 18:13:53 +00:00
openmp NFC: fixed formatting to be consistent across the file 2019-01-21 16:11:43 +00:00
parallel-libs Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
polly Fix/unify top comment in lib/Analysis/PolyhedralInfo.cpp 2019-01-22 12:18:38 +00:00
pstl Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
.arcconfig Add an .arcconfig for the top of the git monorepo. 2019-01-11 16:27:14 +00:00
README.md

The LLVM Compiler Infrastructure

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.