This is mostly factored out of D48958.
As of D49838, ImplicitCastExpr can tell whether it is a part of ExplicitCastExpr group.
But given just the CastExpr, one still has to check that it is not ExplicitCastExpr itself,
before using ImplicitCastExpr::getIsPartOfExplicitCast().
Thus, it makes sense to factor out it into a helper function in CastExpr baseclass.
This indeed does not have tests. Would be happy to add those, if needed and told how to write those.