yonghong-song added a comment.

@SouraVX Currently, I filtered all external globals if they are not used. See

  for (auto D: ExternalDeclarations) {
    if (!D || D->isInvalidDecl() || D->getPreviousDecl() || !D->isUsed())
      continue;
  
    Consumer.CompleteExternalDeclaration(D);
  }

If I remove `!D->isUsed()`, I should be able to generate the debuginfo for 
`global_var` and eventually in dwarf in your above case.

I tested with gcc 7.3.1, indeed gcc generates dwarf info for `global_var` as 
you stated in the above.

What exactly your use case here for these unused external variables?

I would like to hear comments from llvm/clang debuginfo experts before making 
the change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70696



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

Reply via email to