[Refactoring] Consolidate forward reference handling between aggregates

- Find valid `scope` first
- Set parent before `type` semantic and its mangling calculation
- `parent` and `type` are necessary even for opaque declaration
[Refactoring] Consolidate handling of protection, storage_class, and userAttributes

They should be applied even for opaque declaration
[Refactorign] Consolidate `symtab`
[Refactoring] Fix ungagSpeculative() position
Separate class hierarchy calculation from class member semantics
fix Issue 12078 - forward reference issue with is() and curiously recurring template pattern
fix Issue 12143 - Base class is forward referenced
fix Issue 12555 - Incorrect error ungagging for speculatively instantiated class

`ungagSpeculative()` should do nothing for function local symbols.
fix Issue 11622 - Assertion failure in totym(), glue.c, line 1288