This will become the first of a series of patches to change getAllDerivedDefinitions() to return a const std::vector reference, rather than a copy of the vector. Now that the vectors are cached, the goal is to reduce the amount of copying.
I have updated four LLVM TableGen backends to accept the const reference, along with one MLIR backend that had to be changed.
I would appreciate any and all comments about this patch with respect to too much, too little, or just the right amount of copying.
I'd personally use 'auto' for this iterator type.