Skip to content

[Dependency Scanner] Ensure the Clang dependency scanner working directory matches the invocation when querying bridging header dependencies #65436

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
merged 1 commit into from
Apr 26, 2023

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Apr 26, 2023

The Swift compiler does not have a concept of a working directory. It is instead handled by the Swift driver by resolving relative paths according to the driver's working directory argument. On the other hand, Clang does have a concept working directory which may be specified on this Clang invocation with '-working-directory'. If so, it is crucial that we use this directory as an argument to the Clang scanner API. Otherwiswe, we risk having a mismatch between the working directory specified on the scanner's Clang invocation and the one use from the scanner API entry-points, which leads to downstream inconsistencies and errors.

This was originally fixed for the main by-name module dependencies query in #61025 (03136e0), but the Bridging Header dependencies code has continued to incorrectly expect the Swift ASTContext to both have the working directory set and be consistent with that of the Clang scanner instance.

Resolves rdar://108464467

…ctory matches the invocation when querying bridging header dependencies

The Swift compiler does not have a concept of a working directory. It is instead handled by the Swift driver by resolving relative paths according to the driver's working directory argument. On the other hand, Clang does have a concept working directory which may be specified on this Clang invocation with '-working-directory'. If so, it is crucial that we use this directory as an argument to the Clang scanner API. Otherwiswe, we risk having a mismatch between the working directory specified on the scanner's Clang invocation and the one use from the scanner API entry-points, which leads to downstream inconsistencies and errors.

This was originally fixed for the main by-name module dependencies query in swiftlang#61025 (03136e0), but the Bridging Header dependencies code has continued to incorrectly expect the Swift ASTContext to both have the working directory set *and* be consistent with that of the Clang scanner instance.

Resolves rdar://108464467
@artemcm
Copy link
Contributor Author

artemcm commented Apr 26, 2023

@swift-ci test

@artemcm artemcm merged commit 1808850 into swiftlang:main Apr 26, 2023
@artemcm artemcm deleted the DepScanPCHWorkingDir branch April 26, 2023 23: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.

3 participants