Skip to content

[libc][newhdrgen] Fix NameError in yaml_to_classes.py #114952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

overmighty
Copy link
Member

Fixes "NameError: name 'yaml_file' is not defined" that would be raised
whenever running yaml_to_classes.py with the --add_function option since
commit 2e6d451.

Fixes "NameError: name 'yaml_file' is not defined" that would be raised
whenever running yaml_to_classes.py with the --add_function option since
commit 2e6d451.
@llvmbot
Copy link
Member

llvmbot commented Nov 5, 2024

@llvm/pr-subscribers-libc

Author: OverMighty (overmighty)

Changes

Fixes "NameError: name 'yaml_file' is not defined" that would be raised
whenever running yaml_to_classes.py with the --add_function option since
commit 2e6d451.


Full diff: https://github.com/llvm/llvm-project/pull/114952.diff

1 Files Affected:

  • (modified) libc/newhdrgen/yaml_to_classes.py (+1-1)
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index a295058f7dc821..0e8ca2d8a82b0c 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -253,7 +253,7 @@ def main():
     args = parser.parse_args()
 
     if args.add_function:
-        add_function_to_yaml(yaml_file, args.add_function)
+        add_function_to_yaml(args.yaml_file, args.add_function)
 
     header_class = GpuHeader if args.export_decls else HeaderFile
     header = load_yaml_file(args.yaml_file, header_class, args.entry_points)

Copy link

@kh3rld kh3rld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes the NameError: name 'yaml_file' is not defined in yaml_to_classes.py when the --add_function option is used. The issue, introduced in commit 2e6d451, is resolved by correctly passing args.yaml_file to the add_function_to_yaml function instead of the undefined yaml_file.

Full diff: PR Diff

File modified:

  • libc/newhdrgen/yaml_to_classes.py (+1 -1)

Copy link
Member

@nickdesaulniers nickdesaulniers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! We were just discussing how little used this feature was, so it's not surprising we didn't notice this breakage. We also discussed possibly separating out this particular feature into its own standalone command line util. Thanks for the patch, though!

@overmighty overmighty merged commit 27d3e44 into llvm:main Nov 5, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants