Ignore:
Timestamp:
Mar 20, 2018, 11:46:06 AM (17 months ago)
Author:
cameron
Message:

Move getMangleName into cpudriver to avoid dangling reference

Location:
icGREP/icgrep-devel/icgrep/toolchain
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.cpp

    r5917 r5919  
    232232
    233233
     234
     235std::string ParabixDriver::getMangledName(std::string s) {
     236    DataLayout DL(mTarget->createDataLayout());   
     237    std::string MangledName;
     238    raw_string_ostream MangledNameStream(MangledName);
     239    Mangler::getNameWithPrefix(MangledNameStream, s, DL);
     240    return MangledName;
     241}
     242
     243
    234244void ParabixDriver::preparePassManager() {
    235245    PassRegistry * Registry = PassRegistry::getPassRegistry();
     
    303313            [&](const std::string &Name) {
    304314                auto SymAddr = RTDyldMemoryManager::getSymbolAddressInProcess(Name);
    305                 if (!SymAddr) SymAddr = RTDyldMemoryManager::getSymbolAddressInProcess(iBuilder->getMangledName(Name));
     315                if (!SymAddr) SymAddr = RTDyldMemoryManager::getSymbolAddressInProcess(getMangledName(Name));
    306316#if LLVM_VERSION_INTEGER <= LLVM_VERSION_CODE(3, 9, 1)
    307317                if (SymAddr) return RuntimeDyld::SymbolInfo(SymAddr, JITSymbolFlags::Exported);
     
    358368    return mEngine->getPointerToNamedFunction("Main");
    359369#else
    360     auto MainSym = mCompileLayer->findSymbol(iBuilder->getMangledName("Main"), false);
     370    auto MainSym = mCompileLayer->findSymbol(getMangledName("Main"), false);
    361371    assert (MainSym && "Main not found");
    362372   
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.h

    r5917 r5919  
    5656
    5757private:
     58    std::string getMangledName(std::string s);
     59   
    5860    void preparePassManager();
    5961
Note: See TracChangeset for help on using the changeset viewer.