d/dmd: Merge upstream dmd 62ce36f37

Adjusts the hardcoded index of Error.bypassException.

Fixes: PR d/94623

Reviewed-on: https://github.com/dlang/dmd/pull/11052
This commit is contained in:
Iain Buclaw 2020-04-21 08:50:12 +02:00
parent 8e841bd419
commit 46cf683bf1
2 changed files with 14 additions and 7 deletions

View file

@ -1,4 +1,4 @@
ba99ee345694da61eca7b555517d540ff3dc0a56 62ce36f3737de691217c21f0173f411734eb1d43
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository. merge done from the dlang/dmd repository.

View file

@ -1652,21 +1652,28 @@ public:
{ {
// Little sanity check to make sure it's really a Throwable // Little sanity check to make sure it's really a Throwable
ClassReferenceExp *boss = oldest->thrown; ClassReferenceExp *boss = oldest->thrown;
assert((*boss->value->elements)[4]->type->ty == Tclass); // Throwable.next const int next = 4; // index of Throwable.next
assert((*boss->value->elements)[next]->type->ty == Tclass); // Throwable.next
ClassReferenceExp *collateral = newest->thrown; ClassReferenceExp *collateral = newest->thrown;
if ( isAnErrorException(collateral->originalClass()) && if ( isAnErrorException(collateral->originalClass()) &&
!isAnErrorException(boss->originalClass())) !isAnErrorException(boss->originalClass()))
{ {
/* Find the index of the Error.bypassException field
*/
int bypass = next + 1;
if ((*collateral->value->elements)[bypass]->type->ty == Tuns32)
bypass += 1; // skip over _refcount field
assert((*collateral->value->elements)[bypass]->type->ty == Tclass);
// The new exception bypass the existing chain // The new exception bypass the existing chain
assert((*collateral->value->elements)[5]->type->ty == Tclass); (*collateral->value->elements)[bypass] = boss;
(*collateral->value->elements)[5] = boss;
return newest; return newest;
} }
while ((*boss->value->elements)[4]->op == TOKclassreference) while ((*boss->value->elements)[next]->op == TOKclassreference)
{ {
boss = (ClassReferenceExp *)(*boss->value->elements)[4]; boss = (ClassReferenceExp *)(*boss->value->elements)[next];
} }
(*boss->value->elements)[4] = collateral; (*boss->value->elements)[next] = collateral;
return oldest; return oldest;
} }