Remove the last improper use of getGlobalContext() from LLVM.
authorNick Lewycky <nicholas@mxc.ca>
Sat, 13 Aug 2011 01:04:44 +0000 (01:04 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Sat, 13 Aug 2011 01:04:44 +0000 (01:04 +0000)
commit53b2b7364385b2f2d98c0052df73a637a81c2288
treeeb96a3877dcb4b05e6b3463d1e6f5ce00488bda5
parent266246c0edd0cdff5df9d2598a1e915759f176cb
Remove the last improper use of getGlobalContext() from LLVM.

This caused a race condition where a thread calls ~LLVMContextImpl which calls
Module::dropAllReferences which calls begin() on an empty ilist that would
create the sentinel, which racily accesses the global context.

This can not be fixed by locking inside createSentinel because the lock would
need to be shared with all users of the global context, including those that
reside outside LLVM's own code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137546 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Module.h
lib/VMCore/Module.cpp