diff options
author | Andy Kaylor <akaylor@nvidia.com> | 2025-07-21 15:34:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-21 15:34:46 -0700 |
commit | 8f26a301bc7caf3d11d1f03818dae77a24e266e9 (patch) | |
tree | 050e441313238715c1b334626013b62cd42506b5 /clang/lib/CIR/CodeGen/CIRGenFunction.cpp | |
parent | 5e8e03d859f4367b68ad08311ae0b3f8bf8eea4f (diff) | |
download | llvm-8f26a301bc7caf3d11d1f03818dae77a24e266e9.zip llvm-8f26a301bc7caf3d11d1f03818dae77a24e266e9.tar.gz llvm-8f26a301bc7caf3d11d1f03818dae77a24e266e9.tar.bz2 |
[CIR] Add complete destructor handling (#149552)
The initial implementation for emitting destructors emitted the complete
destructor body for both D1 and D2 destructors. This change updates the
code to have the D1 destructor call the D2 destructor.
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenFunction.cpp')
-rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenFunction.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp index 7e1a44c..3e69e56 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp @@ -593,11 +593,12 @@ void CIRGenFunction::emitDestructorBody(FunctionArgList &args) { assert(!cir::MissingFeatures::dtorCleanups()); - // TODO(cir): A complete destructor is supposed to call the base destructor. - // Since we have to emit both dtor kinds we just fall through for now and. - // As long as we don't support virtual bases this should be functionally - // equivalent. - assert(!cir::MissingFeatures::completeDtors()); + if (!isTryBody) { + QualType thisTy = dtor->getFunctionObjectParameterType(); + emitCXXDestructorCall(dtor, Dtor_Base, /*forVirtualBase=*/false, + /*delegating=*/false, loadCXXThisAddress(), thisTy); + break; + } // Fallthrough: act like we're in the base variant. [[fallthrough]]; |