We present a numerical study of the evolution of molecular clouds, from their formation by converging flows in the warm interstellar medium, to their destruction by the ionizing feedback of the massive stars they form. We improve with respect to our previous simulations by including a different stellar-particle formation algorithm, which allows them to have masses corresponding to single stars rather than to small clusters, and with a mass distribution following a near-Salpeter stellar initial mass function. We also employ a simplified radiative-transfer algorithm that allows the stellar particles to feedback on the medium at a rate that depends on their mass and the local density. Our results are as follows: (a) contrary to the results from our previous study, where all stellar particles injected energy at a rate corresponding to a star of ∼10 M⊙, the dense gas is now completely evacuated from 10 pc regions around the stars within 10–20 Myr, suggesting that this feat is accomplished essentially by the most massive stars. (b) At the scale of the whole numerical simulations, the dense gas mass is reduced by up to an order of magnitude, although star formation (SF) never shuts off completely, indicating that the feedback terminates SF locally, but new SF events continue to occur elsewhere in the clouds. (c) The SF efficiency (SFE) is maintained globally at the ∼10 per cent level, although locally, the cloud with largest degree of focusing of its accretion flow reaches SFE ∼30 per cent. (d) The virial parameter of the clouds approaches unity before the stellar feedback begins to dominate the dynamics, becoming much larger once feedback dominates, suggesting that clouds become unbound as a consequence of the stellar feedback, rather than unboundness being the cause of a low SFE. (e) The erosion of the filaments that feed the star-forming clumps produces chains of isolated dense blobs reminiscent of those observed in the vicinity of the dark globule B68.