From dd03444ba5ad4ac3f5476084c2028851b5c94cca Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 1 May 2017 11:01:02 +0000 Subject: [PATCH] d-demangle.c (dlang_value): Add comment explaining why cases for digits are required. libiberty/ChangeLog: * d-demangle.c (dlang_value): Add comment explaining why cases for digits are required. * testsuite/d-demangle-expected: Update integer value tests. From-SVN: r247436 --- libiberty/ChangeLog | 6 +++++ libiberty/d-demangle.c | 4 +++ libiberty/testsuite/d-demangle-expected | 34 ++++++++++++------------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index c5c566d83bc..7ae475488c4 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2017-05-01 Iain Buclaw + + * d-demangle.c (dlang_value): Add comment explaining why cases for + digits are required. + * testsuite/d-demangle-expected: Update integer value tests. + 2017-05-01 Iain Buclaw * d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols. diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c index 533653fde2f..4d9b1102b70 100644 --- a/libiberty/d-demangle.c +++ b/libiberty/d-demangle.c @@ -1243,6 +1243,10 @@ dlang_value (string *decl, const char *mangled, const char *name, char type) if (*mangled < '0' || *mangled > '9') return NULL; /* Fall through */ + + /* There really should always be an `i' before encoded numbers, but there + wasn't in early versions of D2, so this case range must remain for + backwards compatibility. */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': mangled = dlang_parse_integer (decl, mangled, type); diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected index 530e0e62bff..c64fcc60c27 100644 --- a/libiberty/testsuite/d-demangle-expected +++ b/libiberty/testsuite/d-demangle-expected @@ -698,35 +698,35 @@ _D8demangle13__T4testVPinZv demangle.test!(null) # --format=dlang -_D8demangle14__T4testVg123Zv +_D8demangle15__T4testVgi123Zv demangle.test!(123) # --format=dlang -_D8demangle14__T4testVi123Zv +_D8demangle15__T4testVii123Zv demangle.test!(123) # --format=dlang -_D8demangle14__T4testVs123Zv +_D8demangle15__T4testVsi123Zv demangle.test!(123) # --format=dlang -_D8demangle14__T4testVh123Zv +_D8demangle15__T4testVhi123Zv demangle.test!(123u) # --format=dlang -_D8demangle14__T4testVk123Zv +_D8demangle15__T4testVki123Zv demangle.test!(123u) # --format=dlang -_D8demangle14__T4testVt123Zv +_D8demangle15__T4testVti123Zv demangle.test!(123u) # --format=dlang -_D8demangle14__T4testVl123Zv +_D8demangle15__T4testVli123Zv demangle.test!(123L) # --format=dlang -_D8demangle14__T4testVm123Zv +_D8demangle15__T4testVmi123Zv demangle.test!(123uL) # --format=dlang @@ -746,35 +746,35 @@ _D8demangle15__T4testVmN123Zv demangle.test!(-123uL) # --format=dlang -_D8demangle12__T4testVb1Zv +_D8demangle13__T4testVbi1Zv demangle.test!(true) # --format=dlang -_D8demangle12__T4testVb0Zv +_D8demangle13__T4testVbi0Zv demangle.test!(false) # --format=dlang -_D8demangle13__T4testVa10Zv +_D8demangle14__T4testVai10Zv demangle.test!('\x0a') # --format=dlang -_D8demangle13__T4testVa32Zv +_D8demangle14__T4testVai32Zv demangle.test!(' ') # --format=dlang -_D8demangle13__T4testVa65Zv +_D8demangle14__T4testVai65Zv demangle.test!('A') # --format=dlang -_D8demangle14__T4testVa126Zv +_D8demangle15__T4testVai126Zv demangle.test!('~') # --format=dlang -_D8demangle15__T4testVu1000Zv +_D8demangle16__T4testVui1000Zv demangle.test!('\u03e8') # --format=dlang -_D8demangle17__T4testVw100000Zv +_D8demangle18__T4testVwi100000Zv demangle.test!('\U000186a0') # --format=dlang @@ -1076,7 +1076,7 @@ _D8demangle20__T2fnVAiA4i1i2i3i4Z2fnFZv demangle.fn!([1, 2, 3, 4]).fn() # --format=dlang -_D8demangle10__T2fnVi1Z2fnFZv +_D8demangle11__T2fnVii1Z2fnFZv demangle.fn!(1).fn() # --format=dlang -- 2.30.2