[llvm] [LLVM] Doc sret only works with void returns (PR #112167)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 01:21:25 PDT 2024


https://github.com/workingjubilee created https://github.com/llvm/llvm-project/pull/112167

This was discussed on Discord by schombert and @nikic.

>From 25c8a7f586958acbc36700aa910aca941038002a Mon Sep 17 00:00:00 2001
From: Jubilee Young <workingjubilee at gmail.com>
Date: Mon, 14 Oct 2024 01:11:09 -0700
Subject: [PATCH] [llvm] Doc sret only works with void returns

---
 llvm/docs/LangRef.rst | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 6fa35486669d69..d835ab0d2a93f1 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -1309,12 +1309,14 @@ Currently, only the following parameter attributes are defined:
     structure that is the return value of the function in the source
     program. This pointer must be guaranteed by the caller to be valid:
     loads and stores to the structure may be assumed by the callee not
-    to trap and to be properly aligned. This is not a valid attribute
-    for return values.
+    to trap and to be properly aligned.
 
     The sret type argument specifies the in memory type, which must be
     the same as the pointee type of the argument.
 
+    A function that accepts an ``sret`` argument must return ``void``.
+    A return value may not be ``sret``.
+
 .. _attr_elementtype:
 
 ``elementtype(<ty>)``



More information about the llvm-commits mailing list