https://github.com/nikic approved this pull request. LGTM, let's merge this given that it follows what the existing code does. Can clean it up later if we get a general API for this... https://github.com/llvm/llvm-project/pull/134702