mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-26 17:43:14 +01:00
Extended DtoLinkage comments.
This commit is contained in:
@@ -342,20 +342,28 @@ LLGlobalValue::LinkageTypes DtoLinkage(Dsymbol* sym)
|
||||
// intrinsics are always external
|
||||
if (fdecl->llvmInternal == LLVMintrinsic)
|
||||
return llvm::GlobalValue::ExternalLinkage;
|
||||
// generated by inlining semantics run
|
||||
|
||||
// Mark functions generated by an inlining semantic run as
|
||||
// available_externally. Naked functions are turned into module-level
|
||||
// inline asm and are thus declaration-only as far as the LLVM IR level
|
||||
// is concerned.
|
||||
if (fdecl->availableExternally && mustDefine && !fdecl->naked)
|
||||
return llvm::GlobalValue::AvailableExternallyLinkage;
|
||||
|
||||
// array operations are always template linkage
|
||||
if (fdecl->isArrayOp == 1)
|
||||
return templateLinkage;
|
||||
|
||||
// template instances should have weak linkage
|
||||
// but only if there's a body, and it's not naked
|
||||
// otherwise we make it external
|
||||
else if (needsTemplateLinkage(fdecl) && fdecl->fbody && !fdecl->naked)
|
||||
if (needsTemplateLinkage(fdecl) && fdecl->fbody && !fdecl->naked)
|
||||
return templateLinkage;
|
||||
|
||||
// extern(C) functions are always external
|
||||
else if (ft->linkage == LINKc)
|
||||
if (ft->linkage == LINKc)
|
||||
return llvm::GlobalValue::ExternalLinkage;
|
||||
|
||||
// If a function without a body is nested in another
|
||||
// function, we cannot use internal linkage for that
|
||||
// function (see below about nested functions)
|
||||
|
||||
Reference in New Issue
Block a user