[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
Thu Jan 9 06:14:05 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:
To simplify things:
```cpp
for (auto Elem : Path) {
if (Elem.Kind == IndirectLocalPathEntry::MemberExpr ||
Elem.Kind == IndirectLocalPathEntry::LambdaCaptureInit)
continue;
return Elem.Kind == IndirectLocalPathEntry::DefaultInit
? PathLifetimeKind::Extend
: PathLifetimeKind::NoExtend;
}
```
https://github.com/llvm/llvm-project/pull/122088
More information about the cfe-commits
mailing list