Skip to content
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

di: add safe wrapper around LLVMGlobalCopyAllMetadata #170

Closed

Conversation

alessandrod
Copy link
Collaborator

Add MetadataEntries which is a safe wrapper around LLVMGlobalCopyAllMetadata. Before this change we used to leak the returned entries.

@alessandrod alessandrod changed the base branch from main to feature/fix-di January 14, 2024 02:14
@alessandrod alessandrod force-pushed the di-metadata-entries branch 4 times, most recently from 3a389c3 to 1119ca7 Compare January 14, 2024 08:07
LLVMValueMetadataEntriesGetMetadata(entries, index as u32),
)
})
struct MetadataEntries {
Copy link
Member

Choose a reason for hiding this comment

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

Can we move it to src/llvm/types/di.rs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not all metadata is DI?

Copy link
Member

Choose a reason for hiding this comment

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

True. I see that the LLVMGlobalCopyAllMetadata belongs to llvm/lib/IR/Core.cpp. I would then keep it in src/llvm/types/ir.rs (or, eventually, but probably too muc effort - split ir.rs into a subdir with mod.rs and core.rs, where eventual wrappers for other IR/* files could have their own files).

My main point is that I would prefer to not mix wrappers (which are currently in the types subdir) and DI sanitization logic in the same module.

Add MetadataEntries which is a safe wrapper around LLVMGlobalCopyAllMetadata.
Before this change we used to leak the returned entries.
@alessandrod
Copy link
Collaborator Author

Closed as part of #173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants