[clang] [Clang][DebugInfo] Use CGDebugInfo::createFile in CGDebugInfo::CreateCompileUnit (#83174) (PR #83175)

Aleksei Vetrov via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 09:19:23 PST 2024


noxwell wrote:

> Can you add a test for this?

I added a test for remapping of absolute path. It passes with this PR and fails on trunk.

However, I found much bigger problem. This fix fails test `debug-info-abspath.c`, more specifically the last case, which checks that CU file has absolute path to source file _as well as absolute path to current working directory_. @adrian-prantl should now better, but I think it is done to satisfy DWARF standard:

> A DW_AT_name attribute whose value is a null-terminated string containing the full or relative path name (relative to the value of the DW_AT_comp_dir attribute, see below) of the primary source file from which the compilation unit was derived.
> A DW_AT_comp_dir attribute whose value is a null-terminated string containing the current working directory of the compilation command

It looks like there may be a problem in the standard: you can't have DW_TAG_compile_unit that references file by relative path, but not relative to DW_AT_comp_dir. What do you think?

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


More information about the cfe-commits mailing list