Changing Scope::Entity to a DeclContext?

Hello!
While working on the patch for bug 7256, I noticed that the result of
Scope::getEntity is always used as a DeclContext*. Would it be
reasonable to change the Entity in the Scope class to a DeclContext?
This could include:

1. changing the type of Entity from void* to DeclContext*
2. renaming getEntity() to something like getDeclContext()
3. renaming the Entity member, perhaps to LocalDeclContext.

Many casts could be removed if this chage takes place, and it seems
like it would make the code clearer. I'm still a clang newbie, so I may
be missing something obvious here.

Ryan Gerleve

Hello!
While working on the patch for bug 7256, I noticed that the result of
Scope::getEntity is always used as a DeclContext*. Would it be
reasonable to change the Entity in the Scope class to a DeclContext?

Yes! The entity is a void* for historical reasons that are long gone now [*].

This could include:

1. changing the type of Entity from void* to DeclContext*
2. renaming getEntity() to something like getDeclContext()
3. renaming the Entity member, perhaps to LocalDeclContext.

Many casts could be removed if this chage takes place, and it seems
like it would make the code clearer. I'm still a clang newbie, so I may
be missing something obvious here.

This would make a great patch.

  - Doug

[*] "Long gone", in Clang time, meaning about 2 months ago.