[clang] [clang] use absolute path for builtin headers during module compilation (PR #68023)

Richard Howell via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 5 13:46:57 PDT 2023


rmaz wrote:

> I thought you're trying to fix the situation where your resource dir is in the CWD, so that's the context I'm assuming. Is that correct?

Yes.

> I was considering your test case, where we'd previously store "resource-dir/include/float.h" into Header::PathRelativeToRootModuleDirectory

Oh I see, being a bit slow there.

> But -fmodule-file-home-is-cwd will not go as far as fixing up the contents of SourceManager buffers. So while all the paths you serialize into the PCM will get "relativized", the <module-includes> buffer would still contain the absolute path

Ah, didn't consider that, yes that is an issue you are right.

> I was going to suggest keeping Header::PathRelativeToRootModuleDirectory as "float.h", and generating this into the <module-includes> buffer

Wouldn't this work without the pragma? Isn't the resource directory always added to the header search paths, so the header should be found correctly if we set PathRelativeToRootModuleDirectory relative to the resource dir for builtin headers?


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


More information about the cfe-commits mailing list