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

Remove most LLVM::DIBuilder functions from llvm_ext.cc #13448

Merged

Conversation

HertzDevil
Copy link
Contributor

This removes all functions in llvm_ext.cc that are required by LLVM::DIBuilder by using their official counterparts, except for LLVMExtDIBuilderCreateEnumerator, which did not exist in LLVM 8.0. For the remaining functions see #13177.

There are some breaking changes to align our LLVM API to the official one for debug info generation:

  • LLVM::Builder#create_compile_unit now uses language codes as they are defined in the C header, not the C++ ones.
  • LLVM::Builder#insert_declare_at_end now takes the debug location as a LibLLVM::MetadataRef instead of an LLVM::Value. There is currently no Crystal wrapper for LibLLVM::MetadataRef. (LLVM::Metadata is an empty struct used only as a namespace for the unused LLVM::Metadata::Type enum.)
  • The LLVM::Builder#create_*_type family now takes Arrays or Slices of metadata elements, without having to call #get_or_create_array or #get_or_create_type_array first, because LLVM does it for us. Conversely, Crystal itself no longer calls those array conversion functions, but it does unpack the metadata returned by them to maintain API compatibility; this is of course more expensive, so those overloads are deprecated.
  • The members of the LLVM::DwarfSourceLanguage and LLVM::DIFlags enums now change depending on the LLVM version. In practice this isn't a huge problem because the LLVM version must be selected at build time.

There is also a workaround for #13250. It is internal to Crystal and not part of the breaking changes.

LLVM::DIBuilder#create_reference_type is completely removed, since it is unused by Crystal and the corresponding LibLLVMExt implementation + binding never existed.

@straight-shoota straight-shoota added this to the 1.9.0 milestone May 9, 2023
@straight-shoota straight-shoota added this pull request to the merge queue May 10, 2023
Merged via the queue into crystal-lang:master with commit 0d2471c May 10, 2023
@HertzDevil HertzDevil deleted the refactor/llvm-di-builder branch May 15, 2023 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants