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.
This commit is contained in:
Paolo Tranquilli
2022-10-26 06:47:19 +02:00
parent e422a4eef9
commit 521e6235b5
23 changed files with 254 additions and 178 deletions

View File

@@ -2,8 +2,8 @@
#include <iomanip>
namespace codeql {
std::optional<TargetFile> createTargetTrapFile(const SwiftExtractorConfiguration& configuration,
std::string_view target) {
std::string trap{target};
const std::filesystem::path& target) {
auto trap = target;
trap += ".trap";
auto ret = TargetFile::create(trap, configuration.trapDir, configuration.getTempTrapDir());
if (ret) {