swift
b81f051a - [cxx-interop] Emit synthesized `__defaultArg` functions with PublicNonABI linkage

Commit
316 days ago
[cxx-interop] Emit synthesized `__defaultArg` functions with PublicNonABI linkage This fixes a pervasive linker error which happened when using the same C++ function with default arguments from different Swift source files. If a C++ function with default arguments is called from Swift, and the value of a default argument is omitted, ClangImporter generates the body of the synthesized Swift function `func __defaultArg_xyz() -> { return /* cxxDefaultArgValue() */ }`. Since this definition can be generated for multiple object files, we need to make sure the linker can deduplicate this symbol. This change makes sure the compiler automatically adds `@_alwaysEmitIntoClient` to the synthesized `__defaultArg_` functions. rdar://138513915
Author
Parents
Loading