[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 08:42:38 PDT 2019


dblaikie added a comment.

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

> Swift's `let` is indeed closer to C's `const` than to a named constant in Pascal (https://wiki.freepascal.org/Constants). The Swift language spec call them constants, and they are effectively SSA variables (with storage). But (and this is where it differs from Pascal constants) `let` bindings can also appear inside of composite types (there are `let` struct and class members) and as function arguments (unless a parameter is explicitly marked as `inout`, similar to Fortran). I have found that `DW_TAG_const` is the only mechanism that works for all of these use-cases.


Adding an attribute for "I'm a 'let'" to DW_TAG_variable, DW_TAG_formal_parameter and DW_TAG_member I don't think would've been the end of the world/worst thing, but DW_TAG_const does seem like a closer general model as far as DWARF is concerned, yeah.


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

https://reviews.llvm.org/D67563





More information about the llvm-commits mailing list