Skip to content

Commit

Permalink
core: Fix linkage type of function declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jezurko authored and xlauko committed Oct 26, 2023
1 parent c843a5e commit 3cf766b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/vast/Dialect/Core/Linkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,24 @@ namespace vast::core {
return GlobalLinkageKind::InternalLinkage;
}

if (const auto *fn = decl->getAsFunction()) {
if (fn->isMultiVersion() && linkage == clang::GVA_AvailableExternally) {
return GlobalLinkageKind::LinkOnceAnyLinkage;
}
if (!fn->isThisDeclarationADefinition()
&& decl->hasAttr< clang::WeakAttr >())
{
return GlobalLinkageKind::ExternalWeakLinkage;
}
}

if (decl->hasAttr< clang::WeakAttr >()) {
if (is_constant)
return GlobalLinkageKind::WeakODRLinkage;
else
return GlobalLinkageKind::WeakAnyLinkage;
}

if (const auto *fn = decl->getAsFunction()) {
if (fn->isMultiVersion() && linkage == clang::GVA_AvailableExternally) {
return GlobalLinkageKind::LinkOnceAnyLinkage;
}
}

// We are guaranteed to have a strong definition somewhere else,
// so we can use available_externally linkage.
if (linkage == clang::GVA_AvailableExternally) {
Expand Down

0 comments on commit 3cf766b

Please sign in to comment.