mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-29 14:40:40 +03:00
Handle ImportC special case wrt. non-variadic declaration vs. variadic definition
This commit is contained in:
parent
5c9f1e5fd6
commit
84da9adf7d
1 changed files with 10 additions and 1 deletions
|
@ -651,7 +651,16 @@ void DtoDeclareFunction(FuncDeclaration *fdecl, const bool willDefine) {
|
||||||
if (fdecl->llvmInternal == LLVMextern_weak)
|
if (fdecl->llvmInternal == LLVMextern_weak)
|
||||||
linkage = llvm::GlobalValue::ExternalWeakLinkage;
|
linkage = llvm::GlobalValue::ExternalWeakLinkage;
|
||||||
func = LLFunction::Create(functype, linkage, irMangle, &gIR->module);
|
func = LLFunction::Create(functype, linkage, irMangle, &gIR->module);
|
||||||
} else if (func->getFunctionType() != functype) {
|
} else if (func->getFunctionType() == functype) {
|
||||||
|
// IR signature matches existing function
|
||||||
|
} else if (fdecl->isCsymbol() &&
|
||||||
|
func->getFunctionType() ==
|
||||||
|
LLFunctionType::get(functype->getReturnType(),
|
||||||
|
functype->params(), false)) {
|
||||||
|
// ImportC: a variadic definition replaces a non-variadic declaration; keep
|
||||||
|
// existing non-variadic IR function
|
||||||
|
assert(func->isDeclaration());
|
||||||
|
} else {
|
||||||
const auto existingTypeString = llvmTypeToString(func->getFunctionType());
|
const auto existingTypeString = llvmTypeToString(func->getFunctionType());
|
||||||
const auto newTypeString = llvmTypeToString(functype);
|
const auto newTypeString = llvmTypeToString(functype);
|
||||||
error(fdecl->loc,
|
error(fdecl->loc,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue