Commit Graph

17 Commits

Author SHA1 Message Date
David Blaikie 1cee3d9db7 DebugInfo: Consider the type of NTTP when simplifying template names
Since the NTTP may need to be cast to the type when rebuilding the name,
check that the type can be rebuilt when determining whether a template
name can be simplified.
2022-04-08 00:00:46 +00:00
David Blaikie a5032b2633 DebugInfo: Don't allow type units to references types in the CU
We could only do this in limited ways (since we emit the TUs first, we
can't use ref_addr (& we can't use that in Split DWARF either) - so we
had to synthesize declarations into the TUs) and they were ambiguous in
some cases (if the CU type had internal linkage, parsing the TU would
require knowing which CU was referencing the TU to know which type the
declaration was for, which seems not-ideal). So to avoid all that, let's
just not reference types defined in the CU from TUs - instead moving the
TU type into the CU (recursively).

This does increase debug info size (by pulling more things out of type
units, into the compile unit) - about 2% of uncompressed dwp file size
for clang -O0 -g -gsplit-dwarf. (5% .debug_info.dwo section size
increase in the .dwp)
2022-03-25 23:49:03 +00:00
David Blaikie 7b498beef0 DebugInfo: Classify noreturn function types as non-reconstructible
This information isn't preserved in the DWARF description of function
types (though probably should be - it's preserved on the function
declarations/definitions themselves through the DW_AT_noreturn attribute
- but we should move or also include that in the subroutine type itself
too - but for now, with it not being there, the DWARF is lossy and
can't be reconstructed)
2022-03-24 18:53:14 +00:00
David Blaikie 4841dab4af llvm-dwarfdump: Including calling convention attribute in pretty printed type names 2022-03-22 19:19:54 +00:00
David Blaikie d7c4f7f147 DebugInfo: fix a couple of spurious spaces in simplified template name rebuilding 2022-02-16 11:33:41 -08:00
David Blaikie 9980a3f831 DebugInfo: Disable simplified template names for -gmlt and below
Since -gmlt doesn't carry any type information necessary to rebuild
template names.
2022-02-15 11:58:40 -08:00
David Blaikie 1ea326634b DebugInfo: Don't simplify template names using _BitInt(N)
_BitInt(N) only encodes the byte size in DWARF, not the bit size, so
can't be reconstituted.
2022-02-15 11:58:40 -08:00
David Blaikie 389f67b35b DebugInfo: Don't simplify names referencing local enums
Due to the way type units work, this would lead to a declaration in a
type unit of a local type in a CU - which is ambiguous. Rather than
trying to resolve that relative to the CU that references the type unit,
let's just not try to simplify these names.

Longer term this should be fixed by not putting the template
instantiation in a type unit to begin with - since it references an
internal linkage type, it can't legitimately be duplicated/in more than
one translation unit, so skip the type unit overhead. (but the right fix
for that is to move type unit management into a DICompositeType flag
(dropping the "identifier" field is not a perfect solution since it
breaks LLVM IR linking decl/def merging during IR linking))
2022-02-10 15:51:47 -08:00
David Blaikie f3a2cfc103 DebugInfo: Don't simplify any template referencing a lambda
Lambda names aren't entirely canonical (as demonstrated by the
cross-project-test added here) at the moment (we should fix that for a
bunch of reasons) - even if the template referencing them is
non-simplified, other names referencing /that/ template can't be
simplified either because type units might cause a different template to
be picked up that would conflict with the expected name.

(other than for roundtripping precision, it'd be OK to simplify types
that reference types that reference lambdas - but best be consistent
between the roundtrip/verify mode and the actual simplified template
names mode)
2022-02-10 14:56:54 -08:00
David Blaikie 06c154602e DebugInfo: Rebuild varargs function types correctly
Improves llvm-dwarfdump output and for simplified template names roundtripping.
2022-01-05 20:29:29 -08:00
David Blaikie 58b1b6414b llvm-dwarfdump: Lookup type units when prettyprinting types
This handles DWARFv4 and DWARFv5 type units, but not Split DWARF type
units. That'll come in a follow-up patch.
2021-11-09 16:58:22 -08:00
David Blaikie 0a5c26f2ef DebugInfo: Simplified Template Names: drop unneeded space in arrays
Matching a recent clang change I've made, now 'int[3]' is formatted
without the space between the type and array bound. This commit updates
libDebugInfoDWARF/llvm-dwarfdump to match that formatting.
2021-11-05 22:50:57 -07:00
David Blaikie f57d0e2726 DWARF Simplified Template Names: Narrow down the handling for operator overloads
Actually we can, for now, remove the explicit "operator" handling
entirely - since clang currently won't try to flag any of these as
rebuildable. That seems like a reasonable state for now, but it could be
narrowed down to only apply to conversion operators, most likely - but
would need more nuance for op> and op>> since they would be incorrectly
flagged as already having their template arguments (due to the trailing
'>').
2021-11-05 15:41:56 -07:00
David Blaikie 8f46ddb184 Migrate the roundtrip tests to work similar to the llgdb tests
I'm not sure if there's a way to make this a bit more general - the
property that matters is that there's /some/ itanium ABI target the
tests can use to compile - not link or run in this case. But this seems
sufficient for the llgdb tests, so it should be sufficient (though
perhaps not necessary) for this roundtrip test.
2021-10-28 18:38:05 -07:00
David Blaikie fcd6d56602 Adjust test to only compile and not link
Compilation is all that's needed here - linking helped avoid certain
false positives in llvm-dwarfdump --verify related to overlapping
functions when those functions were actually in distinct sections.
That's since been fixed, so we can adjust the test to only compile, and
not link.
2021-10-28 18:10:30 -07:00
Douglas Yung fff2c0f0bf Add "REQUIRES: native" to test.
This test was failing on the PS4 bot because the test attempts to link, but the PS4 platform requires an external
linker that is not present, causing the test to fail. This should get the PS4 bot green again.
2021-10-27 11:06:13 -07:00
David Blaikie ca4ecf811f Add cross-project-test for simplified template name rebuilding 2021-10-26 16:21:03 -07:00