[PATCH] D67563: Debug Info: Add support for named constants
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 16:50:38 PDT 2019
dblaikie added a comment.
In D67563#1670224 <https://reviews.llvm.org/D67563#1670224>, @aprantl wrote:
> In D67563#1670183 <https://reviews.llvm.org/D67563#1670183>, @dblaikie wrote:
>
> > Out of curiosity does swift have const in the type system like C and C++? (I guess so) - and what would be the difference between a normal (non-let) variable of a const type, versus a let variable of a non-const type?
>
>
> Swift does not have const in the type system. There are no real pointers in the language; the closest equivalent are probably constant struct members, such as:
>
> struct MyStruct {
> let i_am_a_constant : Int = 42
> var i_am_mutable : String
> }
>
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 :)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67563/new/
https://reviews.llvm.org/D67563
More information about the llvm-commits
mailing list