  The $DD^*$ scattering phase shifts in the $T_{cc}^+=cc\bar{u}\bar{d}$ channel
are extracted from lattice QCD for five different charm quark masses and a
fixed light-quark mass corresponding to $m_\pi\simeq 280$~MeV. The phase shifts
are analysed employing two approaches: effective range expansion and
Lippmann--Schwinger equation derived in the effective field theory. In the
latter case, the results imply an attraction at short range parametrised by
contact terms and a slight repulsion at long range mediated by one-pion
exchange with $m_\pi >m_{D^*}-m_D$. The poles in the amplitude across the
complex energy plane are extracted and their trajectories are discussed as the
charm quark mass is varied. Two complex conjugate poles corresponding to a
resonance below threshold are found for $m_c$ close to the physical value. They
turn into a pair of virtual states at the largest $m_c$ studied. With further
increasing $m_c$, one virtual pole representing $T_{cc}^+$ is expected to move
towards the two-body threshold and turn into a bound state. The light-quark
mass dependence of the $T_{cc}^+$ pole is briefly discussed using the data on
$DD^*$ scattering from other lattice collaborations.
