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

[DEBUGINFO] Add DILabel Functions to LLVM-C #112799

Open
tf2spi opened this issue Oct 17, 2024 · 4 comments
Open

[DEBUGINFO] Add DILabel Functions to LLVM-C #112799

tf2spi opened this issue Oct 17, 2024 · 4 comments
Labels

Comments

@tf2spi
Copy link

tf2spi commented Oct 17, 2024

Hello LLVM Team,

This is my first issue request in LLVM, so apologies if I've misspoken or acted poorly for any reason.

I'm currently using the LLVM-C bindings in a PR for Odin Lang and a really nice API in LLVM that's unfortunately missing in the C bindings is llvm::DIBuilder::createLabel and llvm::DIBuilder::insertLabel which are helpful when outputting debug info for various labels in Odin. There's even the LLVMDILabelMetadataKind kind but no way to actually make a DILabel from the C API as far as I'm aware.

For UNIX-like platforms, I was still able to link to the C++ function directly and use the C references which are wrappers around the C++ types. However, we have a build of the LLVM C DLL for Windows in the repo which does not export the C++ functions so it's not feasible right now to output debug info for labels on Windows.

In both cases, it would be more ideal if these were exported as C functions that we could then use in Odin. Programming languages with labels and whose compilers are written in C, whether now or in the future, would likely appreciate this as well.

@llvmbot
Copy link
Collaborator

llvmbot commented Oct 17, 2024

@llvm/issue-subscribers-debuginfo

Author: None (tf2spi)

Hello LLVM Team,

This is my first issue request in LLVM, so apologies if I've misspoken or acted poorly for any reason.

I'm currently using the LLVM-C bindings in a PR for Odin Lang and a really nice API in LLVM that's unfortunately missing in the C bindings is llvm::DIBuilder::createLabel and llvm::DIBuilder::insertLabel which are helpful when outputting debug info for various labels in Odin. There's even the LLVMDILabelMetadataKind kind but no way to actually make a DILabel from the C API as far as I'm aware.

For UNIX-like platforms, I was still able to link to the C++ function directly and use the C references which are wrappers around the C++ types. However, we have a build of the LLVM C DLL for Windows in the repo which does not export the C++ functions so it's not feasible right now to output debug info for labels on Windows.

In both cases, it would be more ideal if these were exported as C functions that we could then use in Odin. Programming languages with labels and whose compilers are written in C, whether now or in the future, would likely appreciate this as well.

@dwblaikie
Copy link
Collaborator

This is a fine bug, thanks for filing it!

Though it's probably not something high on anyone's list to fix, unfortunately - and possibly to move it forward it'd be best if you could provide a pull request for the desired functionality - it's probably not too hard to plumb through, if it's already in DIBuilder?

@tf2spi
Copy link
Author

tf2spi commented Oct 18, 2024

Looking at how the C bindings work, I also suspect that it wouldn't be too hard to plumb. The hardest part would be getting familiar with the project but it's probably a worthwhile investment in any case. Thanks for the quick reply!

@tf2spi
Copy link
Author

tf2spi commented Oct 18, 2024

These are a general list of DIBuilder functions that also don't have C bindings that I found from eyeballing. I'm not sure where these should be documented or if documenting these cases would be desirable right now.

llvm::DIBuilder::createEnumerator
  - APSInt
llvm::DIBuilder::createStringType
llvm::DIBuilder::createPtrAuthQualifiedType
llvm::DIBuilder::createTemplateAlias
llvm::DIBuilder::createFriend
llvm::DIBuilder::createVariantMemberType
llvm::DIBuilder::createVariantPart
llvm::DIBuilder::createTemplateTypeParameter
llvm::DIBuilder::createTemplateValueParameter
llvm::DIBuilder::createTemplateTemplateParameter
  - TemplateTempleateParameterMetadataKind?
llvm::DIBuilder::createTemplateParameterPack
llvm::DIBuilder::createSetType
llvm::DIBuilder::retainType
llvm::DIBuilder::createUnspecifiedParameter
llvm::DIBuilder::getOrCreateMacroArray
llvm::DIBuilder::getOrCreateGenericSubrange
llvm::DIBuilder::createTempFunctionFwdDecl
llvm::DIBuilder::createMethod
llvm::DIBuilder::createCommonBlock
llvm::DIBuilder::replaceVTableHolder
llvm::DIBuilder::replaceArrays
llvm::DIBuilder::replaceTemporary

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

No branches or pull requests

4 participants