Currently, retainedNodes tracks function-local variables and labels.
To support function-local import, types and static variables (which are globals
in LLVM IR), subsequent patches use the same field. So this patch makes
preliminary refactoring of the code tracking local entities to apply future
functional changes lucidly and cleanly.
No functional changes intended.
Do you need a writeable copy, or could you get by with returning an ArrayRef<TrackingMDNodeRef>?