aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-12-02 20:03:17 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-12-02 20:03:17 +0000
commit769efe621ab318cb9e245c613dad5da695316557 (patch)
tree028a3cef6851a8883fa19402ccebb8cf347b6304 /llvm/lib/IR/Function.cpp
parent00f2f91af4c7693e10cf70ef271b6cec89696e86 (diff)
downloadllvm-769efe621ab318cb9e245c613dad5da695316557.zip
llvm-769efe621ab318cb9e245c613dad5da695316557.tar.gz
llvm-769efe621ab318cb9e245c613dad5da695316557.tar.bz2
Don't copy information from aliasee to alias.
They are independent. llvm-svn: 254541
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 97e2a84..5e4d2d2 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -411,12 +411,14 @@ void Function::clearGC() {
}
}
-/// copyAttributesFrom - copy all additional attributes (those not needed to
-/// create a Function) from the Function Src to this one.
+/// Copy all additional attributes (those not needed to create a Function) from
+/// the Function Src to this one.
void Function::copyAttributesFrom(const GlobalValue *Src) {
- assert(isa<Function>(Src) && "Expected a Function!");
GlobalObject::copyAttributesFrom(Src);
- const Function *SrcF = cast<Function>(Src);
+ const Function *SrcF = dyn_cast<Function>(Src);
+ if (!SrcF)
+ return;
+
setCallingConv(SrcF->getCallingConv());
setAttributes(SrcF->getAttributes());
if (SrcF->hasGC())