[clang] [clang] Refine the temporay object member access filtering for GSL pointer (PR #122088)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 8 03:52:30 PST 2025


================
@@ -1103,6 +1094,8 @@ shouldLifetimeExtendThroughPath(const IndirectLocalPath &Path) {
   for (auto Elem : Path) {
     if (Elem.Kind == IndirectLocalPathEntry::DefaultInit)
       return PathLifetimeKind::Extend;
+    if (Elem.Kind == IndirectLocalPathEntry::MemberExpr)
+      continue;
----------------
usx95 wrote:

Is this necessary for this case `const Bar& bar = foo.v.back(); // OK` ?

https://github.com/llvm/llvm-project/pull/122088


More information about the cfe-commits mailing list