[llvm-commits] [llvm] r108932 - in /llvm/trunk: include/llvm/PassRegistry.h lib/VMCore/Pass.cpp lib/VMCore/PassRegistry.cpp

Chris Lattner clattner at apple.com
Sun Sep 5 15:43:51 PDT 2010


On Jul 20, 2010, at 2:22 PM, Owen Anderson wrote:

> Author: resistor
> Date: Tue Jul 20 16:22:24 2010
> New Revision: 108932
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=108932&view=rev
> Log:
> Move more functionality from Pass.cpp to PassRegistry.cpp.  This global will go away eventually, but for now we still need it around.
> 
Ok.

> +namespace {

Please only use namespaces for classes.  For globals and functions, just use 'static' like the coding standards say:
http://llvm.org/docs/CodingStandards.html#micro_anonns

> +
> +// 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 cleanupPassRegistry(void*) {
> +  if (PassRegistryObj) {
> +    delete PassRegistryObj;
> +    PassRegistryObj = 0;
> +  }
> +}
> +ManagedCleanup<&cleanupPassRegistry> registryCleanup ATTRIBUTE_USED;

You shouldn't need the ATTRIBUTE_USED.

> +
> +}

This FIXME still exists on mainline and seems pretty serious, what's your plan for fixing this?

-Chris



More information about the llvm-commits mailing list