This is an archive of the discontinued LLVM Phabricator instance.

[LLVM-C]Add LLVMAddMetadataToInst, deprecated LLVMSetInstDebugLocation.
ClosedPublic

Authored by fhahn on Dec 17 2020, 5:31 AM.

Details

Summary

IRBuilder has been updated to support preserving metdata in a more
general manner. This patch adds LLVMAddMetadataToInst and
deprecates LLVMSetInstDebugLocation in favor of the more
general function.

Diff Detail

Event Timeline

fhahn created this revision.Dec 17 2020, 5:31 AM
fhahn requested review of this revision.Dec 17 2020, 5:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 17 2020, 5:31 AM
dexonsmith resigned from this revision.Dec 18 2020, 1:31 PM

Seems like a nice cleanup, but I think it'd be better for a current debug info maintainer to take a look.

fhahn updated this revision to Diff 372658.Sep 15 2021, 1:44 AM

Ping :) I just realized that I still had this follow-up to 29077ae860bc lying around. Rebased.

This is an API break to the C API, which is allowed, but is there any way we can keep the old function?

fhahn added a comment.Sep 17 2021, 1:56 AM

This is an API break to the C API, which is allowed, but is there any way we can keep the old function?

We could keep the old function and just have it call AddMetadataToInst. There should be no functional change *if* the user does not use the new functionality to collect non-debug metadata in the builder. Not sure if that's a great option. We could also extend AddMetadataToInst to accept a filter to only copy specific metadata kinds and have LLVMAddMetadataToInst use this filter. But this would also mean that we need to maintain a change IRBuilder which is only there for C API compatibility. In that case, we might as well keep the old SetInstDebugLocation. What do you think?

This is an API break to the C API, which is allowed, but is there any way we can keep the old function?

We could keep the old function and just have it call AddMetadataToInst. There should be no functional change *if* the user does not use the new functionality to collect non-debug metadata in the builder. Not sure if that's a great option. We could also extend AddMetadataToInst to accept a filter to only copy specific metadata kinds and have LLVMAddMetadataToInst use this filter. But this would also mean that we need to maintain a change IRBuilder which is only there for C API compatibility. In that case, we might as well keep the old SetInstDebugLocation. What do you think?

To me it sounds like keeping the old function would be best. We can also deprecate it in the release notes so that users are aware that it might be removed at some point, and that it might not work with the new functionality.

fhahn updated this revision to Diff 373242.Sep 17 2021, 9:00 AM

This is an API break to the C API, which is allowed, but is there any way we can keep the old function?

We could keep the old function and just have it call AddMetadataToInst. There should be no functional change *if* the user does not use the new functionality to collect non-debug metadata in the builder. Not sure if that's a great option. We could also extend AddMetadataToInst to accept a filter to only copy specific metadata kinds and have LLVMAddMetadataToInst use this filter. But this would also mean that we need to maintain a change IRBuilder which is only there for C API compatibility. In that case, we might as well keep the old SetInstDebugLocation. What do you think?

To me it sounds like keeping the old function would be best. We can also deprecate it in the release notes so that users are aware that it might be removed at some point, and that it might not work with the new functionality.

Sounds good, I updated the patch to only add LLVMAddMetadataToInst and deprecate LLVMAddMetadataToInst.

fhahn retitled this revision from [LLVM-C] Replace LLVMSetInstDebugLocation with LLVMAddMetadataToInst. to [LLVM-C]Add LLVMAddMetadataToInst, deprecated LLVMSetInstDebugLocation..Sep 17 2021, 9:01 AM
fhahn edited the summary of this revision. (Show Details)
aprantl accepted this revision.Sep 24 2021, 10:50 AM

Does Doxygen have a \deprecated keyword? Otherwise this LGTM.

This revision is now accepted and ready to land.Sep 24 2021, 10:50 AM
This revision was landed with ongoing or failed builds.Oct 22 2021, 3:22 AM
This revision was automatically updated to reflect the committed changes.
fhahn added a comment.Oct 22 2021, 3:22 AM

Does Doxygen have a \deprecated keyword? Otherwise this LGTM.

Yes, I added @deprecated to the paragraph in the comment.

Thanks!