[PATCH] D70696: [DebugInfo] Support to emit debugInfo for extern variables

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 11:58:51 PST 2019


probinson added a comment.

In D70696#1765675 <https://reviews.llvm.org/D70696#1765675>, @yonghong-song wrote:

> It is just strange that gcc 7.3.1 (did not test, but maybe later gcc versions as well) emits the debuginfo (encoded in dwarf)
>  even if the external variable is not used in the current compilation unit. Not sure what is the rationale behind it.


If it were me, it would be because the declaration is available in the current CU, therefore if the debugger is stopped somewhere in the CU, the symbol should be available to the debugger.  Having the external declaration means you don't need to go rooting around in other CUs for the symbol.

This is just one of those trade-offs that producers and consumers make, regarding completeness of information versus bloat of unnecessary information.  There is no "right" answer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70696





More information about the cfe-commits mailing list