| 246 | ~LLIObjectCache() override {} |
| 247 | |
| 248 | void notifyObjectCompiled(const Module *M, MemoryBufferRef Obj) override { |
| 249 | const std::string &ModuleID = M->getModuleIdentifier(); |
| 250 | std::string CacheName; |
| 251 | if (!getCacheFilename(ModuleID, CacheName)) |
| 252 | return; |
| 253 | if (!CacheDir.empty()) { // Create user-defined cache dir. |
| 254 | SmallString<128> dir(sys::path::parent_path(CacheName)); |
| 255 | sys::fs::create_directories(Twine(dir)); |
| 256 | } |
| 257 | std::error_code EC; |
| 258 | raw_fd_ostream outfile(CacheName, EC, sys::fs::F_None); |
| 259 | outfile.write(Obj.getBufferStart(), Obj.getBufferSize()); |
| 260 | outfile.close(); |
| 261 | } |
| 262 | |
| 263 | std::unique_ptr<MemoryBuffer> getObject(const Module* M) override { |
| 264 | const std::string &ModuleID = M->getModuleIdentifier(); |
no test coverage detected