MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / checkCacheIsValid

Method checkCacheIsValid

src/Cache/PythonAPICache.cpp:86–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86bool PythonAPICache::checkCacheIsValid(
87 PathId cacheFileId, const ::PythonAPICache::Reader& root) const {
88 FileSystem* const fileSystem = FileSystem::getInstance();
89 const ::Header::Reader& sourceHeader = root.getHeader();
90
91 SymbolTable* const targetSymbols =
92 m_listener->getCompileSourceFile()->getSymbolTable();
93
94 const std::string scriptFile(root.getScriptFile().cStr());
95 const PathId scriptFileId =
96 fileSystem->toPathId(fileSystem->remap(scriptFile), targetSymbols);
97
98 std::filesystem::file_time_type ct = fileSystem->modtime(cacheFileId);
99 std::filesystem::file_time_type ft = fileSystem->modtime(scriptFileId);
100
101 if (ft == std::filesystem::file_time_type::min()) {
102 return false;
103 }
104 if (ct == std::filesystem::file_time_type::min()) {
105 return false;
106 }
107 if (ct < ft) {
108 return false;
109 }
110
111 return checkIfCacheIsValid(sourceHeader, kSchemaVersion, cacheFileId,
112 m_listener->getParseFile()->getFileId(LINE1));
113}
114
115bool PythonAPICache::checkCacheIsValid(PathId cacheFileId) const {
116 if (!cacheFileId) return false;

Callers

nothing calls this directly

Calls 8

toPathIdMethod · 0.80
remapMethod · 0.80
getParseFileMethod · 0.80
toPlatformAbsPathMethod · 0.80
getSymbolTableMethod · 0.45
getCompileSourceFileMethod · 0.45
modtimeMethod · 0.45
getFileIdMethod · 0.45

Tested by

no test coverage detected