This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix ASTUnit working directory handling
ClosedPublic

Authored by hamishknight on Jun 29 2023, 12:14 PM.

Details

Summary

Fix a couple of issues with the handling of the current working directory in ASTUnit:

  • 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

Diff Detail

Event Timeline

hamishknight created this revision.Jun 29 2023, 12:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2023, 12:14 PM
hamishknight requested review of this revision.Jun 29 2023, 12:14 PM
bnbarham accepted this revision.Jun 29 2023, 1:08 PM
This revision is now accepted and ready to land.Jun 29 2023, 1:08 PM
benlangmuir accepted this revision.Jun 29 2023, 1:16 PM

Updated ReparseWorkingDirTest to fix Windows CI

This revision was landed with ongoing or failed builds.Jun 30 2023, 9:57 AM
This revision was automatically updated to reflect the committed changes.