[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 12:02:00 PDT 2023


rmaz wrote:

> This is now always storing an absolute path into Header::PathRelativeToRootModuleDirectory for built-in headers

Wouldn't this always have been the case? I'll check shortly with a resource dir picked up via toolchain bundle layout.

> My bigger concern is that we now generate absolute paths into the <module-includes> buffer which gets serialized into the PCM file. I believe that some folks using Clang modules rely on them being "relocatable", i.e. having no absolute paths serialized. I believe this patch would break that use-case.

This is the use case I am trying to support, via -fmodule-file-home-is-cwd and with the resource dir as a subfolder of the cwd. This works currently, but we require adding a -I. to module compilation or modules with builtin headers will not compile successfully. If the resource dir is outside of the cwd then you would have to have an absolute path here anyway, wouldn't you?

I guess the alternative would be to set PathRelativeToRootModuleDirectory relative to the resource dir module directory instead, and rely on the resource dir being added to the header search paths to make lookup succeed. This seems confusing too though, as you would expect the PathRelativeToRootModuleDirectory to be the module being compiled, not a different module.

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


More information about the cfe-commits mailing list