I would think you need to use a hybrid of surface and slot to identify the masters and follow tournament lineage. Madrid (clay) and Rome swapped slots, technically, but that was it, neither was replaced and each tournament maintained their identity. When Hamburg was swapped for Madrid (clay) and Madrid (indoor) was swapped for Shanghai, venues changed and the older venues were phased out. The new venues thus had to be considered replacements. With the Madrid (clay)/Rome swap, this is not the case.
IMO it is fair to say Federer can use Madrid (indoor) as a substitute for Shanghai, but Hamburg is not a substitute for Rome, as Rome existed when Hamburg was a masters event and it exists currently.