https://github.com/usx95 created 
https://github.com/llvm/llvm-project/pull/131997

None

>From 9220b14a8147850a39e2c9bdf1188f2135b7a0ae Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena <u...@google.com>
Date: Wed, 19 Mar 2025 10:25:07 +0000
Subject: [PATCH] [clang] Do not infer lifetimebound for functions with void
 return type

---
 clang/lib/Sema/SemaAttr.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp
index defdda17c32de..a6e827a421134 100644
--- a/clang/lib/Sema/SemaAttr.cpp
+++ b/clang/lib/Sema/SemaAttr.cpp
@@ -217,7 +217,7 @@ void Sema::inferGslOwnerPointerAttribute(CXXRecordDecl 
*Record) {
 }
 
 void Sema::inferLifetimeBoundAttribute(FunctionDecl *FD) {
-  if (FD->getNumParams() == 0)
+  if (FD->getNumParams() == 0 || FD->getReturnType()->isVoidType())
     return;
 
   if (unsigned BuiltinID = FD->getBuiltinID()) {

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to