Date: Wed, 4 Nov 2020 10:56:04 -0500
> On Nov 4, 2020, at 9:25 AM, Andrew Sutton via SG7 <sg7_at_[hidden]> wrote:
[…]
> Back in the day I thought about a "is_first_redeclaration" predicate, I don't know if somebody else considered something like this, compilers probably maintain a pointer to previous declarations in redeclared AST Nodes, so it is probably cheap acquire this info, and even if you get out-of-order function declarations in different compilations units you still can get the same function name and parameter types, even in cases when parameter names are different;
>
> That's not implementable in GCC without major surgery because it merges declarations. There is no first and last declaration, only the most recently seen. I don't believe it's the only compiler that works this way.
Right. EDG mostly doesn’t (by default) record declarations per se at all. Instead, we keep track of a “composite entity” resulting from all the declarations seen so far.
Daveed
[…]
> Back in the day I thought about a "is_first_redeclaration" predicate, I don't know if somebody else considered something like this, compilers probably maintain a pointer to previous declarations in redeclared AST Nodes, so it is probably cheap acquire this info, and even if you get out-of-order function declarations in different compilations units you still can get the same function name and parameter types, even in cases when parameter names are different;
>
> That's not implementable in GCC without major surgery because it merges declarations. There is no first and last declaration, only the most recently seen. I don't believe it's the only compiler that works this way.
Right. EDG mostly doesn’t (by default) record declarations per se at all. Instead, we keep track of a “composite entity” resulting from all the declarations seen so far.
Daveed
Received on 2020-11-04 09:56:08