-
Notifications
You must be signed in to change notification settings - Fork 354
[clang] Fix ASTUnit working directory handling #7028
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
[clang] Fix ASTUnit working directory handling #7028
Conversation
bnbarham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tracking this down @hamishknight!
benlangmuir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes should go upstream to llvm.org
Yup, that's the plan, we're cherry-picking downstream first as we want to get this into 5.9 fairly soon |
|
@swift-ci please test Windows platform |
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
b5a5e21 to
b32a174
Compare
|
@swift-ci please test |
|
@swift-ci please test macOS |
|
Upstream patch: https://reviews.llvm.org/D154134 |
Fix a couple of issues with the handling of the current working directory in ASTUnit:
createPhysicalFileSysteminstead ofgetRealFileSystemto avoid affecting the process' current working directory, and set it at the top ofASTUnit::LoadFromCommandLinesuch 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.ASTUnit::Reparsewill clear the currently set FileManager).rdar://110697657