[all-commits] [llvm/llvm-project] da11ed: [analyzer] Remove overzealous "No dispatcher regis...

vabridgers via All-commits all-commits at lists.llvm.org
Mon Sep 9 01:48:00 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: da11ede57d034767a6f5d5e211c06c1c3089d7fd
      https://github.com/llvm/llvm-project/commit/da11ede57d034767a6f5d5e211c06c1c3089d7fd
  Author: vabridgers <58314289+vabridgers at users.noreply.github.com>
  Date:   2024-09-09 (Mon, 09 Sep 2024)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
    M clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
    M clang/lib/StaticAnalyzer/Frontend/CreateCheckerManager.cpp
    A clang/test/Analysis/nullability-nocrash.c

  Log Message:
  -----------
  [analyzer] Remove overzealous "No dispatcher registered" assertion (#107294)

Random testing revealed it's possible to crash the analyzer with the
command line invocation:

clang -cc1 -analyze -analyzer-checker=nullability empty.c

where the source file, empty.c is an empty source file.

```
clang: <root>/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp:56:
   void clang::ento::CheckerManager::finishedCheckerRegistration():
     Assertion `Event.second.HasDispatcher && "No dispatcher registered for an event"' failed.

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/

Stack dump:
0.      Program arguments: clang -cc1 -analyze -analyzer-checker=nullability nullability-nocrash.c
 #0 ...
 ...
 #7 <addr> clang::ento::CheckerManager::finishedCheckerRegistration()
 #8 <addr> clang::ento::CheckerManager::CheckerManager(clang::ASTContext&,
             clang::AnalyzerOptions&, clang::Preprocessor const&,
             llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>,
             std::allocator<char>>>, llvm::ArrayRef<std::function<void (clang::ento::CheckerRegistry&)>>)
```

This commit removes the assertion which failed here, because it was
logically incorrect: it required that if an Event is handled by some
(enabled) checker, then there must be an **enabled** checker which can
emit that kind of Event. It should be OK to disable the event-producing
checkers but enable an event-consuming checker which has different
responsibilities in addition to handling the events.
 
Note that this assertion was in an `#ifndef NDEBUG` block, so this
change does not impact the non-debug builds.

Co-authored-by: Vince Bridgers <vince.a.bridgers at ericsson.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list