[libc-commits] [libc] [libc][search] implement posix `lfind` function (PR #114692)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Nov 4 09:44:05 PST 2024


================
@@ -1618,6 +1618,17 @@ def POSIX : StandardSpec<"POSIX"> {
                 ArgSpec<VoidPtr>
             ]
         >,
+        FunctionSpec<
+            "lfind",
+            RetValSpec<VoidPtr>,
+            [
+                ArgSpec<VoidPtr>,
+                ArgSpec<VoidPtr>,
+                ArgSpec<SizeTPtr>,
+                ArgSpec<SizeTType>,
+                // TODO: Unsure how to specify int(*compar)(void *, void *)
----------------
nickdesaulniers wrote:

You'd have to declare a type for the function pointer first, then use that as an ArgSpec.   If you look at how other functions that have function pointer parameters, such as bsearch or qsort, those should provide an example.

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


More information about the libc-commits mailing list