-
Notifications
You must be signed in to change notification settings - Fork 283
Add definition splitting to transpiler #1477
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
base: master
Are you sure you want to change the base?
Changes from all commits
13a6175
4dd893c
4c0fafb
7246fed
8a22d81
5094618
e220a6a
4d46b67
b71a025
8d5dd49
770ec37
6ead573
c410a34
9072285
0c859e3
018a315
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,6 +72,7 @@ pub struct TranspilerConfig { | |||||||||||
| pub dump_structures: bool, | ||||||||||||
| pub verbose: bool, | ||||||||||||
| pub debug_ast_exporter: bool, | ||||||||||||
| pub emit_c_decl_map: bool, | ||||||||||||
|
|
||||||||||||
| // Options that control translation | ||||||||||||
| pub incremental_relooper: bool, | ||||||||||||
|
|
@@ -599,9 +600,30 @@ fn transpile_single( | |||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // Perform the translation | ||||||||||||
| let (translated_string, pragmas, crates) = | ||||||||||||
| let (translated_string, maybe_decl_map, pragmas, crates) = | ||||||||||||
| translator::translate(typed_context, tcfg, input_path); | ||||||||||||
|
|
||||||||||||
| if let Some(decl_map) = maybe_decl_map { | ||||||||||||
| let decl_map_path = output_path.with_extension("c_decls.json"); | ||||||||||||
| let file = match File::create(&decl_map_path) { | ||||||||||||
| Ok(file) => file, | ||||||||||||
| Err(e) => panic!( | ||||||||||||
| "Unable to open file {} for writing: {}", | ||||||||||||
| output_path.display(), | ||||||||||||
| e | ||||||||||||
|
Comment on lines
+611
to
+613
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| ), | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| match serde_json::ser::to_writer(file, &decl_map) { | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably best to just write to a |
||||||||||||
| Ok(()) => (), | ||||||||||||
| Err(e) => panic!( | ||||||||||||
| "Unable to write C declaration map to file {}: {}", | ||||||||||||
| output_path.display(), | ||||||||||||
| e | ||||||||||||
|
Comment on lines
+620
to
+622
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| ), | ||||||||||||
| }; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| let mut file = match File::create(&output_path) { | ||||||||||||
| Ok(file) => file, | ||||||||||||
| Err(e) => panic!( | ||||||||||||
|
|
||||||||||||
Uh oh!
There was an error while loading. Please reload this page.