[PATCH] D18749: 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
Mon Apr 4 10:10:21 PDT 2016


deadalnix added inline comments.

================
Comment at: lib/IR/Core.cpp:121
@@ +120,3 @@
+  assert(K != Attribute::None && "Invalid attribute");
+  return AttributeImpl::getAttrMask(K);
+}
----------------
whitequark wrote:
> You are using a deprecated API (from `AttributeImpl.h`):
> ```
>   // FIXME: Remove this!
>   static uint64_t getAttrMask(Attribute::AttrKind Val);
> ```
> It will stop working properly once we have more than 64 attributes, which is likely quite soon.
Yes that's the whole point. Removing the old enum would provide no migration path for users, which is a problem. By creating a function that give you the enum values, wee open the door for non stable enum values and will be able to change them later. This is going to be a long transition, but after talking with @Wallbraker , it seems like a much better (and longer) way forward.

So the battle plan is:
 - Land this. LLVMGetAttrKindIDInContext and enum value match.
 - Wait for this to be released.
 - In the release after this is released, get rid of the enum, and possibly change what LLVMGetAttrKindIDInContext returns.
 - Remove the deprecated API.


http://reviews.llvm.org/D18749





More information about the llvm-commits mailing list