GCC Code Coverage Report


Directory: ../
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 9.1% 1 / 0 / 11
Functions: 33.3% 1 / 0 / 3
Branches: 0.0% 0 / 0 / 24

src/global/CacheManager.cpp
Line Branch Exec Source
1 // Copyright (c) 2021-2026 ChilliBits. All rights reserved.
2
3 #include "CacheManager.h"
4
5 #include <SourceFile.h>
6 #include <driver/Driver.h>
7 #include <util/SystemUtil.h>
8
9 namespace spice::compiler {
10
11 458 CacheManager::CacheManager(const CliOptions &cliOptions) : cliOptions(cliOptions), cacheDir(cliOptions.cacheDir) {}
12
13 bool CacheManager::lookupSourceFile(const SourceFile *sourceFile) const {
14 const std::filesystem::path symbolTableFilePath = cacheDir / (sourceFile->cacheKey + ".bson");
15 const char *objectFileExtension = SystemUtil::getOutputFileExtension(cliOptions, OutputContainer::OBJECT_FILE);
16 const std::filesystem::path objectFilePath = cacheDir / (sourceFile->cacheKey + objectFileExtension);
17
18 // Check if cache entry is available
19 if (!exists(symbolTableFilePath) || !exists(objectFilePath))
20 return false;
21
22 // Load symbol table
23
24 // Set object file path
25
26 return true;
27 }
28
29 void CacheManager::cacheSourceFile(const SourceFile * /*sourceFile*/) {
30 // Cache symbol table
31
32 // Cache object file
33 }
34
35 } // namespace spice::compiler
36