Closed
Description
as reported on https://forums.swift.org/t/undeclared-use-of-identifier-in-generated-module-swift-file/67894.
It shows up as a linker error like this:
ld: Undefined symbols:
type metadata accessor for __C.HelloCxxWorld, referenced from:
swift::TypeMetadataTrait<HelloCxxWorld>::getTypeMetadata() in HelloHello.o
This is caused by how the C++ getTypeMetadata
inline function is annotated in the generated header. It uses the SWIFT_INLINE_THUNK
annotation which in debug mode in Xcode (when DEBUG
is defined as a preprocessor macro/Swift build condition) is forced to be emitted into the object file, even when it's not used. This is wrong, as it's not supposed to be linked in forcefully and should only be needed when it's actually used.
Such functions should be annotated with SWIFT_INLINE_PRIVATE_HELPER
instead.