[clang] [LifetimeSafety] Track dereference operators for GSL pointers in STL (PR #176643)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 19 03:29:20 PST 2026


================
@@ -99,6 +99,13 @@ bool shouldTrackImplicitObjectArg(const CXXMethodDecl *Callee) {
   if (!isGslPointerType(Callee->getFunctionObjectParameterType()) &&
       !isGslOwnerType(Callee->getFunctionObjectParameterType()))
     return false;
+
+  // Track dereference operator for GSL pointers in STL.
+  if (isGslPointerType(Callee->getFunctionObjectParameterType()))
+    if (const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(Callee))
----------------
Xazax-hun wrote:

I am a bit confused here, why do we need this `dyn_cast_or_null` here?

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


More information about the cfe-commits mailing list