[libc-commits] [libc] [libc] reordered Function class parameters and moved yaml files (PR #97329)

via libc-commits libc-commits at lists.llvm.org
Mon Jul 1 10:36:40 PDT 2024


https://github.com/RoseZhang03 created https://github.com/llvm/llvm-project/pull/97329

Reordered Function class parameter "standards" to make more logical
sense and to match the ordering in the add_function function.
Deleted the yaml_combined folder and moved contained files to the yaml
folder.


>From 870d58fe93597be358982a923e6634a8b153e4b0 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Mon, 1 Jul 2024 17:31:21 +0000
Subject: [PATCH] [libc] reordered Function class parameters and moved yaml
 files

Reordered Function class parameter "standards" to make more logical
sense and to match the ordering in the add_function function.
Deleted the yaml_combined folder and moved contained files to the yaml
folder.
---
 libc/newhdrgen/class_implementation/classes/function.py | 4 ++--
 libc/newhdrgen/{yaml_combined => yaml}/ctype.yaml       | 0
 libc/newhdrgen/{yaml_combined => yaml}/fenv.yaml        | 0
 libc/newhdrgen/{yaml_combined => yaml}/math.yaml        | 0
 libc/newhdrgen/{yaml_combined => yaml}/pthread.yaml     | 0
 libc/newhdrgen/{yaml_combined => yaml}/sched.yaml       | 0
 libc/newhdrgen/{yaml_combined => yaml}/signal.yaml      | 0
 libc/newhdrgen/{yaml_combined => yaml}/stdfix.yaml      | 0
 libc/newhdrgen/{yaml_combined => yaml}/stdio.yaml       | 0
 libc/newhdrgen/{yaml_combined => yaml}/stdlib.yaml      | 0
 libc/newhdrgen/{yaml_combined => yaml}/string.yaml      | 0
 libc/newhdrgen/{yaml_combined => yaml}/strings.yaml     | 0
 libc/newhdrgen/{yaml_combined => yaml}/sys_mman.yaml    | 0
 libc/newhdrgen/{yaml_combined => yaml}/sys_wait.yaml    | 0
 libc/newhdrgen/{yaml_combined => yaml}/time.yaml        | 0
 libc/newhdrgen/yaml_to_classes.py                       | 2 +-
 16 files changed, 3 insertions(+), 3 deletions(-)
 rename libc/newhdrgen/{yaml_combined => yaml}/ctype.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/fenv.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/math.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/pthread.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/sched.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/signal.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/stdfix.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/stdio.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/stdlib.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/string.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/strings.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/sys_mman.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/sys_wait.yaml (100%)
 rename libc/newhdrgen/{yaml_combined => yaml}/time.yaml (100%)

diff --git a/libc/newhdrgen/class_implementation/classes/function.py b/libc/newhdrgen/class_implementation/classes/function.py
index 3c464e48b6e3b..27219bfd3f611 100644
--- a/libc/newhdrgen/class_implementation/classes/function.py
+++ b/libc/newhdrgen/class_implementation/classes/function.py
@@ -11,14 +11,14 @@
 
 class Function:
     def __init__(
-        self, standards, return_type, name, arguments, guard=None, attributes=[]
+        self, return_type, name, arguments, standards, guard=None, attributes=[]
     ):
-        self.standards = standards
         self.return_type = return_type
         self.name = name
         self.arguments = [
             arg if isinstance(arg, str) else arg["type"] for arg in arguments
         ]
+        self.standards = standards
         self.guard = guard
         self.attributes = attributes or []
 
diff --git a/libc/newhdrgen/yaml_combined/ctype.yaml b/libc/newhdrgen/yaml/ctype.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/ctype.yaml
rename to libc/newhdrgen/yaml/ctype.yaml
diff --git a/libc/newhdrgen/yaml_combined/fenv.yaml b/libc/newhdrgen/yaml/fenv.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/fenv.yaml
rename to libc/newhdrgen/yaml/fenv.yaml
diff --git a/libc/newhdrgen/yaml_combined/math.yaml b/libc/newhdrgen/yaml/math.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/math.yaml
rename to libc/newhdrgen/yaml/math.yaml
diff --git a/libc/newhdrgen/yaml_combined/pthread.yaml b/libc/newhdrgen/yaml/pthread.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/pthread.yaml
rename to libc/newhdrgen/yaml/pthread.yaml
diff --git a/libc/newhdrgen/yaml_combined/sched.yaml b/libc/newhdrgen/yaml/sched.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/sched.yaml
rename to libc/newhdrgen/yaml/sched.yaml
diff --git a/libc/newhdrgen/yaml_combined/signal.yaml b/libc/newhdrgen/yaml/signal.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/signal.yaml
rename to libc/newhdrgen/yaml/signal.yaml
diff --git a/libc/newhdrgen/yaml_combined/stdfix.yaml b/libc/newhdrgen/yaml/stdfix.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/stdfix.yaml
rename to libc/newhdrgen/yaml/stdfix.yaml
diff --git a/libc/newhdrgen/yaml_combined/stdio.yaml b/libc/newhdrgen/yaml/stdio.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/stdio.yaml
rename to libc/newhdrgen/yaml/stdio.yaml
diff --git a/libc/newhdrgen/yaml_combined/stdlib.yaml b/libc/newhdrgen/yaml/stdlib.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/stdlib.yaml
rename to libc/newhdrgen/yaml/stdlib.yaml
diff --git a/libc/newhdrgen/yaml_combined/string.yaml b/libc/newhdrgen/yaml/string.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/string.yaml
rename to libc/newhdrgen/yaml/string.yaml
diff --git a/libc/newhdrgen/yaml_combined/strings.yaml b/libc/newhdrgen/yaml/strings.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/strings.yaml
rename to libc/newhdrgen/yaml/strings.yaml
diff --git a/libc/newhdrgen/yaml_combined/sys_mman.yaml b/libc/newhdrgen/yaml/sys_mman.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/sys_mman.yaml
rename to libc/newhdrgen/yaml/sys_mman.yaml
diff --git a/libc/newhdrgen/yaml_combined/sys_wait.yaml b/libc/newhdrgen/yaml/sys_wait.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/sys_wait.yaml
rename to libc/newhdrgen/yaml/sys_wait.yaml
diff --git a/libc/newhdrgen/yaml_combined/time.yaml b/libc/newhdrgen/yaml/time.yaml
similarity index 100%
rename from libc/newhdrgen/yaml_combined/time.yaml
rename to libc/newhdrgen/yaml/time.yaml
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index 7159dd9cc8881..8ca09267dbb3d 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -54,10 +54,10 @@ def yaml_to_classes(yaml_data):
         standards = (function_data.get("standards", None),)
         header.add_function(
             Function(
-                standards,
                 function_data["return_type"],
                 function_data["name"],
                 arguments,
+                standards,
                 guard,
                 attributes,
             )



More information about the libc-commits mailing list