summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-09-05 23:38:35 +0000
committerLang Hames <lhames@gmail.com>2014-09-05 23:38:35 +0000
commit018452e6bc79f5f7599ee9df0ba87fa90516081b (patch)
tree9dcddc612724433e9719e89a6f89bd19fa86ab55 /llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
parentf5f9a836682d297f2caeb92f5a6c01b58ea839b3 (diff)
downloadbcm5719-llvm-018452e6bc79f5f7599ee9df0ba87fa90516081b.tar.gz
bcm5719-llvm-018452e6bc79f5f7599ee9df0ba87fa90516081b.zip
[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 . llvm-svn: 217291
Diffstat (limited to 'llvm/lib/ExecutionEngine/MCJIT/MCJIT.h')
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
index 9a4e53f27f2..624a4317a3b 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
@@ -118,6 +118,9 @@ class MCJIT : public ExecutionEngine {
ModulePtrSet::iterator begin_added() { return AddedModules.begin(); }
ModulePtrSet::iterator end_added() { return AddedModules.end(); }
+ iterator_range<ModulePtrSet::iterator> added() {
+ return iterator_range<ModulePtrSet::iterator>(begin_added(), end_added());
+ }
ModulePtrSet::iterator begin_loaded() { return LoadedModules.begin(); }
ModulePtrSet::iterator end_loaded() { return LoadedModules.end(); }
OpenPOWER on IntegriCloud