https://github.com/ellishg approved this pull request. LGTM `realfile = file;` is probably the simplest solution. Maybe we can add a comment reminding to set `realfile` after `file` is modified https://github.com/llvm/llvm-project/pull/140791