Adapt glue layer to renamed/changed Declaration::linkage

This commit is contained in:
Martin Kinkelin 2022-05-06 19:40:01 +02:00
parent 1fb01cfbf0
commit be9d5817a1
8 changed files with 11 additions and 11 deletions

View file

@ -2371,7 +2371,7 @@ struct AsmProcessor {
} }
// print out the mangle // print out the mangle
if (prependExtraUnderscore(vd->linkage)) { if (prependExtraUnderscore(vd->resolvedLinkage())) {
insnTemplate << "_"; insnTemplate << "_";
} }
OutBuffer buf; OutBuffer buf;
@ -3043,7 +3043,7 @@ struct AsmProcessor {
{ {
use_star = false; use_star = false;
// simply write out the mangle // simply write out the mangle
if (prependExtraUnderscore(decl->linkage)) { if (prependExtraUnderscore(decl->resolvedLinkage())) {
insnTemplate << "_"; insnTemplate << "_";
} }
OutBuffer buf; OutBuffer buf;

View file

@ -155,7 +155,7 @@ llvm::FunctionType *DtoFunctionType(Type *type, IrFuncTy &irFty, Type *thistype,
} }
bool hasObjCSelector = false; bool hasObjCSelector = false;
if (fd && fd->linkage == LINK::objc && thistype) { if (fd && fd->_linkage == LINK::objc && thistype) {
if (fd->objc.selector) { if (fd->objc.selector) {
hasObjCSelector = true; hasObjCSelector = true;
} else if (fd->parent->isClassDeclaration()) { } else if (fd->parent->isClassDeclaration()) {
@ -433,7 +433,7 @@ void DtoResolveFunction(FuncDeclaration *fdecl, const bool willDeclare) {
} else if (tempdecl->llvmInternal == LLVMinline_ir) { } else if (tempdecl->llvmInternal == LLVMinline_ir) {
Logger::println("magic inline ir found"); Logger::println("magic inline ir found");
fdecl->llvmInternal = LLVMinline_ir; fdecl->llvmInternal = LLVMinline_ir;
fdecl->linkage = LINK::c; fdecl->_linkage = LINK::c;
Type *type = fdecl->type; Type *type = fdecl->type;
assert(type->ty == TY::Tfunction); assert(type->ty == TY::Tfunction);
static_cast<TypeFunction *>(type)->linkage = LINK::c; static_cast<TypeFunction *>(type)->linkage = LINK::c;
@ -1398,7 +1398,7 @@ void DtoDefineFunction(FuncDeclaration *fd, bool linkageAvailableExternally) {
if (func->getLinkage() == LLGlobalValue::WeakAnyLinkage && if (func->getLinkage() == LLGlobalValue::WeakAnyLinkage &&
!func->hasDLLExportStorageClass() && !func->hasDLLExportStorageClass() &&
global.params.targetTriple->isWindowsMSVCEnvironment()) { global.params.targetTriple->isWindowsMSVCEnvironment()) {
emulateWeakAnyLinkageForMSVC(irFunc, fd->linkage); emulateWeakAnyLinkageForMSVC(irFunc, fd->resolvedLinkage());
} }
} }

View file

@ -1860,7 +1860,7 @@ FuncDeclaration *getParentFunc(Dsymbol *sym) {
if (auto fld = fd->isFuncLiteralDeclaration()) { if (auto fld = fd->isFuncLiteralDeclaration()) {
if (fld->tok == TOK::function_) if (fld->tok == TOK::function_)
return nullptr; return nullptr;
} else if (fd->isStatic() || (!fd->isThis() && fd->linkage != LINK::d)) { } else if (fd->isStatic() || (!fd->isThis() && fd->_linkage != LINK::d)) {
return nullptr; return nullptr;
} }
} }

View file

@ -121,7 +121,7 @@ std::string getIRMangledName(VarDeclaration *vd) {
// TODO: Cache the result? // TODO: Cache the result?
return getIRMangledVarName(mangleBuf.peekChars(), vd->linkage); return getIRMangledVarName(mangleBuf.peekChars(), vd->resolvedLinkage());
} }
std::string getIRMangledFuncName(std::string baseMangle, LINK link) { std::string getIRMangledFuncName(std::string baseMangle, LINK link) {

View file

@ -277,7 +277,7 @@ void emitABIReturnAsmStmt(IRAsmBlock *asmblock, const Loc &loc,
} }
} else if (rt->isfloating()) { } else if (rt->isfloating()) {
if (rt->iscomplex()) { if (rt->iscomplex()) {
if (fdecl->linkage == LINK::d) { if (fdecl->_linkage == LINK::d) {
// extern(D) always returns on the FPU stack // extern(D) always returns on the FPU stack
as->out_c = "={st},={st(1)},"; as->out_c = "={st},={st(1)},";
asmblock->retn = 2; asmblock->retn = 2;

View file

@ -708,7 +708,7 @@ public:
// as requested by bearophile, see if it's a C printf call and that it's // as requested by bearophile, see if it's a C printf call and that it's
// valid. // valid.
if (global.params.warnings != DIAGNOSTICoff && checkPrintf) { if (global.params.warnings != DIAGNOSTICoff && checkPrintf) {
if (fndecl->linkage == LINK::c && if (fndecl->resolvedLinkage() == LINK::c &&
strcmp(fndecl->ident->toChars(), "printf") == 0) { strcmp(fndecl->ident->toChars(), "printf") == 0) {
warnInvalidPrintfCall(e->loc, (*e->arguments)[0], warnInvalidPrintfCall(e->loc, (*e->arguments)[0],
e->arguments->length); e->arguments->length);

View file

@ -560,7 +560,7 @@ LLConstant *IrClass::getInterfaceVtblInit(BaseClass *b,
nameBuf.writestring(mangledTargetName + 2); nameBuf.writestring(mangledTargetName + 2);
const auto thunkIRMangle = const auto thunkIRMangle =
getIRMangledFuncName(nameBuf.peekChars(), fd->linkage); getIRMangledFuncName(nameBuf.peekChars(), fd->resolvedLinkage());
llvm::Function *thunk = gIR->module.getFunction(thunkIRMangle); llvm::Function *thunk = gIR->module.getFunction(thunkIRMangle);
if (!thunk) { if (!thunk) {

View file

@ -87,7 +87,7 @@ void IrGlobal::declare() {
if (!V->isThreadlocal()) { if (!V->isThreadlocal()) {
// implicitly include extern(D) globals with -dllimport // implicitly include extern(D) globals with -dllimport
useDLLImport = useDLLImport =
(V->isExport() || V->linkage == LINK::d) && dllimportDataSymbol(V); (V->isExport() || V->_linkage == LINK::d) && dllimportDataSymbol(V);
} }
} }