hubert.reinterpretcast added inline comments.
================
Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:4790
+ llvm::Value *Arg2 = llvm::ConstantExpr::getBitCast(
+ cast<llvm::Constant>(dtor.getCallee()), FpTy);
+ CGF.EmitNounwindRuntimeCall(AtExit, {Arg1, Arg2});
----------------
The function registered needs to be something more like what `createAtExitStub`
stub creates. Otherwise, the destructor will not be able to reference `*this`
correctly.
As it is, the registered function is currently just the destructor itself:
```
$ clang++ -target powerpc64-ibm-aix -emit-llvm -S -o - -xc++ -<<<$'struct A {
~A(); }; thread_local A a;' | grep -C2 __pt_atexit_np
define internal void @__cxx_global_var_init() #0 {
entry:
%0 = call i32 (i32, i32 (i32, ...)*, ...) @__pt_atexit_np(i32 0, i32 (i32,
...)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to i32 (i32, ...)*)) #3
ret void
}
--
declare void @_ZN1AD1Ev(%struct.A* nonnull align 1 dereferenceable(1))
unnamed_addr #1
declare i32 @__pt_atexit_np(i32, i32 (i32, ...)*, ...)
; Function Attrs: noinline
Return: 0x00:0 Mon Jul 12 15:24:15 2021 EDT
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104420/new/
https://reviews.llvm.org/D104420
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits