Switch class to use a blanket impl for Destroy (#6125)

Right now, the class destroy impl is incorrectly generated (first
discussed [in
Discord](https://discord.com/channels/655572317891461132/941071822756143115/1418614787449032826)).
If we want it to be correct, deferred definition logic would need to be
added, and the declaration would need to be moved inside the `class`
scope (along with whatever generic logic that needs).

This instead switches to a blanket impl, to avoid creating latent bugs
with generating the `impl` and function body in the wrong scope. This
approach uses the same blanket impl as aggregate destruction that was
added by #6098.

The intent here is to allow progress on other parts of `Destroy`. For
example, under this model the implementation of the function body could
be done as part of lowering the specific.
This commit is contained in:
Jon Ross-Perkins
2025-09-29 16:05:06 +00:00
committed by GitHub
parent 5705b94da8
commit 49ba8cf3e1
230 changed files with 3632 additions and 21983 deletions
+2 -3
View File
@@ -60,7 +60,7 @@ CheckUnit::CheckUnit(
const Parse::GetTreeAndSubtreesStore* tree_and_subtrees_getters,
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
std::shared_ptr<clang::CompilerInvocation> clang_invocation,
bool gen_implicit_type_impls, llvm::raw_ostream* vlog_stream)
llvm::raw_ostream* vlog_stream)
: unit_and_imports_(unit_and_imports),
tree_and_subtrees_getter_(tree_and_subtrees_getters->Get(
unit_and_imports->unit->sem_ir->check_ir_id())),
@@ -71,8 +71,7 @@ CheckUnit::CheckUnit(
context_(&emitter_, tree_and_subtrees_getter_,
unit_and_imports_->unit->sem_ir,
GetImportedIRCount(unit_and_imports),
unit_and_imports_->unit->total_ir_count, gen_implicit_type_impls,
vlog_stream) {}
unit_and_imports_->unit->total_ir_count, vlog_stream) {}
auto CheckUnit::Run() -> void {
Timings::ScopedTiming timing(unit_and_imports_->unit->timings, "check");