[SIL] Use mangled names + asmname for @c functions

Instead of using the C name for `@c` functions in SIL, retain mangled
names and apply the `asmname` attribute, so we retain more type
information until later in the pipeline and avoid collisions.

Another part of rdar://137014448.
This commit is contained in:
Doug Gregor
2025-10-22 10:54:42 -07:00
parent 4be74c714f
commit fad8b24dbb
5 changed files with 41 additions and 13 deletions

View File

@@ -333,6 +333,10 @@ struct SILDeclRef {
/// Produce a mangled form of this constant.
std::string mangle(ManglingKind MKind = ManglingKind::Default) const;
/// If the symbol has a specific name for use at the LLVM IR level,
/// produce that name. This may be different than the mangled name in SIL.
std::optional<StringRef> getAsmName() const;
/// True if the SILDeclRef references a function.
bool isFunc() const {
return kind == Kind::Func;