There is currently no way to assign attribute to the return value and current implementation rely on deprecated code.
The old attribute mechanism is still used for instruction at this stage.
Paths
| Differential D18727
Add support for attribute in the C API AbandonedPublic Authored by deadalnix on Apr 2 2016, 12:40 PM.
Details
Summary There is currently no way to assign attribute to the return value and current implementation rely on deprecated code. The old attribute mechanism is still used for instruction at this stage.
Diff Detail Event Timelinedeadalnix updated this object. Comment Actions You should put the unrelated commits in another one, they are good clean ups. I mirror the same comments as in D18733 regarding not directly removing the old functions. Looks good otherwise, good work!
rnk edited edge metadata. Comment ActionsFirst, you're breaking compatibility here with old programs using LLVMAttribute. We should ask Jeurgen about that. If we decide that LLVM's underlying attribute handling has changed so drastically that we're OK with a break, then we should delete the LLVMAttribute enum. Second, you're exposing the C++ enum values of LLVM's attributes. I have a feeling that people will start adding enum attributes in the middle to keep related attributes together. If we want to go this way, where we leverage tablegen instead of maintaining a self-contained mapping the C API layer, then the tablegen records should have manually maintained attribute numbers. We'd either use those as the direct C++ enum values or use them to generate a switch to translate from C to C++. This would be just like protobuf field ids. This revision now requires changes to proceed.Apr 4 2016, 10:12 AM Comment Actions
Well LLVMAttribute are flags and we have already run out of bits, as per the comment: /* FIXME: These attributes are currently not included in the C API as a temporary measure until the API/ABI impact to the C API is understood and the path forward agreed upon. LLVMSanitizeAddressAttribute = 1ULL << 32, LLVMStackProtectStrongAttribute = 1ULL<<35, */ So something needs to be done.
A translating switch sounds better, especially if the enums on the C++ side change value.
Revision Contents
Diff 52515 bindings/go/llvm/ir.go
include/llvm-c/Core.h
lib/IR/Core.cpp
test/Bindings/llvm-c/invoke.ll
tools/llvm-c-test/echo.cpp
|
While I agree with the change, this is unrelated and should go into another commit.