mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Call _d_hidden_func() instead of hidden functions.
This commit is contained in:
@@ -1069,4 +1069,13 @@ static void LLVM_D_BuildRuntimeModule()
|
||||
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
|
||||
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
|
||||
}
|
||||
|
||||
#if DMDV2
|
||||
// void _d_hidden_func()
|
||||
{
|
||||
llvm::StringRef fname("_d_hidden_func");
|
||||
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, false);
|
||||
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "gen/utils.h"
|
||||
#include "gen/arrays.h"
|
||||
#include "gen/metadata.h"
|
||||
#include "gen/runtime.h"
|
||||
|
||||
#include "ir/irstruct.h"
|
||||
#include "ir/irtypeclass.h"
|
||||
@@ -168,6 +169,34 @@ LLConstant * IrStruct::getVtblInit()
|
||||
fd->codegen(Type::sir);
|
||||
assert(fd->ir.irFunc && "invalid vtbl function");
|
||||
c = fd->ir.irFunc->func;
|
||||
#if DMDV2
|
||||
if (cd->isFuncHidden(fd))
|
||||
{ /* fd is hidden from the view of this class.
|
||||
* If fd overlaps with any function in the vtbl[], then
|
||||
* issue 'hidden' error.
|
||||
*/
|
||||
for (size_t j = 1; j < n; j++)
|
||||
{ if (j == i)
|
||||
continue;
|
||||
FuncDeclaration *fd2 = ((Dsymbol *)cd->vtbl.data[j])->isFuncDeclaration();
|
||||
if (!fd2->ident->equals(fd->ident))
|
||||
continue;
|
||||
if (fd->leastAsSpecialized(fd2) || fd2->leastAsSpecialized(fd))
|
||||
{
|
||||
if (global.params.warnings)
|
||||
{
|
||||
TypeFunction *tf = (TypeFunction *)fd->type;
|
||||
if (tf->ty == Tfunction)
|
||||
error("%s%s is hidden by %s\n", fd->toPrettyChars(), Parameter::argsTypesToChars(tf->parameters, tf->varargs), toChars());
|
||||
else
|
||||
error("%s is hidden by %s\n", fd->toPrettyChars(), toChars());
|
||||
}
|
||||
c = DtoBitCast(LLVM_D_GetRuntimeFunction(gIR->module, "_d_hidden_func"), c->getType());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
constants.push_back(c);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user