[PATCH] [ms-cxxabi] Get closer to emitting the correct set of destructors in each TU (PR12784).
Peter Collingbourne
peter at pcc.me.uk
Sun May 19 15:29:42 PDT 2013
> Am I right that you plan to fix this case in the forthcoming patches?
Yes, this can be fixed later.
> Is is possible to split this patch into "fix the base vs complete dtor logic in MS ABI" (should be simple enough)
and then have a separate "handle array delete in MS ABI, with tests" patches?
I decided to split this patch up by more than that; see D819, D820, D821, D822, D823, D824.
================
Comment at: test/CodeGenCXX/microsoft-abi-static-initializers.cpp:14
@@ -13,3 +13,3 @@
// CHECK: define internal void @"__dtor_\01?s@@3US@@A"() [[NUW]] {
-// CHECK: call x86_thiscallcc void @"\01??1S@@QAE at XZ"
+// CHECK: call x86_thiscallcc void @"\01??_DS@@QAE at XZ"
// CHECK: ret void
----------------
Timur Iskhodzhanov wrote:
> Should be "?1S@@...", otherwise you might get errors when linking TU compiled with different compilers, right?
Well, we will always define _D when needed, so I don't think so. (Besides, the inliner should take care of this for us at >= -O1). I modified this test to make sure we're emitting _D even when the destructor has no body.
================
Comment at: lib/CodeGen/CodeGenModule.cpp:1223
@@ -1208,2 +1222,3 @@
return true;
if (CodeGenOpts.OptimizationLevel == 0 &&
+ !GD.getDecl()->hasAttr<AlwaysInlineAttr>() &&
----------------
Timur Iskhodzhanov wrote:
> how about
>
> const FunctionDecl *F = GD.getDecl();
>
> before the second if?
Done.
================
Comment at: test/CodeGenCXX/microsoft-abi-structors.cpp:69
@@ +68,3 @@
+// DTOR3: %[[FLAGS_VALUE:[0-9a-z._]+]] = load i32* %[[FLAGS_VAR]]
+// DTOR3: call x86_thiscallcc void @"\01??_DC at basic@@UAE at XZ"(%"struct.basic::C"* %[[THIS:[0-9a-z]+]])
+// DTOR3-NEXT: %[[CONDITION:[0-9]+]] = icmp eq i32 %[[FLAGS_VALUE]], 0
----------------
Timur Iskhodzhanov wrote:
> Should be "?1C at ..." here.
I don't think it needs to be, for the same reason.
================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:277
@@ -273,3 +276,3 @@
} else if (IsDeletingDtor(CGF.CurGD)) {
- ImplicitParamDecl *ShouldDelete
+ ImplicitParamDecl *Flags
= ImplicitParamDecl::Create(Context, 0,
----------------
Timur Iskhodzhanov wrote:
> Can you please document that the least significant bit is "whether need to call operator delete at the end" and the second least significant bit is "whether a polymorphic array delete" ?
Done.
http://llvm-reviews.chandlerc.com/D746
More information about the cfe-commits
mailing list