[MCJIT] Fix an iterator invalidation bug in MCJIT::finalizeObject.

The finalizeObject method calls generateCodeForModule on each of the currently
'added' objects, but generateCodeForModule moves objects out of the 'added'
set as it's called. To avoid iterator invalidation issues, the added set is
copied out before any calls to generateCodeForModule.

This should fix http://llvm.org/PR20851 .


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217291 91177308-0d34-0410-b5e6-96231b3b80d8