[all-commits] [llvm/llvm-project] 8a9049: [clang] Replace `finish()` with destructors for `D...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Mon Mar 2 12:52:14 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a9049198d180956a5f69c567bf235d36cd215a7
      https://github.com/llvm/llvm-project/commit/8a9049198d180956a5f69c567bf235d36cd215a7
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2026-03-02 (Mon, 02 Mar 2026)

  Changed paths:
    M clang/include/clang/Basic/Diagnostic.h
    M clang/include/clang/DependencyScanning/DependencyScannerImpl.h
    M clang/include/clang/Frontend/ChainedDiagnosticConsumer.h
    M clang/lib/DependencyScanning/DependencyScannerImpl.cpp
    M clang/lib/DependencyScanning/DependencyScanningWorker.cpp
    M clang/lib/Frontend/CompilerInstance.cpp
    M clang/lib/Frontend/SerializedDiagnosticPrinter.cpp
    M clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
    M clang/lib/Tooling/Tooling.cpp
    M clang/tools/driver/cc1_main.cpp
    M clang/tools/driver/driver.cpp
    M clang/unittests/DependencyScanning/CMakeLists.txt
    R clang/unittests/DependencyScanning/DependencyScanningWorkerTest.cpp

  Log Message:
  -----------
  [clang] Replace `finish()` with destructors for `DiagnosticConsumer` (#183831)

The `DiagnosticConsumer::finish()` API has historically been a source of
friction. Lots of different clients must manually ensure it gets called
for all consumers to work correctly. Idiomatic C++ uses destructors for
this. In Clang, there are some cases where destructors don't run
automatically, such as under `-disable-free` or some signal handling
code in `clang_main()`. This PR squeezes the complexity of ensuring
those destructors do run out of library code and into the tools that
already deal with the complexities of `-disable-free` and signal
handling.



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