[clang] [clang] Don't consider the lifetimeboundCall when analyzing the gsl pointer construction. (PR #114044)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 04:53:43 PDT 2024


================
@@ -1094,6 +1094,24 @@ static bool pathOnlyHandlesGslPointer(IndirectLocalPath &Path) {
   return false;
 }
 
+static bool
+isLifetimeboundInterleaveInGSL(llvm::ArrayRef<IndirectLocalPathEntry> PathRef) {
----------------
Xazax-hun wrote:

> The Path is [GslPointerInit, Lifetimebound]

I was wondering if we can also look at the types here. I think initializing a `gsl::Pointer` with another lifetimebound `gsl::Pointer` is probably fine. But initializing a `gsl::Pointer` with a lifetimebound reference is not OK, because it is the reference that has the lifetime information but the `gsl::Pointer` is more likely to be initialized with the pointee of the reference rather than the reference itself in this particular scenario.

I am not opposed to the current approach though if what I suggest is hard to implement.

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


More information about the cfe-commits mailing list