Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Wrap rttydesc module in a RttyContext; simplify; clean-up. #239

Merged
merged 1 commit into from Jul 17, 2023

Conversation

nvjle
Copy link

@nvjle nvjle commented Jul 14, 2023

This patch gives module rttydesc its own context RttyContext. The new context holds ubiquitously used values (e.g., llvm::Context, llvm::Module) so that each can be easily referenced up and down the call stack. Previously these values were passed down (potentially) entire call chains and was becoming unwieldly. The various function parameter lists are now generally shorter as well. Parameter type_display_context is now entirely absent, where it once was passed to nearly every function to gain access in a leaf routine.

Move ll_struct_name_from_raw_name and struct_raw_type_name into extensions::StructEnv::{ll_struct_name_from_raw_name, struct_raw_type_name}. This breaks the dependece on ModuleContext but is also cleaner.

This diffs appear large in rttydesc.rs, but that is largely just re-indentation that the auto-formatters did when the module was encapsulated in RttyContext.

@ksolana
Copy link
Collaborator

ksolana commented Jul 17, 2023

It seems when i updated the llvm-sys branch there is some merge-conflict here. Rebase should fix it.

This patch gives module `rttydesc` its own context RttyContext.
The new context holds ubiquitously used values (e.g., `llvm::Context`,
`llvm::Module`) so that each can  be easily referenced up and down
the call stack. Previously these values were passed down (potentially)
entire call chains and was becoming unwieldly. The various function
parameter lists are now generally shorter as well. Parameter
`type_display_context` is now entirely absent, where it once was
passed to nearly every function to gain access in a leaf routine.

Move `ll_struct_name_from_raw_name` and `struct_raw_type_name` into
`extensions::StructEnv::{ll_struct_name_from_raw_name,
struct_raw_type_name}`. This breaks the dependece on `ModuleContext`
but is also cleaner.

This diffs appear large in rttydesc.rs, but that is largely just
re-indentation that the auto-formatters did when the module was
encapsulated in `RttyContext`.
Copy link
Collaborator

@brson brson left a comment

Choose a reason for hiding this comment

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

lgtm

@nvjle nvjle merged commit b78fa29 into anza-xyz:llvm-sys Jul 17, 2023
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants