hubert.reinterpretcast added inline comments.

================
Comment at: clang/include/clang/AST/Mangle.h:178
 
+  virtual void mangleDynamicDestructor(const VarDecl *D, raw_ostream &Out) = 0;
+
----------------
I am not sure "destructor" is the right term here. This seems to be an analogue 
to the functions named using `mangleDynamicAtExitDestructor`, except that those 
rather directly perform destruction and are registered with `atexit` during 
initialization whereas these perform finalization and are "registered" by being 
called from an "sterm" function. What are the thoughts on 
`mangleDynamicStermFinalizer`?


================
Comment at: clang/lib/AST/ItaniumMangle.cpp:5217
+  else
+    Mangler.getStream() << D->getName();
+}
----------------
Xiangling_L wrote:
> jasonliu wrote:
> > If I understand correctly, this function will come in pair with 
> > `__cxx_global_var_init`.
> > `__cxx_global_var_init` use number as suffix in the end to avoid 
> > duplication when there is more than one of those, but we are using the 
> > variable name as suffix here instead.
> > Do we want to use number as suffix here to match what 
> > `__cxx_global_var_init` does? It would help people to recognize the pairs 
> > and make them more symmetric. 
> This is somewhere I am kinda on the fence. Personally, I think embed decl 
> name in the __cxx_global_var_destruct_ / __cxx_global_vat_init_ as 
> `mangleDynamicAtExitDestructor` does is more helpful for the user to debug 
> the static init.
> I am not sure if we want to give up that benefit and be consistent with 
> current `__cxx_global_vat_init_ ` using number suffix or do we want to 
> replace number suffix by decl name for `__cxx_global_vat_init_ ` as well.
Not every dynamically initialized non-local variable of static storage duration 
requires non-trivial destruction. These don't actually pair with 
`__cxx_global_var_init`; rather, they pair with the calls to `atexit` and the 
functions whose addresses are passed to `atexit`.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74166/new/

https://reviews.llvm.org/D74166



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to