mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -499,7 +499,7 @@ public:
|
|||||||
bool SkipSDKImportPaths = false;
|
bool SkipSDKImportPaths = false;
|
||||||
|
|
||||||
/// Scanner Prefix Mapper.
|
/// Scanner Prefix Mapper.
|
||||||
std::vector<std::string> ScannerPrefixMapper;
|
std::vector<std::pair<std::string, std::string>> ScannerPrefixMapper;
|
||||||
|
|
||||||
/// Verify resolved plugin is not changed.
|
/// Verify resolved plugin is not changed.
|
||||||
bool ResolvedPluginVerification = false;
|
bool ResolvedPluginVerification = false;
|
||||||
|
|||||||
@@ -755,12 +755,8 @@ bool SwiftDependencyScanningService::setupCachingDependencyScanningService(
|
|||||||
if (!ScannerPrefixMapper.empty()) {
|
if (!ScannerPrefixMapper.empty()) {
|
||||||
Mapper = std::make_unique<llvm::PrefixMapper>();
|
Mapper = std::make_unique<llvm::PrefixMapper>();
|
||||||
SmallVector<llvm::MappedPrefix, 4> Prefixes;
|
SmallVector<llvm::MappedPrefix, 4> Prefixes;
|
||||||
if (auto E = llvm::MappedPrefix::transformJoined(ScannerPrefixMapper,
|
llvm::MappedPrefix::transformPairs(ScannerPrefixMapper,
|
||||||
Prefixes)) {
|
Prefixes);
|
||||||
Instance.getDiags().diagnose(SourceLoc(), diag::error_prefix_mapping,
|
|
||||||
toString(std::move(E)));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Mapper->addRange(Prefixes);
|
Mapper->addRange(Prefixes);
|
||||||
Mapper->sort();
|
Mapper->sort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,9 @@ using namespace clang::tooling::dependencies;
|
|||||||
static void addScannerPrefixMapperInvocationArguments(
|
static void addScannerPrefixMapperInvocationArguments(
|
||||||
std::vector<std::string> &invocationArgStrs, ASTContext &ctx) {
|
std::vector<std::string> &invocationArgStrs, ASTContext &ctx) {
|
||||||
for (const auto &arg : ctx.SearchPathOpts.ScannerPrefixMapper) {
|
for (const auto &arg : ctx.SearchPathOpts.ScannerPrefixMapper) {
|
||||||
std::string prefixMapArg = "-fdepscan-prefix-map=" + arg;
|
invocationArgStrs.push_back("-fdepscan-prefix-map");
|
||||||
invocationArgStrs.push_back(prefixMapArg);
|
invocationArgStrs.push_back(arg.first);
|
||||||
|
invocationArgStrs.push_back(arg.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "llvm/Support/FileSystem.h"
|
#include "llvm/Support/FileSystem.h"
|
||||||
#include "llvm/Support/LineIterator.h"
|
#include "llvm/Support/LineIterator.h"
|
||||||
#include "llvm/Support/Path.h"
|
#include "llvm/Support/Path.h"
|
||||||
|
#include "llvm/Support/PrefixMapper.h"
|
||||||
#include "llvm/Support/Process.h"
|
#include "llvm/Support/Process.h"
|
||||||
#include "llvm/Support/VersionTuple.h"
|
#include "llvm/Support/VersionTuple.h"
|
||||||
#include "llvm/Support/WithColor.h"
|
#include "llvm/Support/WithColor.h"
|
||||||
@@ -2473,7 +2474,11 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,
|
|||||||
Opts.DeserializedPathRecoverer.addMapping(SplitMap.first, SplitMap.second);
|
Opts.DeserializedPathRecoverer.addMapping(SplitMap.first, SplitMap.second);
|
||||||
}
|
}
|
||||||
for (StringRef Opt : Args.getAllArgValues(OPT_scanner_prefix_map)) {
|
for (StringRef Opt : Args.getAllArgValues(OPT_scanner_prefix_map)) {
|
||||||
Opts.ScannerPrefixMapper.push_back(Opt.str());
|
if (auto Mapping = llvm::MappedPrefix::getFromJoined(Opt)) {
|
||||||
|
Opts.ScannerPrefixMapper.push_back({Mapping->Old, Mapping->New});
|
||||||
|
} else {
|
||||||
|
Diags.diagnose(SourceLoc(), diag::error_prefix_mapping, Opt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Opts.ResolvedPluginVerification |=
|
Opts.ResolvedPluginVerification |=
|
||||||
|
|||||||
Reference in New Issue
Block a user