aboutsummaryrefslogtreecommitdiff
path: root/libc/utils/hdrgen/yaml_to_classes.py
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2025-01-10 19:25:56 +0900
committerNAKAMURA Takumi <geek4civic@gmail.com>2025-01-10 19:25:56 +0900
commit63f5dc16d6bfca0512fb034052b41d13c3751e20 (patch)
treee70266be1fda941e0974e71e3d2c1cf080081311 /libc/utils/hdrgen/yaml_to_classes.py
parent9e5734688ed3d5f6b3fb76a26b3d90a736d60781 (diff)
parent397ac44f623f891d8f05d6673a95984ac0a26671 (diff)
downloadllvm-users/chapuni/cov/single/unify.zip
llvm-users/chapuni/cov/single/unify.tar.gz
llvm-users/chapuni/cov/single/unify.tar.bz2
Merge branch 'main' into users/chapuni/cov/single/unifyusers/chapuni/cov/single/unify
Diffstat (limited to 'libc/utils/hdrgen/yaml_to_classes.py')
-rw-r--r--libc/utils/hdrgen/yaml_to_classes.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/libc/utils/hdrgen/yaml_to_classes.py b/libc/utils/hdrgen/yaml_to_classes.py
index ec2441b..d64feaf 100644
--- a/libc/utils/hdrgen/yaml_to_classes.py
+++ b/libc/utils/hdrgen/yaml_to_classes.py
@@ -35,6 +35,7 @@ def yaml_to_classes(yaml_data, header_class, entry_points=None):
"""
header_name = yaml_data.get("header")
header = header_class(header_name)
+ header.template_file = yaml_data.get("header_template")
for macro_data in yaml_data.get("macros", []):
header.add_macro(Macro(macro_data["macro_name"], macro_data["macro_value"]))
@@ -227,10 +228,6 @@ def main():
help="Directory to output the generated header file",
)
parser.add_argument(
- "--h_def_file",
- help="Path to the .h.def template file (required if not using --export_decls)",
- )
- parser.add_argument(
"--add_function",
nargs=6,
metavar=(
@@ -244,7 +241,10 @@ def main():
help="Add a function to the YAML file",
)
parser.add_argument(
- "--e", action="append", help="Entry point to include", dest="entry_points"
+ "--entry-point",
+ action="append",
+ help="Entry point to include",
+ dest="entry_points",
)
parser.add_argument(
"--export-decls",
@@ -268,13 +268,7 @@ def main():
else:
output_file_path = Path(f"{Path(args.yaml_file).stem}.h")
- if not args.export_decls and args.h_def_file:
- with open(args.h_def_file, "r") as f:
- h_def_content = f.read()
- final_header_content = fill_public_api(header_str, h_def_content)
- with open(output_file_path, "w") as f:
- f.write(final_header_content)
- else:
+ if args.export_decls:
with open(output_file_path, "w") as f:
f.write(header_str)