llvm-project
7568a99c - [dsymutil] Fix parallel linker's self-recursive typedef DIE by including referred-to types into synthetic name (#166767)

Commit
168 days ago
[dsymutil] Fix parallel linker's self-recursive typedef DIE by including referred-to types into synthetic name (#166767) **TL;DR:** See #166675 for description of the problem, the root cause, and one solution. This patch is the "different implementation" descried there. This patch tries to fix the problem by recursively including the referred-to types into the synthetic name. This way, the synthetic name of the typedef DIE is canonicalized. See example debug prints below: ``` SyntheticTypeNameBuilder::addDIETypeName() is called for DIE at offset 0x0000004c SyntheticName = {H}BarInt{F}Foo<int>:() <- Two different names Assigned to type descriptor. TypeEntryPtr = 0x0000004c0x0x150020a38 <- Hence different type entries SyntheticTypeNameBuilder::addDIETypeName() is called for DIE at offset 0x00000044 SyntheticName = {H}BarInt{H}BarInt{F}Foo<int>:() <- Two different names Assigned to type descriptor. TypeEntryPtr = 0x000000440x0x150020a60 <- Hence different type entries ``` The advantages of this approach over https://github.com/llvm/llvm-project/pull/166675 are: 1. The resulting synthetic name is more "correct" than using decl file and line (which _can_ still collide). 1. This doesn't depend on https://github.com/llvm/llvm-project/issues/166673 to be fixed. A **hypothetical** caveat is that it would work if any of the referenced types resolve to the same name for some reason (similar to how the two typedefs resolved to the same name before this patch). # Tests ``` cd ~/public_llvm/build bin/llvm-lit -a \ ../llvm-project/llvm/test/tools/dsymutil/typedefs-with-same-name.test \ ../llvm-project/llvm/test/tools/dsymutil/X86/DWARFLinkerParallel/odr-fwd-declaration.test ```
Author
Parents
Loading