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

whitequark via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 00:21:49 PDT 2016


whitequark added inline comments.

================
Comment at: include/llvm-c/Core.h:439
@@ +438,3 @@
+                                    size_t SLen);
+unsigned LLVMGetAttrKindID(const char* Name, size_t SLen);
+
----------------
Do we need to introduce any new non-InContext variants? The utility seems marginal.

================
Comment at: lib/IR/Core.cpp:119
@@ +118,3 @@
+                                    size_t SLen) {
+  auto K = getAtrKindFromName(StringRef(Name, SLen));
+  assert(K != Attribute::None && "Invalid attribute");
----------------
`getAttrKindFromName`

================
Comment at: lib/IR/Core.cpp:121
@@ +120,3 @@
+  assert(K != Attribute::None && "Invalid attribute");
+  return AttributeImpl::getAttrMask(K);
+}
----------------
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.


http://reviews.llvm.org/D18749





More information about the llvm-commits mailing list