[all-commits] [llvm/llvm-project] 62e4c2: [clang] Fix ASTUnit working directory handling

Hamish Knight via All-commits all-commits at lists.llvm.org
Fri Jun 30 09:57:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 62e4c22c95a9c5fbbebded43388006d5fed3b613
      https://github.com/llvm/llvm-project/commit/62e4c22c95a9c5fbbebded43388006d5fed3b613
  Author: Hamish Knight <hamish_knight at apple.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M clang/lib/Frontend/ASTUnit.cpp
    M clang/unittests/Frontend/ASTUnitTest.cpp
    M clang/unittests/Frontend/CMakeLists.txt
    A clang/unittests/Frontend/ReparseWorkingDirTest.cpp

  Log Message:
  -----------
  [clang] Fix ASTUnit working directory handling

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

Reviewed By: bnbarham, benlangmuir

Differential Revision: https://reviews.llvm.org/D154134




More information about the All-commits mailing list