[PATCH] D119178: Add support for generating debug-info for structured bindings of structs and arrays

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 12:25:29 PST 2022


shafik created this revision.
shafik added reviewers: aprantl, dblaikie.
shafik requested review of this revision.

Currently we are not emitting debug-info for all cases of structured bindings a C++17 feature which allows us to bind names to subobjects in an initializer.

A structured binding is represented by a `DecompositionDecl` AST node and the binding are represented by a `BindingDecl`. It looks the original implementation
only covered the tuple like case which be represented by a `DeclRefExpr` which contains a `VarDecl`.

If the binding is to a subobject of the struct the binding will contain a `MemberExpr` and in the case of arrays it will contain an `ArraySubscriptExpr`.
This PR adds support emitting debug-info for the `MemberExpr` and `ArraySubscriptExpr` cases as well as llvm and lldb tests for these cases as well as the tuple case.


https://reviews.llvm.org/D119178

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGenCXX/debug-info-structured-binding.cpp
  lldb/test/API/lang/cpp/structured-binding/Makefile
  lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
  lldb/test/API/lang/cpp/structured-binding/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119178.406567.patch
Type: text/x-patch
Size: 14187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220207/fef66db8/attachment.bin>


More information about the cfe-commits mailing list