llvm-project
ccc134e9 - [clang][Modules] Don't home functions excluded from explicit instantiation (#240594)

Commit
21 days ago
[clang][Modules] Don't home functions excluded from explicit instantiation (#240594) With `-fmodules-codegen`, inline functions and implicit template instantiations are emitted into the module's object file and users of the module only reference them. libc++ marks most of its inline functions as hidden and excluded from explicit instantiation, so such a reference can't be resolved if the module's object file is linked into a different shared library than the user. For example, a test that links against the shared library of a module that instantiates `std::vector<T>` fails with "undefined hidden symbol" for the members of `std::vector<T>` that it calls. Emit these functions in every user instead, just like `always_inline` functions. This matches the meaning of the attribute, which already makes every user instantiate the function despite an explicit instantiation declaration. Before e9d85264ac replaced `always_inline` with `exclude_from_explicit_instantiation` in libc++, its hidden functions were never homed because of the `always_inline` check. Assisted-by: Claude Code (Claude Opus 5.5)
Author
Parents
Loading