Skip to content

Commit e8c659e

Browse files
committed
[FMV] Allow multi versioning without default declaration.
This was a limitation which has now been lifted upon request. Please read the thread below for more details: #84405 (comment) Basically it allows to separate versioned implementations across different TUs without having to share private header files which contain the default declaration.
1 parent 6a49501 commit e8c659e

File tree

6 files changed

+134
-125
lines changed

6 files changed

+134
-125
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11447,9 +11447,9 @@ static bool CheckMultiVersionFirstFunction(Sema &S, FunctionDecl *FD) {
1144711447
"Function lacks multiversion attribute");
1144811448
const auto *TA = FD->getAttr<TargetAttr>();
1144911449
const auto *TVA = FD->getAttr<TargetVersionAttr>();
11450-
// Target and target_version only causes MV if it is default, otherwise this
11451-
// is a normal function.
11452-
if ((TA && !TA->isDefaultVersion()) || (TVA && !TVA->isDefaultVersion()))
11450+
// The target attribute only causes MV if this declaration is the default,
11451+
// otherwise it is treated as a normal function.
11452+
if (TA && !TA->isDefaultVersion())
1145311453
return false;
1145411454

1145511455
if ((TA || TVA) && CheckMultiVersionValue(S, FD)) {

0 commit comments

Comments
 (0)