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

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 05:54:13 PDT 2019


probinson added a comment.

In D67563#1669814 <https://reviews.llvm.org/D67563#1669814>, @dblaikie wrote:

> What's a "true named constant" as opposed to, say, C++ (or C's) "const int X = 3;" (well, I guess const int X could be defined by a runtime expression, - OK, what about "constexpr int X = 3;" then?)


My take is, const and constexpr distinguish the set of possible uses of a variable; they don't turn the item into something that is not a variable.  You can still take its address, for example.  By that criterion, C and C++ don't have true named constants.

DW_TAG_constant is aimed more at other languages where constants are considered a different kind of language entity. The DWARF doc has examples from Fortran; I know Pascal and COBOL have them.


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

https://reviews.llvm.org/D67563





More information about the llvm-commits mailing list