[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:29:58 PDT 2024
aaryanshukla wrote:
I tested with the function class we have right now and the results are the
same, I don’t think we need to edit the class because we are appending
values so order doesn’t make a difference.
On Mon, Jul 1, 2024 at 10:26 AM RoseZhang03 ***@***.***>
wrote:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In libc/newhdrgen/yaml_to_classes.py
> <https://github.com/llvm/llvm-project/pull/97079#discussion_r1661346323>:
>
> > + """
> + 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,
>
> Ordering here is different
> ------------------------------
>
> In libc/newhdrgen/yaml_to_classes.py
> <https://github.com/llvm/llvm-project/pull/97079#discussion_r1661347279>:
>
> > + 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).
>
> Keep consistent ordering. For the patch I will go with this one.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/llvm/llvm-project/pull/97079#pullrequestreview-2151904437>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AMZZRVDJZ6MDUKHK7PARFMTZKGGL5AVCNFSM6AAAAABKCFYHH6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCNJRHEYDINBTG4>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
https://github.com/llvm/llvm-project/pull/97079
More information about the libc-commits
mailing list