aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser/llvmAsmParser.y.cvs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AsmParser/llvmAsmParser.y.cvs')
-rw-r--r--lib/AsmParser/llvmAsmParser.y.cvs15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y.cvs b/lib/AsmParser/llvmAsmParser.y.cvs
index af3a39d..bdfa07a 100644
--- a/lib/AsmParser/llvmAsmParser.y.cvs
+++ b/lib/AsmParser/llvmAsmParser.y.cvs
@@ -1917,22 +1917,21 @@ FunctionHeaderH : OptCallingConv TypesV Name '(' ArgList ')'
for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
AI != AE; ++AI)
AI->setName("");
-
- if (CurFun.isDeclare) {
- Fn->setLinkage(CurFun.Linkage);
- }
} else { // Not already defined?
Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
CurModule.CurrentModule);
- if (CurFun.isDeclare) {
- Fn->setLinkage(CurFun.Linkage);
- }
-
InsertValue(Fn, CurModule.Values);
}
CurFun.FunctionStart(Fn);
+
+ if (CurFun.isDeclare) {
+ // If we have declaration, always overwrite linkage. This will allow us to
+ // correctly handle cases, when pointer to function is passed as argument to
+ // another function.
+ Fn->setLinkage(CurFun.Linkage);
+ }
Fn->setCallingConv($1);
Fn->setAlignment($8);
if ($7) {