| 79 | ParseCache::ParseCache(ParseFile* parser) : m_parse(parser) {} |
| 80 | |
| 81 | PathId ParseCache::getCacheFileId(PathId ppFileId) const { |
| 82 | if (!ppFileId) ppFileId = m_parse->getPpFileId(); |
| 83 | if (!ppFileId) return BadPathId; |
| 84 | |
| 85 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 86 | CommandLineParser* clp = |
| 87 | m_parse->getCompileSourceFile()->getCommandLineParser(); |
| 88 | SymbolTable* const symbolTable = |
| 89 | m_parse->getCompileSourceFile()->getSymbolTable(); |
| 90 | |
| 91 | const std::string_view libName = m_parse->getLibrary()->getName(); |
| 92 | |
| 93 | if (clp->parseOnly()) { |
| 94 | // If parseOnly flag is set, the Preprocessor doesn't actually generate |
| 95 | // an output file. Instead it uses the source itself i.e. from the original |
| 96 | // source location. Compute the "potential" Preprocessor output file so the |
| 97 | // cache file location would be correct. |
| 98 | ppFileId = fileSystem->getPpOutputFile(clp->fileunit(), ppFileId, libName, |
| 99 | symbolTable); |
| 100 | } |
| 101 | |
| 102 | Precompiled* const prec = Precompiled::getSingleton(); |
| 103 | const bool isPrecompiled = prec->isFilePrecompiled(ppFileId, symbolTable); |
| 104 | |
| 105 | return fileSystem->getParseCacheFile(clp->fileunit(), ppFileId, libName, |
| 106 | isPrecompiled, symbolTable); |
| 107 | } |
| 108 | |
| 109 | bool ParseCache::checkCacheIsValid(PathId cacheFileId, |
| 110 | const ::ParseCache::Reader& root) const { |
nothing calls this directly
no test coverage detected