|
26 | 26 | #include "swift/AST/ConcreteDeclRef.h"
|
27 | 27 | #include "swift/AST/DiagnosticEngine.h"
|
28 | 28 | #include "swift/AST/DiagnosticsClangImporter.h"
|
| 29 | +#include "swift/AST/DiagnosticsFrontend.h" |
29 | 30 | #include "swift/AST/DiagnosticsSema.h"
|
30 | 31 | #include "swift/AST/Evaluator.h"
|
31 | 32 | #include "swift/AST/IRGenOptions.h"
|
@@ -4206,9 +4207,22 @@ ClangImporter::getSwiftExplicitModuleDirectCC1Args() const {
|
4206 | 4207 |
|
4207 | 4208 | if (!Impl.SwiftContext.SearchPathOpts.ScannerPrefixMapper.empty()) {
|
4208 | 4209 | // Remap all the paths if requested.
|
| 4210 | + // FIXME: Should we also do |
| 4211 | + // https://github.com/swiftlang/llvm-project/pull/10723? |
4209 | 4212 | llvm::PrefixMapper Mapper;
|
4210 |
| - clang::tooling::dependencies::DepscanPrefixMapping::configurePrefixMapper( |
4211 |
| - Impl.SwiftContext.SearchPathOpts.ScannerPrefixMapper, Mapper); |
| 4213 | + SmallVector<llvm::MappedPrefix> Prefixes; |
| 4214 | + if (auto E = llvm::MappedPrefix::transformJoined( |
| 4215 | + Impl.SwiftContext.SearchPathOpts.ScannerPrefixMapper, Prefixes)) { |
| 4216 | + // Save this string. In general the diagnostic might outlive this |
| 4217 | + // function. |
| 4218 | + auto identifier = |
| 4219 | + Impl.SwiftContext.getIdentifier(llvm::toString(std::move(E))); |
| 4220 | + Impl.SwiftContext.Diags.diagnose(SourceLoc(), diag::error_prefix_mapping, |
| 4221 | + identifier.str()); |
| 4222 | + } |
| 4223 | + Mapper.addRange(Prefixes); |
| 4224 | + Mapper.sort(); |
| 4225 | + |
4212 | 4226 | clang::tooling::dependencies::DepscanPrefixMapping::remapInvocationPaths(
|
4213 | 4227 | instance, Mapper);
|
4214 | 4228 | instance.getFrontendOpts().PathPrefixMappings.clear();
|
|
0 commit comments