[SourceKit] Check if the realpath of a module is inside the SDK to decide if it's system #77120
+31
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Windows, we run into the following situation when running SourceKit-LSP tests:
S:\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
withS:
being a substitution driveSwift.swiftmodule
atS:\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule
Swift.swiftmodule
is a system module, we take the realpath of the SDK, which resolves the substitution drive an results in something likeC:\Users\alex\src\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk
Swift.swiftmodule
, we will assume that it’s not in the SDK, because the SDK’s path is onC:
whileSwift.swiftmodule
lives onS:
To fix this, we also need to check if a module’s real path is inside the SDK.
Fixes swiftlang/sourcekit-lsp#1770
rdar://138210224