[clang] CTAD: Fix require-clause is not transformed. (#89378)

Fixes https://github.com/llvm/llvm-project/issues/89013

When building the deduction guide, we use the
TemplateArgsForBuildingFPrime to transform the require-clause from the
underlying class deduction guide. However, we do this at the wrong place
where not all elements of TemplateArgsForBuildingFPrime are initialized.
The fix involves rearranging the transformRequireClause call to the
correct location.

As part of the fix, we extend the TemplateInstantiator to support more
types in the template-rewrite mode. Otherwise, we will encounter an
assertion error when attempting to rewrite the template type parameter
type like D with a complex type like Derived<U>.

GitOrigin-RevId: c8e65e193d542464421ad4f9a9965d45b302ac0c
4 files changed