[clang] [lldb] [clang][Expr] Teach IgnoreUnlessSpelledInSource about implicit calls to std::get free function (PR #122265)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 19 04:22:05 PDT 2025
================
@@ -2544,6 +2544,19 @@ Stmt *BlockExpr::getBody() {
//===----------------------------------------------------------------------===//
// Generic Expression Routines
//===----------------------------------------------------------------------===//
+namespace {
+/// Helper to determine wether \c E is a CXXConstructExpr constructing
+/// a DecompositionDecl. Used to skip Clang-generated calls to std::get
+/// for structured bindings.
+bool IsDecompositionDeclRefExpr(const Expr *E) {
+ const Expr *Unrwapped = E->IgnoreUnlessSpelledInSource();
+ const DeclRefExpr *Ref = llvm::dyn_cast_or_null<DeclRefExpr>(Unrwapped);
+ if (!Ref)
+ return false;
+
+ return llvm::isa_and_nonnull<DecompositionDecl>(Ref->getDecl());
----------------
cor3ntin wrote:
```suggestion
return isa_and_nonnull<DecompositionDecl>(Ref->getDecl());
```
https://github.com/llvm/llvm-project/pull/122265
More information about the cfe-commits
mailing list