|
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"
|
@@ -4207,8 +4208,19 @@ ClangImporter::getSwiftExplicitModuleDirectCC1Args() const {
|
4207 | 4208 | if (!Impl.SwiftContext.SearchPathOpts.ScannerPrefixMapper.empty()) {
|
4208 | 4209 | // Remap all the paths if requested.
|
4209 | 4210 | llvm::PrefixMapper Mapper;
|
4210 |
| - clang::tooling::dependencies::DepscanPrefixMapping::configurePrefixMapper( |
4211 |
| - Impl.SwiftContext.SearchPathOpts.ScannerPrefixMapper, Mapper); |
| 4211 | + SmallVector<llvm::MappedPrefix> Prefixes; |
| 4212 | + if (auto E = llvm::MappedPrefix::transformJoined( |
| 4213 | + Impl.SwiftContext.SearchPathOpts.ScannerPrefixMapper, Prefixes)) { |
| 4214 | + // Take permanent ownership of this string. In general the diagnostic |
| 4215 | + // might outlive this function. |
| 4216 | + auto errorMessage = |
| 4217 | + Impl.SwiftContext.AllocateCopy(llvm::toString(std::move(E))); |
| 4218 | + Impl.SwiftContext.Diags.diagnose(SourceLoc(), diag::error_prefix_mapping, |
| 4219 | + errorMessage); |
| 4220 | + } |
| 4221 | + Mapper.addRange(Prefixes); |
| 4222 | + Mapper.sort(); |
| 4223 | + |
4212 | 4224 | clang::tooling::dependencies::DepscanPrefixMapping::remapInvocationPaths(
|
4213 | 4225 | instance, Mapper);
|
4214 | 4226 | instance.getFrontendOpts().PathPrefixMappings.clear();
|
|
0 commit comments