[PATCH] D83702: [AIX]Generate debug info for static init related functions

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 13 17:15:16 PDT 2020


dblaikie added inline comments.


================
Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:248-250
   CGF.StartFunction(GlobalDecl(&VD, DynamicInitKind::AtExit),
-                    CGM.getContext().VoidTy, fn, FI, FunctionArgList());
+                    CGM.getContext().VoidTy, fn, FI, FunctionArgList(),
+                    VD.getLocation(), VD.getInit()->getExprLoc());
----------------
hubert.reinterpretcast wrote:
> dblaikie wrote:
> > Any ideas why this is only showing up for AIX & not other targets, given this code looks to be generic, not AIX-specific?
> Yes, because the AIX implementation generates a direct call to the stub function on the finalization path when it finds that a stub was still registered with `atexit`.
> 
> That would explain why other platforms to not encounter this message:
> ```
> inlinable function call in a function with debug info must have a !dbg location
> ```
> 
Ah, fair enough - thanks for the context!


================
Comment at: clang/test/CodeGenCXX/aix-static-init-debug-info.cpp:9-19
+int a = 0;
+
+class X {
+public:
+  X() {
+    a = 1;
+  }
----------------
dblaikie wrote:
> This could probably be simplified to:
> ```
> struct X {
>   X();
>   ~X();
> };
> ```
> 
> This would still produce a global ctor and dtor without the superfluous variable, etc.
Could you simplify the test a bit like this? If it's only about the global /dtor/, perhaps omit the ctor in X too.

& which exact call in the test is the important one? Perhaps just test that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83702





More information about the cfe-commits mailing list