[PATCH] D74166: [AIX][Frontend] Static init implementation for AIX considering no priority

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 21:03:15 PDT 2020


hubert.reinterpretcast added inline comments.


================
Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:562
 
+static std::string getTransformedFileName(llvm::Module &M) {
+  SmallString<128> FileName = llvm::sys::path::filename(M.getName());
----------------
Consider having the `SmallString<128>` buffer passed in and returning a `StringRef` backed by that buffer.


================
Comment at: clang/lib/CodeGen/CodeGenModule.h:1056
 
+  /// Add a destructor to the C++ global destructor function.
+  void AddCXXDtorEntry(llvm::FunctionCallee DtorFn) {
----------------
What is "the C++ global destructor function"? Based on the comment on `CXXGlobalDtors` it has something to do with termination of the program. The existing usage is limited and consistent: This is a facility used when even `atexit` is not available.


================
Comment at: clang/lib/CodeGen/CodeGenModule.h:1058
+  void AddCXXDtorEntry(llvm::FunctionCallee DtorFn) {
+    CXXGlobalDtors.emplace_back(DtorFn.getFunctionType(), DtorFn.getCallee(),
+                                nullptr);
----------------
The description of `CXXGlobalDtors` is
> Global destructor functions and arguments that need to run on termination.



================
Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:4501
+
+  CGM.AddCXXDtorEntry(StermFn);
 }
----------------
The purpose of the specific interface does not appear to match its usage here (see my other comment). This function is meant to be called on unloading a shared library. The usual termination path calls destructors via `atexit`.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D74166





More information about the cfe-commits mailing list