[Analyzer] Fix for incorrect use of container and iterator checkers
authorAdam Balogh <adam.balogh@ericsson.com>
Thu, 5 Mar 2020 19:09:15 +0000 (20:09 +0100)
committerAdam Balogh <adam.balogh@ericsson.com>
Mon, 30 Mar 2020 07:14:45 +0000 (09:14 +0200)
commitafcb77cc88a2ed489bbd383774c54daa82340761
tree16655c9f6a71488d6c69c611a946971c883fa165
parentc9eaed514929f841d70d685a183658294e70a0df
[Analyzer] Fix for incorrect use of container and iterator checkers

Iterator checkers (and planned container checkers) need the option
aggressive-binary-operation-simplification to be enabled. Without this
option they may cause assertions. To prevent such misuse, this patch adds
a preventive check which issues a warning and denies the registartion of
the checker if this option is disabled.

Differential Revision: https://reviews.llvm.org/D75171
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
clang/test/Analysis/container-modeling-no-aggressive-binary-operation-simplification-warn.cpp [new file with mode: 0644]
clang/test/Analysis/iterator-modeling-no-aggressive-binary-operation-simplification-no-crash.cpp [new file with mode: 0644]
clang/test/Analysis/loop-widening-notes.cpp