[clang] [Clang][Builtins] Support typedefs and struct tags in LibBuiltin prototypes (PR #231696)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 23 11:55:26 PST 2026


================
@@ -3914,44 +3914,39 @@ def VFork : LibBuiltin<"unistd.h"> {
 
 def Umask : LibBuiltin<"sys/stat.h"> {
   let Spellings = ["umask"];
-  let Attributes = [IgnoreSignature, NoThrow];
-  let Prototype = ""; // mode_t(mode_t); mode_t is target-specific
+  let Attributes = [NoThrow];
+  let Prototype = "mode_t(mode_t)";
 }
 
 // POSIX sys/socket.h
 
 def Recv : LibBuiltin<"sys/socket.h"> {
   let Spellings = ["recv"];
-  let Attributes = [IgnoreSignature];
-  // ssize_t(int, void*, size_t, int); ssize_t is target-specific
-  let Prototype = "";
+  let Prototype = "ssize_t(int, void*, size_t, int)";
+  let WindowsPrototype = "int(size_t, char*, int, int)";
----------------
AaronBallman wrote:

If we're going to the trouble of allowing typedef types for which we don't have a definition, why not use `SOCKET` instead of `size_t`? `SOCKET` is a typedef of `UINT_PTR` which itself is a typedef of `unsigned int` that's either 32- or 64-bit, so `size_t` isn't *wrong* per se. But is seems a bit odd to see it for the API. (Same is true for `recvfrom`.) How far down the rabbit hole do we want to go with these signatures?

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


More information about the cfe-commits mailing list