I fixed Clang-tidy modernize-loop-convert and modernize-use-auto. Autos are also used for pointer variables assigned via casts. Patch includes other minor cleanups.
Fixes are in both source and generated code.
Build and regressions were finr on RHEL 6.