xo-jit: refactor: Jit::mangle() -> std::string_view
This commit is contained in:
parent
ce9d93240a
commit
72d0305cdb
3 changed files with 23 additions and 17 deletions
|
|
@ -133,8 +133,10 @@ namespace xo {
|
|||
/** intern @p symbol, binding it to address @p dest **/
|
||||
template <typename T>
|
||||
llvm::Error intern_symbol(const std::string & symbol, T * dest) {
|
||||
auto mangled_sym = mangler_(symbol);
|
||||
|
||||
llvm::orc::SymbolMap symbol_map;
|
||||
symbol_map[mangler_(symbol)]
|
||||
symbol_map[mangled_sym]
|
||||
= llvm::orc::ExecutorSymbolDef(llvm::orc::ExecutorAddr::fromPtr(dest),
|
||||
llvm::JITSymbolFlags());
|
||||
|
||||
|
|
@ -144,8 +146,10 @@ namespace xo {
|
|||
} /*intern_symbol*/
|
||||
|
||||
/** report mangled symbol name **/
|
||||
auto mangle(StringRef name) {
|
||||
return this->mangler_(name.str());
|
||||
std::string_view mangle(StringRef name) {
|
||||
auto tmp = *(this->mangler_(name.str()));
|
||||
|
||||
return std::string_view(tmp.data(), tmp.size());
|
||||
}
|
||||
|
||||
llvm::Expected<ExecutorSymbolDef> lookup(StringRef name) {
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ namespace xo {
|
|||
/** dump text description of module contents to console **/
|
||||
void dump_current_module();
|
||||
|
||||
/** report mangle symbol **/
|
||||
std::string mangle(const std::string & x) const;
|
||||
/** report mangled symbol for @p x **/
|
||||
std::string_view mangle(const std::string & x) const;
|
||||
|
||||
/** lookup symbol in jit-associated output library **/
|
||||
llvm::Expected<llvm::orc::ExecutorAddr> lookup_symbol(const std::string & x);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue