[llvm-branch-commits] [clang] [LifetimeSafety] Add support for GSL Pointer types (PR #154009)

Yitzhak Mandelbaum via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 5 06:51:45 PDT 2025


================
@@ -570,6 +625,31 @@ class FactGenerator : public ConstStmtVisitor<FactGenerator> {
     return isPointerType(VD->getType());
   }
 
+  /// Checks if a call-like expression creates a borrow by passing a value to a
+  /// reference parameter, creating an IssueFact if it does.
+  void handleFucntionCall(const Expr *Call, const FunctionDecl *FD,
+                          ArrayRef<const Expr *> Args) {
+    if (!FD)
+      return;
+    auto isCXXThisIdx = [&](int ArgIdx) {
+      return FD->isCXXClassMember() && ArgIdx == 0;
+    };
----------------
ymand wrote:

nit: Why define a lambda here? It's not passed to anything and it's only called once, so unclear why it's not inline.

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


More information about the llvm-branch-commits mailing list