https://github.com/localspook created 
https://github.com/llvm/llvm-project/pull/183882

None

>From 80cf41c5ccb8270a80820e99b1351ed5806818d9 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <[email protected]>
Date: Fri, 27 Feb 2026 21:43:59 -0800
Subject: [PATCH] [clang] Teach `IgnoreUnlessSpelledInSource` to ignore
 implicit calls to member functions with explicit object parameter

---
 clang/lib/AST/Expr.cpp | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 9632d88fae4e4..ce79ad6928b02 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -2550,18 +2550,6 @@ Stmt *BlockExpr::getBody() {
 // Generic Expression Routines
 
//===----------------------------------------------------------------------===//
 
-/// Helper to determine wether \c E is a CXXConstructExpr constructing
-/// a DecompositionDecl. Used to skip Clang-generated calls to std::get
-/// for structured bindings.
-static bool IsDecompositionDeclRefExpr(const Expr *E) {
-  const auto *Unwrapped = E->IgnoreUnlessSpelledInSource();
-  const auto *Ref = dyn_cast<DeclRefExpr>(Unwrapped);
-  if (!Ref)
-    return false;
-
-  return isa_and_nonnull<DecompositionDecl>(Ref->getDecl());
-}
-
 bool Expr::isReadIfDiscardedInCPlusPlus11() const {
   // In C++11, discarded-value expressions of a certain form are special,
   // according to [expr]p10:
@@ -3178,7 +3166,8 @@ Expr *Expr::IgnoreUnlessSpelledInSource() {
   };
 
   // Used when Clang generates calls to std::get for decomposing
-  // structured bindings.
+  // structured bindings or for implicit calls to member functions
+  // with explicit object parameters.
   auto IgnoreImplicitCallSingleStep = [](Expr *E) {
     auto *C = dyn_cast<CallExpr>(E);
     if (!C)
@@ -3197,12 +3186,7 @@ Expr *Expr::IgnoreUnlessSpelledInSource() {
     if (A->getSourceRange() != E->getSourceRange())
       return E;
 
-    // If the argument refers to a DecompositionDecl construction,
-    // ignore it.
-    if (IsDecompositionDeclRefExpr(A))
-      return A;
-
-    return E;
+    return A;
   };
 
   return IgnoreExprNodes(

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to