kashika0112 wrote:

> > The false-positives look much better now.
> > I think the `vector_of_pointer` is still quite problematic.
> 
> ​I figured the following would fix it:
> 
> ```diff
> diff --git a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp 
> b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp index 
> 3f1d9842f951..32795e6dfa4f 100644
> --- a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
> +++ b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
> @@ -919,7 +919,7 @@ void FactsGenerator::handleLifetimeCaptureBy(const 
> FunctionDecl *FD,
>        continue;
>      if (QualType ParamType = PVD->getType();
>          ParamType->isReferenceType() &&
> -        isGslPointerType(ParamType->getPointeeType())) {
> +        isPointerLikeType(ParamType->getPointeeType())) {
>        if (CapturedOriginList->getLength() > 1) {
>          CapturedOriginList = CapturedOriginList->peelOuterOrigin();
>        }
> ```
> 
> This is because we have reference to pointers and we need to peel an origin 
> same as reference to view types.

Thanks for providing this. I have updated the `handleLifetimeCaptureBy` 
function to use `isPointerLikeType` instead of `isGslPointerType`.

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

Reply via email to