[clang] Make PCH's respect any VFS specified. (PR #106577)

Neil Henning via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 25 00:18:28 PDT 2024


sheredom wrote:

> Sorry for being slow to look at this in more detail:

No bother!


> > When generating a PCH map the original directory to some fake directory. You could imagine D:/Foo being mapped to Z:/Foo for instance.
> 
> Can you clarify what this means? Is `Z:/Foo` a virtual-only path or does it actually exist on disk? In your test case both directories exist, which I assume wouldn't normally be the case (or else why not build in the desired location directly?).

`Z:/Foo` is virtual - a fake path. We want to remap all paths on build machines to various fake root paths + generate the PCHs, then on other build machines / dev machines remap the fake root paths back to wherever that user has those paths installed (they might install things in different drives, folders, etc).

> If the goal is to put virtual paths in the PCH so that you can map them somewhere else in the consuming compiler's VFS, does the`RedirectingFileSystem` setting `'use-external-names': false` do what you need? The idea behind that setting is that we would use the virtual paths everywhere in the compiler instead of translating them to the external/on-disk path. I don't have a lot of experience with enabling that in modules/pch so maybe there's something that it doesn't handle.

I'll have a look at that and get back to you!

https://github.com/llvm/llvm-project/pull/106577


More information about the cfe-commits mailing list