src/iroptimizer/CoverageWorkingDirFileSystem.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2026 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #include "CoverageWorkingDirFileSystem.h" | ||
| 4 | |||
| 5 | #include <llvm/Support/VirtualFileSystem.h> | ||
| 6 | |||
| 7 | namespace spice::compiler { | ||
| 8 | |||
| 9 | namespace { | ||
| 10 | // LCOV_EXCL_START | ||
| 11 | class FixedWorkingDirFileSystem final : public llvm::vfs::ProxyFileSystem { | ||
| 12 | public: | ||
| 13 | − | FixedWorkingDirFileSystem(llvm::IntrusiveRefCntPtr<FileSystem> fs, std::string workingDir) | |
| 14 | − | : ProxyFileSystem(std::move(fs)), workingDir(std::move(workingDir)) {} | |
| 15 | |||
| 16 | − | llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const override { return workingDir; } | |
| 17 | |||
| 18 | private: | ||
| 19 | std::string workingDir; | ||
| 20 | }; | ||
| 21 | // LCOV_EXCL_STOP | ||
| 22 | } // namespace | ||
| 23 | |||
| 24 | 2739 | llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> createFixedWorkingDirFileSystem(std::string workingDir) { | |
| 25 | − | return new FixedWorkingDirFileSystem(llvm::vfs::getRealFileSystem(), std::move(workingDir)); // GCOV_EXCL_LINE | |
| 26 | } | ||
| 27 | |||
| 28 | } // namespace spice::compiler | ||
| 29 |