[llvm-branch-commits] [clang] [LifetimeSafety] Track transparent member functions for "all" GSL pointers (PR #177660)

Utkarsh Saxena via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 27 10:05:28 PST 2026


================
@@ -115,35 +116,36 @@ bool shouldTrackImplicitObjectArg(const CXXMethodDecl *Callee,
     if (isGslPointerType(Conv->getConversionType()) &&
         Callee->getParent()->hasAttr<OwnerAttr>())
       return true;
-  if (!isInStlNamespace(Callee->getParent()))
-    return false;
   if (!isGslPointerType(Callee->getFunctionObjectParameterType()) &&
       !isGslOwnerType(Callee->getFunctionObjectParameterType()))
     return false;
 
+  static const llvm::StringSet<> TransparentFns = {
+      // Begin and end iterators.
+      "begin", "end", "rbegin", "rend", "cbegin", "cend", "crbegin", "crend",
+      // Inner pointer getters.
+      "c_str", "data", "get",
+      // Map and set types.
+      "find", "equal_range", "lower_bound", "upper_bound"};
   // Track dereference operator for GSL pointers in STL. Only do so for lifetime
----------------
usx95 wrote:

Done.

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


More information about the llvm-branch-commits mailing list