Apply suggestions from code review

Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
This commit is contained in:
AlexDenisov
2022-06-30 08:47:17 +02:00
committed by GitHub
parent 4d81206a87
commit 522d48aa33
2 changed files with 7 additions and 7 deletions

View File

@@ -12,7 +12,7 @@
#include <iostream> #include <iostream>
// Creates a copy of the output file map and updated remapping table in place // Creates a copy of the output file map and updated remapping table in place
// It does not change the original map file as it is dependent upon by the original compiler // It does not change the original map file as it is depended upon by the original compiler
// Returns path to the newly created output file map on success, or None in a case of failure // Returns path to the newly created output file map on success, or None in a case of failure
static std::optional<std::string> rewriteOutputFileMap( static std::optional<std::string> rewriteOutputFileMap(
const codeql::SwiftExtractorConfiguration& config, const codeql::SwiftExtractorConfiguration& config,
@@ -58,7 +58,7 @@ static std::optional<std::string> rewriteOutputFileMap(
return newPath; return newPath;
} }
// This is Xcode-specific workaround to produce alias names for an existing .swiftmodule file. // This is an Xcode-specific workaround to produce alias names for an existing .swiftmodule file.
// In the case of Xcode, it calls the Swift compiler and asks it to produce a Swift module. // In the case of Xcode, it calls the Swift compiler and asks it to produce a Swift module.
// Once it's done, Xcode moves the .swiftmodule file in another location, and the location is // Once it's done, Xcode moves the .swiftmodule file in another location, and the location is
// rather arbitrary. Here are examples of such locations: // rather arbitrary. Here are examples of such locations:
@@ -84,10 +84,10 @@ static std::optional<std::string> rewriteOutputFileMap(
// The <Triple> here is a normalized target triple (e.g. arm64-apple-iphoneos15.4 -> // The <Triple> here is a normalized target triple (e.g. arm64-apple-iphoneos15.4 ->
// arm64-apple-iphoneos). // arm64-apple-iphoneos).
// //
// This method construct those aliases for a module only if it comes from Xcode, which is detected // This method constructs those aliases for a module only if it comes from Xcode, which is detected
// by the presence of `Intermediates.noindex` directory in the module path. // by the presence of an `Intermediates.noindex` directory in the module path.
// //
// In the case of Swift Package Manager (`swift build`) this is not needed. // In the case of the Swift Package Manager (`swift build`) this is not needed.
static std::vector<std::string> computeModuleAliases(llvm::StringRef modulePath, static std::vector<std::string> computeModuleAliases(llvm::StringRef modulePath,
const std::string& targetTriple) { const std::string& targetTriple) {
if (modulePath.empty()) { if (modulePath.empty()) {

View File

@@ -16,8 +16,8 @@ std::unordered_map<std::string, std::string> rewriteOutputsInPlace(
SwiftExtractorConfiguration& config, SwiftExtractorConfiguration& config,
std::vector<std::string>& CLIArgs); std::vector<std::string>& CLIArgs);
// Recreate all the redirected new paths as the Swift compiler expects them to be present // Create directories for all the redirected new paths as the Swift compiler expects them to exist.
void ensureNewPathsExist(const std::unordered_map<std::string, std::string>& remapping); void ensureDirectoriesForNewPathsExist(const std::unordered_map<std::string, std::string>& remapping);
// Stores remapped `.swiftmoduile`s in a YAML file for later consumption by the // Stores remapped `.swiftmoduile`s in a YAML file for later consumption by the
// llvm::RedirectingFileSystem via Swift's VFSOverlayFiles. // llvm::RedirectingFileSystem via Swift's VFSOverlayFiles.