Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[analyzer] Remove overzealous "No dispatcher registered" assertion #107294

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ class CheckerManager {

bool hasPathSensitiveCheckers() const;

void finishedCheckerRegistration();

const LangOptions &getLangOpts() const { return LangOpts; }
const AnalyzerOptions &getAnalyzerOptions() const { return AOptions; }
const Preprocessor &getPreprocessor() const {
Expand Down
10 changes: 0 additions & 10 deletions clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ bool CheckerManager::hasPathSensitiveCheckers() const {
EvalCallCheckers, EndOfTranslationUnitCheckers);
}

void CheckerManager::finishedCheckerRegistration() {
#ifndef NDEBUG
// Make sure that for every event that has listeners, there is at least
// one dispatcher registered for it.
for (const auto &Event : Events)
assert(Event.second.HasDispatcher &&
"No dispatcher registered for an event");
#endif
}

void CheckerManager::reportInvalidCheckerOptionValue(
const CheckerBase *C, StringRef OptionName,
StringRef ExpectedValueDesc) const {
Expand Down
1 change: 0 additions & 1 deletion clang/lib/StaticAnalyzer/Frontend/CreateCheckerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ CheckerManager::CheckerManager(
AOptions, checkerRegistrationFns);
Registry.initializeRegistry(*this);
Registry.initializeManager(*this);
finishedCheckerRegistration();
}

CheckerManager::CheckerManager(AnalyzerOptions &AOptions,
Expand Down
13 changes: 13 additions & 0 deletions clang/test/Analysis/nullability-nocrash.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: %clang_analyze_cc1 -w -analyzer-checker=nullability \
// RUN: -analyzer-output=text -verify %s
//
// expected-no-diagnostics
//
// Previously there was an assertion requiring that if an Event is handled by
// some enabled checker, then there must be at least one enabled checker which
// can emit that kind of Event.
// This assertion failed when NullabilityChecker (which is a subclass of
// check::Event<ImplicitNullDerefEvent>) was enabled, but the checkers
// inheriting from EventDispatcher<ImplicitNullDerefEvent> were all disabled.
// This test file validates that enabling the nullability checkers (without any
// other checkers) no longer causes a crash.
Loading