Skip to content

Commit 1cf8d2e

Browse files
[ClangImporter] Fix Build Break Due to clang API changes (#84925)
<!-- If this pull request is targeting a release branch, please fill out the following form: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1 Otherwise, replace this comment with a description of your changes and rationale. Provide links to external references/discussions if appropriate. If this pull request resolves any GitHub issues, link them like so: Resolves <link to issue>, resolves <link to another issue>. For more information about linking a pull request to an issue, see: https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue --> <!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci Thank you for your contribution to Swift! --> swiftlang/llvm-project#11631 is cherry-picking `clang` commits that change `CompilerInstance`'s APIs. The API changes are causing Swift build breaks. This PR fixes the API breaks. --------- Co-authored-by: Jan Svoboda <[email protected]>
1 parent 167c540 commit 1cf8d2e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ bool ClangImporter::canReadPCH(StringRef PCHFilename) {
10221022
// Note: Reusing the file manager is safe; this is a component that's already
10231023
// reused when building PCM files for the module cache.
10241024
CI.setVirtualFileSystem(Impl.Instance->getVirtualFileSystemPtr());
1025-
CI.setFileManager(&Impl.Instance->getFileManager());
1025+
CI.setFileManager(Impl.Instance->getFileManagerPtr());
10261026
CI.createSourceManager();
10271027
auto &clangSrcMgr = CI.getSourceManager();
10281028
auto FID = clangSrcMgr.createFileID(
@@ -1409,7 +1409,6 @@ std::unique_ptr<ClangImporter> ClangImporter::create(
14091409
auto actualDiagClient = std::make_unique<ClangDiagnosticConsumer>(
14101410
importer->Impl, instance.getDiagnosticOpts(),
14111411
importerOpts.DumpClangDiagnostics);
1412-
14131412
instance.createVirtualFileSystem(std::move(VFS), actualDiagClient.get());
14141413
instance.createFileManager();
14151414
instance.createDiagnostics(actualDiagClient.release());
@@ -1927,7 +1926,7 @@ std::string ClangImporter::getBridgingHeaderContents(
19271926
&Impl.Instance->getModuleCache());
19281927
rewriteInstance.setVirtualFileSystem(
19291928
Impl.Instance->getVirtualFileSystemPtr());
1930-
rewriteInstance.setFileManager(&Impl.Instance->getFileManager());
1929+
rewriteInstance.setFileManager(Impl.Instance->getFileManagerPtr());
19311930
rewriteInstance.createDiagnostics(new clang::IgnoringDiagConsumer);
19321931
rewriteInstance.createSourceManager();
19331932
rewriteInstance.setTarget(&Impl.Instance->getTarget());
@@ -1977,8 +1976,7 @@ std::string ClangImporter::getBridgingHeaderContents(
19771976
return "";
19781977
}
19791978

1980-
if (auto fileInfo =
1981-
rewriteInstance.getFileManager().getOptionalFileRef(headerPath)) {
1979+
if (auto fileInfo = rewriteInstance.getFileManager().getOptionalFileRef(headerPath)) {
19821980
fileSize = fileInfo->getSize();
19831981
fileModTime = fileInfo->getModificationTime();
19841982
}
@@ -2032,7 +2030,7 @@ ClangImporter::cloneCompilerInstanceForPrecompiling() {
20322030
&Impl.Instance->getModuleCache());
20332031
clonedInstance->setVirtualFileSystem(
20342032
Impl.Instance->getVirtualFileSystemPtr());
2035-
clonedInstance->setFileManager(&Impl.Instance->getFileManager());
2033+
clonedInstance->setFileManager(Impl.Instance->getFileManagerPtr());
20362034
clonedInstance->createDiagnostics(&Impl.Instance->getDiagnosticClient(),
20372035
/*ShouldOwnClient=*/false);
20382036
clonedInstance->createSourceManager();

0 commit comments

Comments
 (0)