[PATCH] D138597: DebugInfo: Add/support new DW_LANG codes for recent C and C++ versions

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 17:47:47 PST 2022


dblaikie added a comment.

In D138597#3966638 <https://reviews.llvm.org/D138597#3966638>, @probinson wrote:

> One not-yet-asked question, does gcc produce the C++17/20 codes? If so, does fstrict-dwarf affect that?

Looks like GCC uses C++17 for both 17 and 20: https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/testsuite/g%2B%2B.dg/debug/dwarf2/lang-cpp17.C;h=a90606ab979762ce4630777c2fce5c921d0a2b96 (apparently it used to use just C_plus_plus for 20: https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/testsuite/g%2B%2B.dg/debug/dwarf2/lang-cpp17.C;h=a90606ab979762ce4630777c2fce5c921d0a2b96 )

> The major consumers of this would be lldb (which we control) and gdb, so following gcc's lead here would seem appropriate.  I can accept that listing the codes on the website "counts" as in-spec for fstrict-dwarf purposes.

Yeah, I'm leaning towards just not implementing the v5 bonus codes - they're good for new languages, but for existing languages the risk of regression seems not worth the benefit.

I left the test cases in - easy to tweak them when we decide how to render this - and left some minor refactoring in that I could pull out/commit separately.

I still haven't heard from the internal user that seemed pretty adamant that expressing these newer versions was important... I can't really picture (relative to all the other debug info incompletenessess) why it would be especially important.



================
Comment at: llvm/lib/IR/DIBuilder.cpp:159
 
-  assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
+  assert(((Lang <= dwarf::DW_LANG_Ada2012 && Lang >= dwarf::DW_LANG_C89) ||
           (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
----------------
aprantl wrote:
> Should we define a DW_LANG_HI_DWARF in the .def file?
Maybe? I'm not sure - if it has to explicitly write the constant or another enum value in there, I think it's as liable to get missed when updating as this code, perhaps? Open to ideas.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138597



More information about the llvm-commits mailing list