Skip to content

Commit c8077e8

Browse files
committed
[Gardening] Add a SourceLoc For Cross-Import Overlay Diagnostics
1 parent a4bcbfa commit c8077e8

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
17791779
if (!clangModule)
17801780
return nullptr;
17811781

1782-
return finishLoadingClangModule(importLoc, clangModule);
1782+
return finishLoadingClangModule(clangModule, importLoc);
17831783
}
17841784

17851785
ModuleDecl *
@@ -1799,7 +1799,7 @@ ModuleDecl *ClangImporter::Implementation::loadModule(
17991799
}
18001800

18011801
ModuleDecl *ClangImporter::Implementation::finishLoadingClangModule(
1802-
SourceLoc importLoc, const clang::Module *clangModule) {
1802+
const clang::Module *clangModule, SourceLoc importLoc) {
18031803
assert(clangModule);
18041804

18051805
// Bump the generation count.
@@ -1841,7 +1841,7 @@ ModuleDecl *ClangImporter::Implementation::finishLoadingClangModule(
18411841
}
18421842

18431843
if (clangModule->isSubModule()) {
1844-
finishLoadingClangModule(importLoc, clangModule->getTopLevelModule());
1844+
finishLoadingClangModule(clangModule->getTopLevelModule(), importLoc);
18451845
} else {
18461846
ModuleDecl *&loaded = SwiftContext.LoadedModules[result->getName()];
18471847
if (!loaded)
@@ -1871,7 +1871,7 @@ void ClangImporter::Implementation::handleDeferredImports(SourceLoc diagLoc) {
18711871
// officially supported with bridging headers: app targets and unit tests
18721872
// only. Unfortunately that's not enforced.
18731873
for (size_t i = 0; i < ImportedHeaderExports.size(); ++i) {
1874-
(void)finishLoadingClangModule(diagLoc, ImportedHeaderExports[i]);
1874+
(void)finishLoadingClangModule(ImportedHeaderExports[i], diagLoc);
18751875
}
18761876
}
18771877

@@ -2012,7 +2012,7 @@ ClangImporter::Implementation::~Implementation() {
20122012
}
20132013

20142014
ClangModuleUnit *ClangImporter::Implementation::getWrapperForModule(
2015-
const clang::Module *underlying) {
2015+
const clang::Module *underlying, SourceLoc diagLoc) {
20162016
auto &cacheEntry = ModuleWrappers[underlying];
20172017
if (ClangModuleUnit *cached = cacheEntry.getPointer())
20182018
return cached;
@@ -2027,7 +2027,7 @@ ClangModuleUnit *ClangImporter::Implementation::getWrapperForModule(
20272027
auto file = new (SwiftContext) ClangModuleUnit(*wrapper, *this,
20282028
underlying);
20292029
wrapper->addFile(*file);
2030-
SwiftContext.getClangModuleLoader()->findOverlayFiles(SourceLoc(), wrapper, file);
2030+
SwiftContext.getClangModuleLoader()->findOverlayFiles(diagLoc, wrapper, file);
20312031
cacheEntry.setPointer(file);
20322032

20332033
return file;

lib/ClangImporter/ImporterImpl.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,12 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
922922

923923
/// Retrieves the Swift wrapper for the given Clang module, creating
924924
/// it if necessary.
925-
ClangModuleUnit *getWrapperForModule(const clang::Module *underlying);
925+
ClangModuleUnit *getWrapperForModule(const clang::Module *underlying,
926+
SourceLoc importLoc = SourceLoc());
926927

927928
/// Constructs a Swift module for the given Clang module.
928-
ModuleDecl *finishLoadingClangModule(SourceLoc importLoc,
929-
const clang::Module *clangModule);
929+
ModuleDecl *finishLoadingClangModule(const clang::Module *clangModule,
930+
SourceLoc importLoc);
930931

931932
/// Call finishLoadingClangModule on each deferred import collected
932933
/// while scanning a bridging header or PCH.

0 commit comments

Comments
 (0)