Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report types needed to form aliased type
When substituting concrete types into alias template, the resulting type should be well-formed even if used in forward-declarable context. I. e., the full template argument type is needed if used e. g. in nested name specifier or in `sizeof(T)` expression. The resulting canonical type may still be forward-declarable. To ensure this, the aliased type is scanned by `InstantiatedTemplateVisitor`. When the alias is used in fwd-declarable context, `IwyuBaseAstVisitor::VisitTemplateSpecializationType` calls `set_in_forward_declare_context(true)` on the current node prior to that scan, hence the resulting type should not be reported, only its internals should be (because of the calls of `set_in_forward_declare_context(false)` during the traversal). When the aliased type is fully used, there may be some redundancy in reporting. If someone considers that such a scheme is fragile, or doesn't work by some reason, a `set_in_forward_declare_context(true)` call may be placed into the `if (type->isTypeAlias())` statement body inside `TraverseTemplateSpecializationTypeHelper`.
- Loading branch information