[PATCH] D44619: [CodeGen] Add cleanup scope to EmitInlinedInheritingCXXConstructorCall

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 20 16:29:50 PDT 2018


rsmith added inline comments.


================
Comment at: lib/CodeGen/CGClass.cpp:2183
   ApplyInlineDebugLocation DebugScope(*this, GD);
+  RunCleanupsScope CleanupScope(*this);
 
----------------
Please add a test to ensure that we still destroy function parameters in the right order and at the right times (for both the exceptional and non-exceptional cleanup cases).


================
Comment at: test/CodeGenCXX/inheriting-constructor-cleanup.cpp:22
+// CHECK-LABEL: define void @_Z1fv
+// CHECK: call void @_ZN1SD2Ev
----------------
rnk wrote:
> The landingpad should be trivially dead, since T has nothing that throws in it, right? Clang is usually pretty smart about not emitting unused exceptional-only destructors, so I'd try to defend against it getting smart in the future. I'd put a function call `foo` in `T(int, ...)`, then CHECK for the invoke of it, and that it unwinds to a landingpad preceding this destructor call.
Maybe remove some of the function bodies so that we can't statically tell there is no possibility of unwind?


Repository:
  rC Clang

https://reviews.llvm.org/D44619





More information about the cfe-commits mailing list