================
@@ -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
   // safety analysis and not for Sema's statement-local analysis as it starts
   // to have false-positives.
   if (RunningUnderLifetimeSafety &&
-      isGslPointerType(Callee->getFunctionObjectParameterType()) &&
-      (Callee->getOverloadedOperator() == OverloadedOperatorKind::OO_Star ||
-       Callee->getOverloadedOperator() == OverloadedOperatorKind::OO_Arrow))
-    return true;
+      isGslPointerType(Callee->getFunctionObjectParameterType())) {
+    if (Callee->getOverloadedOperator() == OverloadedOperatorKind::OO_Star ||
+        Callee->getOverloadedOperator() == OverloadedOperatorKind::OO_Arrow)
+      return true;
+    if (Callee->getIdentifier() && TransparentFns.contains(Callee->getName()))
----------------
usx95 wrote:

Added. But for both reference and pointer-like type.

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

Reply via email to