aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 73fd32c..32c7b87 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -330,6 +330,16 @@ Function *Function::Create(FunctionType *Ty, LinkageTypes Linkage,
return Create(Ty, Linkage, M.getDataLayout().getProgramAddressSpace(), N, &M);
}
+Function *Function::createWithDefaultAttr(FunctionType *Ty,
+ LinkageTypes Linkage,
+ unsigned AddrSpace, const Twine &N,
+ Module *M) {
+ auto *F = new Function(Ty, Linkage, AddrSpace, N, M);
+ if (M->getUwtable())
+ F->addAttribute(AttributeList::FunctionIndex, Attribute::UWTable);
+ return F;
+}
+
void Function::removeFromParent() {
getParent()->getFunctionList().remove(getIterator());
}