Files
codeql/swift/extractor/SwiftExtractorConfiguration.h
Paolo Tranquilli 521e6235b5 Swift: use std::filesystem and picoSHA2
This replaces usages of `llvm::fs` and string manipulation with
`std::filesystem`, also replacing `std::string` with
`std::filesystem::path` where it made sense.

Moreover MD5 hashing used in macOS file remapping was replaced by
SHA256 hashing using a small header-only SHA256 C++ library with an
MIT license, https://github.com/okdshin/PicoSHA2.

File contents hashing was relocated to the newly created `file` library
for later planned reuse.
2022-10-26 13:23:44 +02:00

43 lines
1.6 KiB
C++

#pragma once
#include <string>
#include <vector>
#include <filesystem>
#include "swift/extractor/infra/file/TargetFile.h"
namespace codeql {
struct SwiftExtractorConfiguration {
// The location for storing TRAP files to be imported by CodeQL engine.
std::filesystem::path trapDir;
// The location for storing extracted source files.
std::filesystem::path sourceArchiveDir;
// A temporary directory that exists during database creation, but is deleted once the DB is
// finalized.
std::filesystem::path scratchDir;
// The original arguments passed to the extractor. Used for debugging.
std::vector<std::string> frontendOptions;
// The patched arguments passed to the swift::performFrontend/ Used for debugging.
std::vector<std::string> patchedFrontendOptions;
// A temporary directory that contains TRAP files before they are moved into their final
// destination.
std::filesystem::path getTempTrapDir() const { return scratchDir / "swift-trap-temp"; }
// VFS (virtual file system) support.
// A temporary directory that contains VFS files used during extraction.
std::filesystem::path getVFSDir() const { return scratchDir / "swift-vfs"; }
// A temporary directory that contains temp VFS files before they moved into VFSDir.
std::filesystem::path getTempVFSDir() const { return scratchDir / "swift-vfs-temp"; }
// A temporary directory that contains build artifacts generated by the extractor during the
// overall extraction process.
std::filesystem::path getTempArtifactDir() const {
return scratchDir / "swift-extraction-artifacts";
}
};
} // namespace codeql