Add a RAII class for saving and restoring instantiations and uses. No behavior change.