mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-01 02:33:44 +00:00
Use a ManagedCleanup to prevent leaking the PassRegistrar map. In breaks the
use case where someone wants to resurrect LLVM after calling llvm_shutdown, but I'm not aware of any clients that are affected by this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100519 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
adc6e06ff0
commit
ffb7312458
@ -294,13 +294,8 @@ public:
|
|||||||
static std::vector<PassRegistrationListener*> *Listeners = 0;
|
static std::vector<PassRegistrationListener*> *Listeners = 0;
|
||||||
static sys::SmartMutex<true> ListenersLock;
|
static sys::SmartMutex<true> ListenersLock;
|
||||||
|
|
||||||
// FIXME: This should use ManagedStatic to manage the pass registrar.
|
static PassRegistrar *PassRegistrarObj = 0;
|
||||||
// Unfortunately, we can't do this, because passes are registered with static
|
|
||||||
// ctors, and having llvm_shutdown clear this map prevents successful
|
|
||||||
// ressurection after llvm_shutdown is run.
|
|
||||||
static PassRegistrar *getPassRegistrar() {
|
static PassRegistrar *getPassRegistrar() {
|
||||||
static PassRegistrar *PassRegistrarObj = 0;
|
|
||||||
|
|
||||||
// Use double-checked locking to safely initialize the registrar when
|
// Use double-checked locking to safely initialize the registrar when
|
||||||
// we're running in multithreaded mode.
|
// we're running in multithreaded mode.
|
||||||
PassRegistrar* tmp = PassRegistrarObj;
|
PassRegistrar* tmp = PassRegistrarObj;
|
||||||
@ -323,6 +318,19 @@ static PassRegistrar *getPassRegistrar() {
|
|||||||
return PassRegistrarObj;
|
return PassRegistrarObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: We use ManagedCleanup to erase the pass registrar on shutdown.
|
||||||
|
// Unfortunately, passes are registered with static ctors, and having
|
||||||
|
// llvm_shutdown clear this map prevents successful ressurection after
|
||||||
|
// llvm_shutdown is run. Ideally we should find a solution so that we don't
|
||||||
|
// leak the map, AND can still resurrect after shutdown.
|
||||||
|
void cleanupPassRegistrar(void*) {
|
||||||
|
if (PassRegistrarObj) {
|
||||||
|
delete PassRegistrarObj;
|
||||||
|
PassRegistrarObj = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ManagedCleanup<&cleanupPassRegistrar> registrarCleanup;
|
||||||
|
|
||||||
// getPassInfo - Return the PassInfo data structure that corresponds to this
|
// getPassInfo - Return the PassInfo data structure that corresponds to this
|
||||||
// pass...
|
// pass...
|
||||||
const PassInfo *Pass::getPassInfo() const {
|
const PassInfo *Pass::getPassInfo() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user