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

Amaury SECHET via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 17:48:12 PDT 2016


deadalnix added a comment.

So as per request, let's explicit what the problem is here and what is the plan to move forward. The problem is that the attribute mapping in the C API does not allow to qualify everything (for instance, return values) and does not allow mapping of newer attributes. Because new attributes are added on a regular basis, the C API become more and more obsolete with each release.

The problem is know for a long time, but there is no obvious and straightforward path forward (I made patch about this more than 2 years ago).

To move forward, I propose to

- Add a function that allow to get an attribute ID from the attribute name. As a first iteration, this function returns the same value as in the enum.
- Wait for it to be released.
- Remove the enum.

Then we can move forward.

Note that name aren't more stable than ids in theory. in practice they are much more stable and it is possible for the function to return an error code on missing attribute name as suggested. by @whitequark .


http://reviews.llvm.org/D19081





More information about the llvm-commits mailing list