CodeGen: switch to a range based for loop

Use a range based for loop instead of manual iteration.  NFC.
MC: cleanup includes

Cleanup Win64EH header inclusion.  NFC.
MC: remove duplicated code

This removes the duplicate definition of GetXDataSection.  This function is
available as a static method and is identical to the previous implementation.
This just cleans up the unnecessary duplication.