Page MenuHomePhabricator

[LLVM-C][bindings/go] Get metadata from a value
Needs ReviewPublic

Authored by aykevl on Jan 4 2020, 9:48 AM.

Details

Summary

I added a new function that returns a metadata node directly instead of wrapping it in a value, which IIRC is now the recommended approach.

This is especially useful for getting debug info metadata from global variables.

Note that this is a breaking change for the Go bindings. I think this is fine because having a metadata-wrapped-as-value wasn't really usable anyway from the API and the old API was inconsistent with SetMetadata (which accepts a Metadata instead of a Value object). Also, I couldn't find any uses of the Metadata() call in llgo and I can tell you that it is not used in TinyGo.

Diff Detail

Event Timeline

aykevl created this revision.Jan 4 2020, 9:48 AM
Herald added a project: Restricted Project. · View Herald Transcript
whitequark resigned from this revision.Mar 10 2020, 2:43 PM
CodaFi added a comment.May 1 2020, 5:03 PM

Why not change the behavior of LLVMGetMetadata instead? It's an ABI-compatible change, and expanding the API to cover more cases instead of crashing is API-compatible.