[PATCH] D103131: support debug info for alias variable

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 26 13:27:27 PDT 2021


probinson added a comment.

In D103131#2780997 <https://reviews.llvm.org/D103131#2780997>, @dblaikie wrote:

> Looks like GCC emits aliases as a `DW_TAG_variable` without a location, not as a `DW_TAG_imported_declaration`

and marks it external; this works only because gdb will look up the ELF symbol when you say `p newname`.  I've known debuggers that wouldn't do that.  I think the `DW_TAG_imported_declaration` is making fewer assumptions about debugger behavior.



================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:4954
+  llvm::DIScope *DContext = getDeclContextDescriptor(D);
+  if (llvm::DINode *Target = getDeclarationOrDefinition(D)) {
+    auto Loc = D->getLocation();
----------------
The variables Unit and DContext are used only inside the `if` so I would put those two variables inside the `if` as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103131



More information about the cfe-commits mailing list