Skip to content

Add HEADER_DEPENDENCIES build setting with validation #706

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

bob-wilson
Copy link
Contributor

This is similar to MODULE_DEPENDENCIES but for non-modular header file inclusion dependencies. Our approach to this has changed a bit over the last few months, and the trace output from Clang does not distinguish the modular vs. non-modular includes. We will work on fixing that, but in the meantime, this continues the placeholder approach used for MODULE_DEPENDENCIES where it assumes anything in a framework has a module with the same name as the framework.

This also removes moduleDependenciesContext from ClangTaskPayload because the code that needs that now gets it from ValidateDependenciesPayload.

rdar://150309197

@bob-wilson
Copy link
Contributor Author

@swift-ci test

@neonichu
Copy link
Collaborator

neonichu commented Aug 5, 2025

This also removes moduleDependenciesContext from ClangTaskPayload because the code that needs that now gets it from ValidateDependenciesPayload.

I am bringing back the need for this in #703 to emit per-task diagnostics in the YES_ERROR case. Would be easier if you just kept it around in your PR.

@neonichu
Copy link
Collaborator

neonichu commented Aug 6, 2025

@swift-ci test macOS

1 similar comment
@bob-wilson
Copy link
Contributor Author

@swift-ci test macOS

@bob-wilson bob-wilson force-pushed the bwilson/header-dependency-validation branch from e659f44 to e74a2ba Compare August 7, 2025 16:39
@bob-wilson
Copy link
Contributor Author

@swift-ci test

@@ -81,6 +81,6 @@ struct UniversalPlatformTaskProducerExtension: TaskProducerExtension {

struct UniversalPlatformTaskActionExtension: TaskActionExtension {
var taskActionImplementations: [SWBUtil.SerializableTypeCode : any SWBUtil.PolymorphicSerializable.Type] {
[41: TestEntryPointGenerationTaskAction.self]
[44: TestEntryPointGenerationTaskAction.self]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owenv The value of 41 was previously one higher than the largest type code in BuiltinTaskActionsExtension. I've increased it by 3 to account for the 1 new task action added here plus the 2 others that you just added. This seems fragile, though. If the intent is for it to have a unique code here, maybe we should put a placeholder in BuiltinTaskActionsExtension to reserve a number for this? I don't really have any context on this, though.

@bob-wilson
Copy link
Contributor Author

@swift-ci test macOS

This is similar to MODULE_DEPENDENCIES but for non-modular header file inclusion
dependencies. Our approach to this has changed a bit over the last few months,
and the trace output from Clang does not distinguish the modular vs. non-modular
includes. We will work on fixing that, but in the meantime, this continues the
placeholder approach used for MODULE_DEPENDENCIES where it assumes anything in a
framework has a module with the same name as the framework.

This also removes moduleDependenciesContext from ClangTaskPayload because the
code that needs that now gets it from ValidateDependenciesPayload.

rdar://150309197
@bob-wilson bob-wilson force-pushed the bwilson/header-dependency-validation branch from e74a2ba to 8063c53 Compare August 7, 2025 23:55
@bob-wilson
Copy link
Contributor Author

One of the WatchBuildOperationTests was failing because of a new warning. The test uses BuildOperationTester(core, testProject, simulated: true) and the new ClangNonModularCompileTaskAction doesn't get stubbed out by that simulated parameter. @owenv suggested just changing the test to expect that warning. Trying again....

@bob-wilson
Copy link
Contributor Author

@swift-ci test

@bob-wilson bob-wilson merged commit afc6b35 into swiftlang:main Aug 8, 2025
28 checks passed
@bob-wilson bob-wilson deleted the bwilson/header-dependency-validation branch August 8, 2025 00:48
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