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

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 12:02:22 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)";
 }
 
 def RecvFrom : LibBuiltin<"sys/socket.h"> {
   let Spellings = ["recvfrom"];
-  let Attributes = [IgnoreSignature];
-  // ssize_t(int, void*, size_t, int, struct sockaddr*, socklen_t*);
-  // types are target-specific
-  let Prototype = "";
+  let Prototype = "ssize_t(int, void*, size_t, int, struct sockaddr*, socklen_t*)";
+  let WindowsPrototype = "int(size_t, char*, int, int, struct sockaddr*, int*)";
 }
 
 // POSIX poll.h
 
 def Poll : LibBuiltin<"poll.h"> {
   let Spellings = ["poll"];
-  let Attributes = [IgnoreSignature];
-  // int(struct pollfd*, nfds_t, int); struct pollfd and nfds_t are
-  // target-specific
-  let Prototype = "";
+  let Prototype = "int(struct pollfd*, nfds_t, int)";
----------------
efriedma-quic wrote:

Maybe we want to require writing something like `int(struct pollfd*, typedef nfds_t, int)`, so it's clear nfds_t isn't a known type?


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


More information about the cfe-commits mailing list