[clang] [clang][FMV] Do not omit explicit default target_version attribute. (PR #96628)
Tomas Matheson via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 28 08:20:39 PDT 2024
================
@@ -11947,24 +11939,8 @@ static bool CheckMultiVersionFunction(Sema &S, FunctionDecl *NewFD,
FunctionDecl *OldFD = OldDecl->getAsFunction();
- if (!OldFD->isMultiVersion() && MVKind == MultiVersionKind::None) {
- if (NewTVA || !OldFD->getAttr<TargetVersionAttr>())
- return false;
- if (!NewFD->getType()->getAs<FunctionProtoType>()) {
- // Multiversion declaration doesn't have prototype.
- S.Diag(NewFD->getLocation(), diag::err_multiversion_noproto);
- NewFD->setInvalidDecl();
- } else {
- // No "target_version" attribute is equivalent to "default" attribute.
- NewFD->addAttr(TargetVersionAttr::CreateImplicit(
- S.Context, "default", NewFD->getSourceRange()));
- NewFD->setIsMultiVersion();
- OldFD->setIsMultiVersion();
- OldDecl = OldFD;
- Redeclaration = true;
- }
- return true;
- }
+ if (!OldFD->isMultiVersion() && MVKind == MultiVersionKind::None)
----------------
tmatheson-arm wrote:
`!OldFD->isMultiVersion()` is asserted at the top of the function, so this looks unnecessary. However OldFD is redefined here. This is confusing. Does the original assert still hold with the new assignment?
https://github.com/llvm/llvm-project/pull/96628
More information about the cfe-commits
mailing list