[clang] [clang] Support target_clones on function templates (PR #218210)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 06:22:36 PDT 2026
================
@@ -13467,7 +13467,15 @@ void ASTContext::forEachMultiversionedFunctionVersion(
const FunctionDecl *FD,
llvm::function_ref<void(FunctionDecl *)> Pred) const {
assert(FD->isMultiVersion() && "Only valid for multiversioned functions");
- llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
+ // Function template specializations do not appear as separate results when
+ // looking up the name of their primary template. The target_clones attribute
+ // stores every version on the specialization itself, so visit it directly.
+ if (FD->isTargetClonesMultiVersion() &&
----------------
erichkeane wrote:
This part seems wrong. The point here is we have to find all of the declarations, so just picking up the specialization here is wrong.
We should be propagating the attribute properly to the functions themselves.
WE might need to be better about the 'lookup' in the case where we're looking for the specializations though, but we have to make sure we find ALL of them.
https://github.com/llvm/llvm-project/pull/218210
More information about the cfe-commits
mailing list