[libc-commits] [libc] [libc] implemented add_function to yaml hdrgen (PR #97079)
via libc-commits
libc-commits at lists.llvm.org
Mon Jul 1 10:26:07 PDT 2024
================
@@ -103,16 +102,92 @@ def fill_public_api(header_str, h_def_content):
return h_def_content.replace("%%public_api()", header_str, 1)
-def main(yaml_file, h_def_file, output_dir):
+def parse_function_details(details):
+ """
+ Parse function details from a list of strings and return a Function object.
+
+ Args:
+ details: A list containing function details
+
+ Returns:
+ Function: An instance of Function initialized with the details.
+ """
+ return_type, name, arguments, standards, guard, attributes = details
+ standards = standards.split(",") if standards != "null" else []
+ arguments = [arg.strip() for arg in arguments.split(",")]
+ attributes = attributes.split(",") if attributes != "null" else []
+
+ return Function(
+ name=name,
+ standards=standards,
+ return_type=return_type,
+ arguments=arguments,
+ guard=guard if guard != "null" else None,
+ attributes=attributes if attributes else None,
+ )
+
+
+def add_function_to_yaml(yaml_file, function_details):
+ """
+ Add a function to the YAML file.
+
+ Args:
+ yaml_file: The path to the YAML file.
+ function_details: A list containing function details (return_type, name, arguments, standards, guard, attributes).
----------------
RoseZhang03 wrote:
Keep consistent ordering. For the patch I will go with this one.
https://github.com/llvm/llvm-project/pull/97079
More information about the libc-commits
mailing list