Skip to content

[clang][cas] Fix crash on invalid with IncludeTreeBuilder #11075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

benlangmuir
Copy link

If an error occurs in FrontendAction::BeginSourceFile after IncludeTreeActionController::initializeModuleBuild is called (via BeginInvocation), the builder is left in an inconsistent state because there is no call to finalizeModuleBuild (via HandleTranslationUnit), so we should exit early without attempting to create an include tree for the broken module. Fixes a crash on invalid seen with a missing module header, but there could be other similar cases.

rdar://151878898

If an error occurs in FrontendAction::BeginSourceFile after
IncludeTreeActionController::initializeModuleBuild is called (via
BeginInvocation), the builder is left in an inconsistent state because
there is no call to finalizeModuleBuild (via HandleTranslationUnit), so
we should exit early without attempting to create an include tree for
the broken module. Fixes a crash on invalid seen with a missing module
header, but there could be other similar cases.

rdar://151878898
@benlangmuir
Copy link
Author

@swift-ci please test llvm

@benlangmuir benlangmuir merged commit 4feb466 into swiftlang:next Jul 30, 2025
1 of 2 checks passed
@benlangmuir benlangmuir deleted the includetreebuilder-crash-on-invalid branch July 30, 2025 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants