llvm-project
e9109268 - [ORC] Add SymbolNameSpec, hoist name mangling into Shared.

Commit
31 days ago
[ORC] Add SymbolNameSpec, hoist name mangling into Shared. Introduce two Shared, ExecutionSession-independent pieces: - SymbolNameSpec (Shared/SymbolNameSpec.h): a StringRef paired with a SymbolNameKind (Verbatim, Linker, IR, C) describing the naming level a symbol name is expressed in. A lightweight, dependency-free value type, so it can describe interface-name constants in Shared headers. - Mangler (Shared/Mangler.h, Shared/Mangler.cpp): the linker name-mangling logic factored out of MangleAndInterner. It holds only a ManglingMode (no ExecutionSession or SymbolStringPool), so names can be mangled on the executor side as well as the controller side. It exposes withMangledNameDo (which avoids allocating when mangling is a no-op) and a mangledCopy convenience, both dispatching on the spec's SymbolNameKind. MangleAndInterner becomes a thin wrapper: it derives a ManglingMode (from an ABIName / ManglingMode / DataLayout), holds a Mangler, and interns whatever the Mangler produces. Behavior is unchanged. This lets lookup utilities eventually accept C / IR source names and mangle them to linker level on the caller's behalf, rather than requiring pre-mangled names. The MangleAndInternerTest unit tests are renamed to ManglerTest and now exercise Mangler directly; MangleAndInterner is left untested since it is slated for removal.
Author
Parents
Loading