Skip to content

Conversation

@hamishknight
Copy link

5.9 cherry-pick of #7028

  • Explanation: Fixes an issue where code completion would break for any code relying on a relative header search path
  • Scope: Affects code completion in projects with relative header search paths
  • Radar: rdar://110697657
  • Risk: Low, only affects ASTUnit logic, which is primarily used by libclang. The fix itself is straightforward, and the previous behavior was completely wrong.
  • Testing: Added tests to test suite
  • Reviewer: Ben Barham, Ben Langmuir

Use `createPhysicalFileSystem` instead of `getRealFileSystem` to
avoid affecting the process' current working directory, and set it
at the top of `ASTUnit::LoadFromCommandLine` such that the driver
used for argument parsing and the ASTUnit share the same VFS. This
ensures that '-working-directory' correctly sets the VFS working
directory in addition to the FileManager working directory.
Ensure we preserve the FileSystemOptions set on the FileManager when
re-creating it (as `ASTUnit::Reparse` will clear the currently set
FileManager).

rdar://110697657
@hamishknight
Copy link
Author

@swift-ci please test

@hamishknight hamishknight changed the title [5.9] [ASTUnit] Fix working directory handling [5.9] [clang] Fix ASTUnit working directory handling Jun 27, 2023
@airspeedswift airspeedswift merged commit 08e19ff into swiftlang:swift/release/5.9 Jun 27, 2023
@hamishknight hamishknight deleted the time-and-place-5.9 branch June 27, 2023 12:06
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