From fd0cfe4bb4782d2b525495dae5096d3709d888c6 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Thu, 18 Jun 2009 08:30:57 +0000 Subject: [PATCH] Forgot to commit this hunk git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73693 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/IRBuilder.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index 39aaebbedd8..acaf1f4d010 100644 --- a/include/llvm/Support/IRBuilder.h +++ b/include/llvm/Support/IRBuilder.h @@ -601,6 +601,18 @@ public: return CI; } + InvokeInst *TransferAttributes(InvokeInst *II, const Value* Callee) const { + if (const GlobalAlias *GA = dyn_cast(Callee)) + Callee = GA->getAliasedGlobal(); + + if (const Function *F = dyn_cast(Callee)) { + II->setCallingConv(F->getCallingConv()); + II->setAttributes(F->getAttributes()); + } + + return II; + } + CallInst *CreateCall(Value *Callee, const char *Name = "") { return Insert(TransferAttributes(CallInst::Create(Callee), Callee), Name); } -- 2.11.0