From e6b5bd5854c80eac05f415ad282ba84b840b8af8 Mon Sep 17 00:00:00 2001 From: Alexandros Lamprineas Date: Wed, 20 Mar 2024 09:24:29 +0000 Subject: [FMV] Emit the resolver along with the default version definition. (#84405) We would like the resolver to be generated eagerly, even if the versioned function is not called from the current translation unit. Fixes #81494. It further allows Multi Versioning to work even if the default target version attribute is omitted from function declarations. --- clang/lib/CodeGen/CodeGenModule.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.h') diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index ec34680f..1cc4477 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -348,6 +348,8 @@ private: /// yet. llvm::DenseMap DeferredDecls; + llvm::StringSet DeferredResolversToEmit; + /// This is a list of deferred decls which we have seen that *are* actually /// referenced. These get code generated when the module is done. std::vector DeferredDeclsToEmit; @@ -1588,6 +1590,9 @@ private: llvm::AttributeList ExtraAttrs = llvm::AttributeList(), ForDefinition_t IsForDefinition = NotForDefinition); + // Adds a declaration to the list of multi version functions if not present. + void AddDeferredMultiVersionResolverToEmit(GlobalDecl GD); + // References to multiversion functions are resolved through an implicitly // defined resolver function. This function is responsible for creating // the resolver symbol for the provided declaration. The value returned -- cgit v1.1