llvm-project/clang/test/Analysis/inlining
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
..
Inputs/expected-plists [analyzer] Reimplement dependencies between checkers 2019-01-26 20:06:54 +00:00
DynDispatchBifurcate.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
InlineObjCClassMethod.m [analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default 2018-08-29 20:29:17 +00:00
InlineObjCInstanceMethod.h
InlineObjCInstanceMethod.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
ObjCDynTypePopagation.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
ObjCImproperDynamictallyDetectableCast.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
RetainCountExamples.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
analysis-order.c Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
assume-super-init-does-not-return-nil.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
containers.cpp [analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default 2018-08-29 20:29:17 +00:00
dyn-dispatch-bifurcate.cpp [analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default 2018-08-29 20:29:17 +00:00
eager-reclamation-path-notes.c [analyzer] [NFC] Reverse the argument order for "diff" in tests 2019-01-10 18:15:44 +00:00
eager-reclamation-path-notes.cpp [analyzer] [NFC] Reverse the argument order for "diff" in tests 2019-01-10 18:15:44 +00:00
false-positive-suppression.c [analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default 2018-08-29 20:29:17 +00:00
false-positive-suppression.cpp Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
false-positive-suppression.m [analyzer] trackNullOrUndefValue: always track through parentheses and casts. 2017-12-20 01:03:22 +00:00
inline-defensive-checks.c [analyzer] Track null or undef values through pointer arithmetic. 2018-03-30 19:27:42 +00:00
inline-defensive-checks.cpp [analyzer] Track null and undef values through expressions with cleanups. 2018-06-25 23:55:07 +00:00
inline-defensive-checks.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
path-notes.c [analyzer] [NFC] Reverse the argument order for "diff" in tests 2019-01-10 18:15:44 +00:00
path-notes.cpp [analyzer] [NFC] Reverse the argument order for "diff" in tests 2019-01-10 18:15:44 +00:00
path-notes.m [analyzer] [NFC] Reverse the argument order for "diff" in tests 2019-01-10 18:15:44 +00:00
retain-count-self-init.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
stl.cpp [analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default 2018-08-29 20:29:17 +00:00
temp-dtors-path-notes.cpp [analyzer] Add support for pre-C++17 copy elision. 2018-06-28 00:30:18 +00:00
test-always-inline-size-option.c Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00
test_objc_inlining_option.m Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers 2017-03-03 18:02:02 +00:00