[PATCH] Don't register and de-register all PassRegistrationListeners automatically

David Blaikie dblaikie at gmail.com
Wed Jun 11 17:29:22 PDT 2014


================
Comment at: include/llvm/IR/LegacyPassNameParser.h:47
@@ -47,2 +46,3 @@
+  PassNameParser();
   virtual ~PassNameParser();
 
----------------
Zachary Turner wrote:
> David Blaikie wrote:
> > should we just remove this dtor entirely? (I don't see any reason it needs to be virtual, and it doesn't do anything)
> I kind of would rather leave it, if only because it's a nice place to drop a comment that explicitly explains the reasoning behind the asymmetry of not calling removeRegistrationListener, just to make sure we don't get back into this bind later in the future.
Will we be able to secure that bug from recurring silently in the future?

I'm not sure what assert/check we can add to make sure that ManagedStatics aren't (re)created during global dtors... 

If they didn't allow re-initialization, then we could add assertions that check that after destruction they are never accessed again (I've done this for other lazy singletons I've dealt with, but they didn't have resurrection). Without that, and no (that I know of) to detect that code is currently running in a global dtor, I can't think of a way, unfortunately...

http://reviews.llvm.org/D4106






More information about the llvm-commits mailing list