================
@@ -1239,11 +1239,12 @@ static AnalysisResult analyzePathForGSLPointer(const
IndirectLocalPath &Path,
}
// Check the return type, e.g.
// const GSLOwner& func(const Foo& foo [[clang::lifetimebound]])
+ // GSLOwner* func(cosnt Foo& foo [[clang::lifetimebound]])
// GSLPointer func(const Foo& foo [[clang::lifetimebound]])
if (FD &&
- ((FD->getReturnType()->isReferenceType() &&
+ ((FD->getReturnType()->isPointerOrReferenceType() &&
isRecordWithAttr<OwnerAttr>(FD->getReturnType()->getPointeeType()))
||
- isPointerLikeType(FD->getReturnType())))
+ isGLSPointerType(FD->getReturnType())))
----------------
usx95 wrote:
Since this is on GSL init path, the case mentioned should not be affected.
I also there are related tests already present:
```
std::unique_ptr<int> getUniquePtr();
int *danglingUniquePtrFromTemp() {
return getUniquePtr().get(); // expected-warning {{returning address of local
temporary object}}
}
int *danglingUniquePtrFromTemp2() {
return std::unique_ptr<int>().get(); // expected-warning {{returning address
of local temporary object}}
}
```
So this should be good to go.
https://github.com/llvm/llvm-project/pull/127460
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits