[PATCH] D67563: Debug Info: Add support for named constants

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 07:23:20 PDT 2019


dblaikie added a comment.

In D67563#1670227 <https://reviews.llvm.org/D67563#1670227>, @aprantl wrote:

> In D67563#1670226 <https://reviews.llvm.org/D67563#1670226>, @dblaikie wrote:
>
> > Would seem to me (with an obvious C++ bias in my view of the world) that it maps best to i_am_a_constant being a DW_TAG_variable (or function_parameter) with a DW_TAG_const_type  that has a base type of "Int" (however that's represented).
> >
> > But I realize that might not be a good fit for Swift/its debuggers, etc, and certainly tend to leave this up to whatever you folks want to do with your language. Just my 2c :)
>
>
> It's not elegant in LLDB to peel the constness out of the type and attach it to the variable (the code that takes a DWARF type and returns a Swift type would need to ignore it and the code that builds an lldb_private::Variable needs to look into the DW_AT_type), but certainly doable, and implementation details of one specific debugger shouldn't really affect this decision. The prevalence of let-bindings may cause debug info to blow up a bit with all the extra DW_TAG_const_types, but that's not going to be a showstopper either.


Fair - I don't have so much experience with those sort of languages so perhaps haven't ever dealt with the concept that's trying to be described here.

I wonder, then, about a "constexpr T&" - maybe that's closer to a "true constant" - you can't take its address? (references have no address, as far as the language is concerned - maybe not-even-constexpr T& is a "true constant" (but only allows "address constants" not other things like integers to have similar handling)).

& maybe 'let' is more like a const T than it is one of these "true constant" things? (sounds like that's where Adrian's going with it now anyway)


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

https://reviews.llvm.org/D67563





More information about the llvm-commits mailing list