[MCJIT] Fix an iterator invalidation bug in MCJIT::finalizeObject.
authorLang Hames <lhames@gmail.com>
Fri, 5 Sep 2014 23:38:35 +0000 (23:38 +0000)
committerLang Hames <lhames@gmail.com>
Fri, 5 Sep 2014 23:38:35 +0000 (23:38 +0000)
commit9a833c573d7dd14a4e8cb81282e2325cdb7b04a6
tree662b1ae87d410c913bfd88feb4f054623509043d
parent469c73bc273e45970c3c9d70762d94ccd349a912
[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
lib/ExecutionEngine/MCJIT/MCJIT.cpp
lib/ExecutionEngine/MCJIT/MCJIT.h