mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 05:44:15 +08:00
libiberty: Update D symbol demangling for latest ABI spec.
Some small improvements and clarifications have been done in the D ABI specification to remove all ambiguities found in the current grammar, this implementation now more closely resembles the spec, whilst maintaining compatibility with the old ABI. Three new rules have been added to the ABI. 1. Back references using 'Q', analogous to C++ substitutions, compresses repeated identifiers, types, and template symbol and value parameters. 2. Template aliases to externally mangled symbols are prefixed with 'X'. This includes any symbol that isn't extern(D), or has its name overriden with pragma(mangle). This fixes an ambiguity where it was not clear whether 'V' was an encoded calling convention, or the next template value parameter. 3. Alias parameters, templates, and tuple symbols no longer encode the symbol length of its subpart. Tuples are now terminated with 'Z'. This fixes another ambiguity where the first character of the mangled name can be a digit as well, so the demangler had to figure out where to split the two adjacent numbers by trying out each combination. libiberty/ChangeLog: * d-demangle.c (enum dlang_symbol_kinds): Remove enum. (struct dlang_info): New struct (dlang_decode_backref): New function. (dlang_backref): New function. (dlang_symbol_backref): New function. (dlang_type_backref): New function. (dlang_symbol_name_p): New function. (dlang_function_type_noreturn): New function. (dlang_function_type): Add 'info' parameter. Decode function type with dlang_function_type_noreturn. (dlang_function_args): Add 'info' parameter. (dlang_type): Add 'info' parameter. Handle back referenced types. (dlang_identifier): Replace 'kind' parameter with 'info'. Handle back referenced symbols. Split off decoding of plain identifiers to... (dlang_lname): ...here. (dlang_parse_mangle): Replace 'kind' parameter with 'info'. Decode function type and return with dlang_type. (dlang_parse_qualified): Replace 'kind' parameter with 'info', add 'suffix_modifier' parameter. Decode function type with dlang_function_type_noreturn. (dlang_parse_tuple): Add 'info' parameter. (dlang_template_symbol_param): New function. (dlang_template_args): Add 'info' parameter. Decode symbol parameter with dlang_template_symbol_param. Handle back referenced values, and externally mangled parameters. (dlang_parse_template): Add 'info' parameter. (dlang_demangle_init_info): New function. (dlang_demangle): Initialize and pass 'info' parameter. * testsuite/d-demangle-expected: Add new tests. Co-Authored-By: Rainer Schuetze <r.sagitario@gmx.de>
This commit is contained in:
parent
4e1592f8e1
commit
3f30a27491
@ -1,3 +1,36 @@
|
||||
2020-05-14 Rainer Schuetze <r.sagitario@gmx.de>
|
||||
Iain Buclaw <ibuclaw@gdcproject.org>
|
||||
|
||||
* d-demangle.c (enum dlang_symbol_kinds): Remove enum.
|
||||
(struct dlang_info): New struct
|
||||
(dlang_decode_backref): New function.
|
||||
(dlang_backref): New function.
|
||||
(dlang_symbol_backref): New function.
|
||||
(dlang_type_backref): New function.
|
||||
(dlang_symbol_name_p): New function.
|
||||
(dlang_function_type_noreturn): New function.
|
||||
(dlang_function_type): Add 'info' parameter. Decode function type
|
||||
with dlang_function_type_noreturn.
|
||||
(dlang_function_args): Add 'info' parameter.
|
||||
(dlang_type): Add 'info' parameter. Handle back referenced types.
|
||||
(dlang_identifier): Replace 'kind' parameter with 'info'. Handle back
|
||||
referenced symbols. Split off decoding of plain identifiers to...
|
||||
(dlang_lname): ...here.
|
||||
(dlang_parse_mangle): Replace 'kind' parameter with 'info'. Decode
|
||||
function type and return with dlang_type.
|
||||
(dlang_parse_qualified): Replace 'kind' parameter with 'info', add
|
||||
'suffix_modifier' parameter. Decode function type with
|
||||
dlang_function_type_noreturn.
|
||||
(dlang_parse_tuple): Add 'info' parameter.
|
||||
(dlang_template_symbol_param): New function.
|
||||
(dlang_template_args): Add 'info' parameter. Decode symbol parameter
|
||||
with dlang_template_symbol_param. Handle back referenced values, and
|
||||
externally mangled parameters.
|
||||
(dlang_parse_template): Add 'info' parameter.
|
||||
(dlang_demangle_init_info): New function.
|
||||
(dlang_demangle): Initialize and pass 'info' parameter.
|
||||
* testsuite/d-demangle-expected: Add new tests.
|
||||
|
||||
2020-05-12 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR bootstrap/94998
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1326,3 +1326,75 @@ _D1_B699999999961*
|
||||
--format=dlang
|
||||
_D5__T1fVHacA6666666666_
|
||||
_D5__T1fVHacA6666666666_
|
||||
#
|
||||
--format=dlang
|
||||
_D3std5range15__T4iotaTtTtTtZ4iotaFtttZ6Result7opIndexMNgFNaNbNiNfmZNgt
|
||||
std.range.iota!(ushort, ushort, ushort).iota(ushort, ushort, ushort).Result.opIndex(ulong) inout
|
||||
#
|
||||
--format=dlang
|
||||
_D3std6format77__T6getNthVAyaa13_696e7465676572207769647468S233std6traits10isIntegralTiTkTkZ6getNthFNaNfkkkZi
|
||||
std.format.getNth!("integer width", std.traits.isIntegral, int, uint, uint).getNth(uint, uint, uint)
|
||||
#
|
||||
--format=dlang
|
||||
_D3std11parallelism42__T16RoundRobinBufferTDFKAaZvTDxFNaNdNeZbZ16RoundRobinBuffer5primeMFZv
|
||||
std.parallelism.RoundRobinBuffer!(void(ref char[]) delegate, bool() pure @property @trusted delegate const).RoundRobinBuffer.prime()
|
||||
#
|
||||
--format=dlang
|
||||
_D4core4stdc5errnoQgFZi
|
||||
core.stdc.errno.errno()
|
||||
#
|
||||
--format=dlang
|
||||
_D4testFS10structnameQnZb
|
||||
test(structname, structname)
|
||||
#
|
||||
--format=dlang
|
||||
_D3std11parallelism__T4TaskS8unittest3cmpTAyaTQeZQBb6__dtorMFNfZv
|
||||
std.parallelism.Task!(unittest.cmp, immutable(char)[], immutable(char)[]).Task.~this()
|
||||
#
|
||||
--format=dlang
|
||||
_D13testexpansion44__T1sTS13testexpansion8__T1sTiZ1sFiZ6ResultZ1sFS13testexpansion8__T1sTiZ1sFiZ6ResultZ6Result3fooMFNaNfZv
|
||||
testexpansion.s!(testexpansion.s!(int).s(int).Result).s(testexpansion.s!(int).s(int).Result).Result.foo()
|
||||
#
|
||||
--format=dlang
|
||||
_D13testexpansion__T1sTSQw__TQjTiZQoFiZ6ResultZQBbFQBcZQq3fooMFNaNfZv
|
||||
testexpansion.s!(testexpansion.s!(int).s(int).Result).s(testexpansion.s!(int).s(int).Result).Result.foo()
|
||||
#
|
||||
--format=dlang
|
||||
_D3std4conv__T7enumRepTyAaTEQBa12experimental9allocator15building_blocks15stats_collector7OptionsVQCti64ZQDnyQDh
|
||||
std.conv.enumRep!(immutable(char[]), std.experimental.allocator.building_blocks.stats_collector.Options, 64).enumRep
|
||||
#
|
||||
--format=dlang
|
||||
_D3std12experimental9allocator6common__T10reallocateTSQCaQBzQBo15building_blocks17kernighan_ritchie__T8KRRegionTSQEhQEgQDvQCh14null_allocator13NullAllocatorZQCdZQErFNaNbNiKQEpKAvmZb
|
||||
std.experimental.allocator.common.reallocate!(std.experimental.allocator.building_blocks.kernighan_ritchie.KRRegion!(std.experimental.allocator.building_blocks.null_allocator.NullAllocator).KRRegion).reallocate(ref std.experimental.allocator.building_blocks.kernighan_ritchie.KRRegion!(std.experimental.allocator.building_blocks.null_allocator.NullAllocator).KRRegion, ref void[], ulong)
|
||||
#
|
||||
--format=dlang
|
||||
_D3std9exception__T11doesPointToTASQBh5regex8internal2ir10NamedGroupTQBkTvZQCeFNaNbNiNeKxASQDlQCeQCbQBvQBvKxQtZb
|
||||
std.exception.doesPointTo!(std.regex.internal.ir.NamedGroup[], std.regex.internal.ir.NamedGroup[], void).doesPointTo(ref const(std.regex.internal.ir.NamedGroup[]), ref const(std.regex.internal.ir.NamedGroup[]))
|
||||
#
|
||||
--format=dlang
|
||||
_D3std9algorithm9iteration__T14SplitterResultS_DQBu3uni7isWhiteFNaNbNiNfwZbTAyaZQBz9__xtoHashFNbNeKxSQDvQDuQDn__TQDgS_DQEnQCtQCsQCnTQCeZQEdZm
|
||||
std.algorithm.iteration.SplitterResult!(std.uni.isWhite(dchar), immutable(char)[]).SplitterResult.__xtoHash(ref const(std.algorithm.iteration.SplitterResult!(std.uni.isWhite, immutable(char)[]).SplitterResult))
|
||||
#
|
||||
--format=dlang
|
||||
_D3std8typecons__T7TypedefTCQBaQz19__unittestL6513_208FNfZ7MyClassVQBonVAyanZQCh6__ctorMFNaNbNcNiNfQCuZSQDyQDx__TQDrTQDmVQDqnVQCcnZQEj
|
||||
std.typecons.Typedef!(std.typecons.__unittestL6513_208().MyClass, null, null).Typedef.this(std.typecons.__unittestL6513_208().MyClass)
|
||||
#
|
||||
--format=dlang
|
||||
_D3std6getopt__TQkTAyaTDFNaNbNiNfQoZvTQtTDQsZQBnFNfKAQBiQBlQBkQBrQyZSQCpQCo12GetoptResult
|
||||
std.getopt.getopt!(immutable(char)[], void(immutable(char)[]) pure nothrow @nogc @safe delegate, immutable(char)[], void(immutable(char)[]) pure nothrow @nogc @safe delegate).getopt(ref immutable(char)[][], immutable(char)[], void(immutable(char)[]) pure nothrow @nogc @safe delegate, immutable(char)[], void(immutable(char)[]) pure nothrow @nogc @safe delegate)
|
||||
#
|
||||
--format=dlang
|
||||
_D3std5regex8internal9kickstart__T7ShiftOrTaZQl11ShiftThread__T3setS_DQCqQCpQCmQCg__TQBzTaZQCfQBv10setInvMaskMFNaNbNiNfkkZvZQCjMFNaNfwZv
|
||||
std.regex.internal.kickstart.ShiftOr!(char).ShiftOr.ShiftThread.set!(std.regex.internal.kickstart.ShiftOr!(char).ShiftOr.ShiftThread.setInvMask(uint, uint)).set(dchar)
|
||||
#
|
||||
--format=dlang
|
||||
_D3std5stdio4File__T8lockImplX10LockFileExTykZQBaMFmmykZi
|
||||
std.stdio.File.lockImpl!(LockFileEx, immutable(uint)).lockImpl(ulong, ulong, immutable(uint))
|
||||
#
|
||||
--format=dlang
|
||||
_D3std9algorithm9iteration__T12FilterResultSQBq8typecons__T5TupleTiVAyaa1_61TiVQla1_62TiVQva1_63ZQBm__T6renameVHiQBtA2i0a1_63i2a1_61ZQBeMFNcZ9__lambda1TAiZQEw9__xtoHashFNbNeKxSQGsQGrQGk__TQGdSQHiQFs__TQFmTiVQFja1_61TiVQFua1_62TiVQGfa1_63ZQGx__TQFlVQFhA2i0a1_63i2a1_61ZQGjMFNcZQFfTQEyZQJvZm
|
||||
std.algorithm.iteration.FilterResult!(std.typecons.Tuple!(int, "a", int, "b", int, "c").Tuple.rename!([0:"c", 2:"a"]).rename().__lambda1, int[]).FilterResult.__xtoHash(ref const(std.algorithm.iteration.FilterResult!(std.typecons.Tuple!(int, "a", int, "b", int, "c").Tuple.rename!([0:"c", 2:"a"]).rename().__lambda1, int[]).FilterResult))
|
||||
#
|
||||
--format=dlang
|
||||
_D3std3uni__T6toCaseS_DQvQt12toLowerIndexFNaNbNiNewZtVii1043S_DQCjQCi10toLowerTabFNaNbNiNemZwSQDo5ascii7toLowerTAyaZQDzFNaNeQmZ14__foreachbody2MFNaNeKmKwZ14__foreachbody3MFNaNeKwZi
|
||||
std.uni.toCase!(std.uni.toLowerIndex(dchar), 1043, std.uni.toLowerTab(ulong), std.ascii.toLower, immutable(char)[]).toCase(immutable(char)[]).__foreachbody2(ref ulong, ref dchar).__foreachbody3(ref dchar)
|
||||
|
Loading…
Reference in New Issue
Block a user