[PATCH] D10946: Add capability to get and set the personalitty function from the C API
Amaury SECHET
deadalnix+llvmreview at gmail.com
Sat Jul 4 18:24:54 PDT 2015
deadalnix created this revision.
deadalnix added reviewers: chandlerc, bogner, majnemer, rnk, andrew.w.kaylor, rafael, djasper.
deadalnix added a subscriber: llvm-commits.
The capability was lost with D10429 where the personality function was set at function level rather than landing pad level. Now there is no way to get/set the personality function from the C API. That is a problem.
Note that the whole thing could be avoided by improving the C API testing, as started by D10725
http://reviews.llvm.org/D10946
Files:
include/llvm-c/Core.h
lib/IR/Core.cpp
Index: lib/IR/Core.cpp
===================================================================
--- lib/IR/Core.cpp
+++ lib/IR/Core.cpp
@@ -1691,6 +1691,14 @@
unwrap<Function>(Fn)->eraseFromParent();
}
+LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn) {
+ return wrap(unwrap<Function>(Fn)->getPersonalityFn());
+}
+
+void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn) {
+ unwrap<Function>(Fn)->setPersonalityFn(unwrap<Constant>(PersonalityFn));
+}
+
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn) {
if (Function *F = dyn_cast<Function>(unwrap(Fn)))
return F->getIntrinsicID();
Index: include/llvm-c/Core.h
===================================================================
--- include/llvm-c/Core.h
+++ include/llvm-c/Core.h
@@ -1888,6 +1888,20 @@
void LLVMDeleteFunction(LLVMValueRef Fn);
/**
+ * Obtain the personality function attached to the function.
+ *
+ * @see llvm::Function::getPersonalityFn()
+ */
+LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn);
+
+/**
+ * Set the personality function attached to the function.
+ *
+ * @see llvm::Function::setPersonalityFn()
+ */
+void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
+
+/**
* Obtain the ID number from a function instance.
*
* @see llvm::Function::getIntrinsicID()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10946.29051.patch
Type: text/x-patch
Size: 1295 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150705/4b88ae11/attachment.bin>
More information about the llvm-commits
mailing list