Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit 7c492a1

Browse files
committed
Add capability to get and set the personalitty function from the C API
Summary: 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 Reviewers: chandlerc, bogner, majnemer, andrew.w.kaylor, rafael, rnk, axw Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D10946 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242104 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent ce0f2ed commit 7c492a1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

include/llvm-c/Core.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,20 @@ LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
18871887
*/
18881888
void LLVMDeleteFunction(LLVMValueRef Fn);
18891889

1890+
/**
1891+
* Obtain the personality function attached to the function.
1892+
*
1893+
* @see llvm::Function::getPersonalityFn()
1894+
*/
1895+
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn);
1896+
1897+
/**
1898+
* Set the personality function attached to the function.
1899+
*
1900+
* @see llvm::Function::setPersonalityFn()
1901+
*/
1902+
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
1903+
18901904
/**
18911905
* Obtain the ID number from a function instance.
18921906
*

lib/IR/Core.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,14 @@ void LLVMDeleteFunction(LLVMValueRef Fn) {
16911691
unwrap<Function>(Fn)->eraseFromParent();
16921692
}
16931693

1694+
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn) {
1695+
return wrap(unwrap<Function>(Fn)->getPersonalityFn());
1696+
}
1697+
1698+
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn) {
1699+
unwrap<Function>(Fn)->setPersonalityFn(unwrap<Constant>(PersonalityFn));
1700+
}
1701+
16941702
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn) {
16951703
if (Function *F = dyn_cast<Function>(unwrap(Fn)))
16961704
return F->getIntrinsicID();

0 commit comments

Comments
 (0)