[llvm-commits] [llvm] r74724 - /llvm/trunk/include/llvm/Pass.h

Daniel Dunbar daniel at zuster.org
Thu Jul 16 20:52:46 PDT 2009


Hi Owen,

In hindsight I am a little worried about this commit.

> -  virtual bool doInitialization(Module &) { return false; }
> +  virtual bool doInitialization(Module &M) {
> +    Context = &M.getContext();
> +    return false;
> +  }

This is dangerous; in LLVM we do not frequently implement virtual
interfaces which require that the version in the base class be called.
At the minimum the comment should make clear that subclasses must call
this method if they override this, but I think it would be better to
add an extra layer of indirection so that we can guarantee the context
is always initialized.

 - Daniel




More information about the llvm-commits mailing list