return reinterpret_cast<PtrTy>(static_cast<uintptr_t>(Addr));
}
-int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
- char* ArgV[]) {
+int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,
+ const std::vector<std::string> &Args) {
// Add the program's symbols into the JIT's search space.
if (sys::DynamicLibrary::LoadLibraryPermanently(nullptr)) {
errs() << "Error loading program symbols.\n";
}
typedef int (*MainFnPtr)(int, char*[]);
+ std::vector<const char *> ArgV;
+ for (auto &Arg : Args)
+ ArgV.push_back(Arg.c_str());
auto Main = fromTargetAddress<MainFnPtr>(MainSym.getAddress());
- return Main(ArgC, ArgV);
+ return Main(ArgV.size(), (char**)ArgV.data());
}
std::vector<orc::CtorDtorRunner<CODLayerT>> IRStaticDestructorRunners;
};
-int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
- char* ArgV[]);
+int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,
+ const std::vector<std::string> &Args);
} // end namespace llvm
return 1;
}
}
- return runOrcLazyJIT(std::move(Ms), argc, argv);
+ std::vector<std::string> Args;
+ Args.push_back(InputFile);
+ for (auto &Arg : InputArgv)
+ Args.push_back(Arg);
+ return runOrcLazyJIT(std::move(Ms), Args);
}
if (EnableCacheManager) {