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

Restricting build_*_gep to make it safer. #467

Open
JCBurnside opened this issue Jan 29, 2024 · 1 comment
Open

Restricting build_*_gep to make it safer. #467

JCBurnside opened this issue Jan 29, 2024 · 1 comment

Comments

@JCBurnside
Copy link

Is your feature request related to a problem? Please describe.
I have multiple times accidentally used build_*_gep with the wrong pointee type thinking it would the result type in llvm15+

Describe the solution you'd like
Add a new trait potentially called IndexableType or GEPable that would restrict what types can be used in a gep instruction. it would be implemented on PointerType, VectorType, ArrayType, and StructType

Describe possible drawbacks to your solution
potentially breaks backwards compat.

Describe alternatives you've considered
paying more attention when writing gep instructions.

@JCBurnside
Copy link
Author

Seems like a simple marker trait to help limit the unsafeness of the build gep calls.

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

No branches or pull requests

2 participants