================
@@ -521,19 +529,96 @@ class LifetimeChecker {
     }
   }
 
+  std::optional<LifetimeBoundParamInfo>
+  getLifetimeBoundParamInfo(const FunctionDecl *FD, unsigned I) {
+    const ParmVarDecl *PVD = nullptr;
+    if (const auto *Method = dyn_cast<CXXMethodDecl>(FD);
+        Method && Method->isInstance() && !isa<CXXConstructorDecl>(FD)) {
+      if (I == 0)
+        return implicitObjectParamIsLifetimeBound(Method)
+                   ? std::optional<LifetimeBoundParamInfo>(
+                         LifetimeBoundParamInfo(Method))
+                   : std::nullopt;
+      if ((I - 1) < Method->getNumParams())
+        PVD = Method->getParamDecl(I - 1);
+    } else if (I < FD->getNumParams()) {
+      PVD = FD->getParamDecl(I);
+    }
+
+    if (PVD && PVD->hasAttr<clang::LifetimeBoundAttr>())
+      return LifetimeBoundParamInfo(PVD);
+    return std::nullopt;
+  }
+
+  std::optional<LifetimeBoundParamInfo>
+  getLifetimeBoundParamInfo(const Expr *Call, OriginID SrcOriginID) {
----------------
iitianpushkar wrote:

Ohh, ok. Thanks for making it clear. I will update the patch accordingly.

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

Reply via email to