[libc-commits] [libc] [libc][docs] Introduce docgen (PR #87682)
Justin Stitt via libc-commits
libc-commits at lists.llvm.org
Fri Apr 5 15:08:05 PDT 2024
================
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+#
+# ====- Generate documentation for libc functions ------------*- python -*--==#
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ==-------------------------------------------------------------------------==#
+from argparse import ArgumentParser
+from pathlib import Path
+import sys
+import yaml
+
+
+def load_api():
+ p = Path(Path(__file__).resolve().parent, "api.yml")
+ api = p.read_text(encoding="utf-8")
+ return yaml.load(api, Loader=yaml.FullLoader)
+
+
+# TODO: we may need to get more sophisticated for less generic implementations.
+# Does libc/src/{hname minus .h suffix}/{fname}.cpp exist?
+def is_implemented(hname, fname):
----------------
JustinStitt wrote:
@nickdesaulniers stuff like pylance, [ruff](https://github.com/astral-sh/ruff) or [basedpyright](https://github.com/DetachHead/basedpyright) can parse these type hints.
count me as a +1 for type-hinting everywhere!
https://github.com/llvm/llvm-project/pull/87682
More information about the libc-commits
mailing list