[PATCH] D19081: Add LLVMGetAttrKindIDInContext in the C API in order to facilitate migration away from LLVMAttribute

whitequark via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 08:38:35 PDT 2016


whitequark added a comment.

> Will target dependent attributes be covered by the API (like "no-sse")? Or is it only the regular attributes?


Well they really should be.

> The advantage of enums is that they are self documenting, the disadvantage is that ffi bindings can get stale enums. (if we have rules that we can't reuse old values) the only issue is that can arise is that ffi bindings can used deprecated enum values.


Not just that. In practice, bindings don't bother exporting the full list of attributes, and neither do the people who add attributes bother to update the C API, and this causes a lot of pain when writing frontends that need a new attribute because I need at least two new patches, temporarily fork LLVM and LLVM bindings, etc. Enums are just bad for things that change at all frequently. They're ugly enough for ValueKind, which changes far less.


http://reviews.llvm.org/D19081





More information about the llvm-commits mailing list