]> granicus.if.org Git - clang/commit
[analyzer] Fix an assertion failure if plugins added dependencies
authorKristof Umann <kristof.umann@ericsson.com>
Fri, 19 Apr 2019 11:01:35 +0000 (11:01 +0000)
committerKristof Umann <kristof.umann@ericsson.com>
Fri, 19 Apr 2019 11:01:35 +0000 (11:01 +0000)
commitdcf9f6429ba12fd17f772b9ae08e454c79bed73b
tree05b4a38c9afbc233ef459de255a650aace35aac2
parentfefa4bbbd61cffada3e1301f46aae09e87a21178
[analyzer] Fix an assertion failure if plugins added dependencies

Ideally, there is no reason behind not being able to depend on checkers that
come from a different plugin (or on builtin checkers) -- however, this is only
possible if all checkers are added to the registry before resolving checker
dependencies. Since I used a binary search in my addDependency method, this also
resulted in an assertion failure (due to CheckerRegistry::Checkers not being
sorted), since the function used by plugins to register their checkers
(clang_registerCheckers) calls addDependency.

This patch resolves this issue by only noting which dependencies have to
established when addDependency is called, and resolves them at a later stage
when no more checkers are added to the registry, by which point
CheckerRegistry::Checkers is already sorted.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358750 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
test/Analysis/checker-dependencies.c