diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-06-26 21:12:08 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-06-26 21:12:08 +0000 |
commit | d245644c76fc9fdddef557021c2affb3afdeb7ba (patch) | |
tree | 8f0452314e5eeae27f4a210f92ee8cbefbc85aab /lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp | |
parent | 495d25c4469822341840cb74ac457c8bcd19c42c (diff) |
[analyzer] Do not run visitors until the fixpoint, run only once.
In the current implementation, we run visitors until the fixed point is
reached.
That is, if a visitor adds another visitor, the currently processed path
is destroyed, all diagnostics is discarded, and it is regenerated again,
until it's no longer modified.
This pattern has a few negative implications:
- This loop does not even guarantee to terminate.
E.g. just imagine two visitors bouncing a diagnostics around.
- Performance-wise, e.g. for sqlite3 all visitors are being re-run at
least 10 times for some bugs.
We have already seen a few reports where it leads to timeouts.
- If we want to add more computationally intense visitors, this will
become worse.
- From architectural standpoint, the current layout requires copying
visitors, which is conceptually wrong, and can be annoying (e.g. no
unique_ptr on visitors allowed).
The proposed change is a much simpler architecture: the outer loop
processes nodes upwards, and whenever the visitor is added it only
processes current nodes and above, thus guaranteeing termination.
Differential Revision: https://reviews.llvm.org/D47856
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335666 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp b/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp index 53632b41df..d3489282ab 100644 --- a/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp @@ -39,7 +39,7 @@ class DeleteWithNonVirtualDtorChecker : public Checker<check::PreStmt<CXXDeleteExpr>> { mutable std::unique_ptr<BugType> BT; - class DeleteBugVisitor : public BugReporterVisitorImpl<DeleteBugVisitor> { + class DeleteBugVisitor : public BugReporterVisitor { public: DeleteBugVisitor() : Satisfied(false) {} void Profile(llvm::FoldingSetNodeID &ID) const override { |