[llvm-commits] [PATCH] Bug 889: make FixedNumOperandTraits and VariadicOperandTraits more robust

Jay Foad jay.foad at gmail.com
Wed Jan 5 07:29:14 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=889

This bug is about removing virtual methods from Value and its subclasses.

While playing with fixes for this bug, I noticed that
FixedNumOperandTraits and VariadicOperandTraits only work for
subclasses of User, where the instance data for User is at offset 0 in
the instance data for the subclass. However, if the subclass has
virtual methods but User does not, this is no longer true. (There are
probably other cases where it would not be true, e.g. for a subclass
that inherits from multiple base classes, and User is not the first
base class.)

The attached patch fixes this by making FixedNumOperandTraits and
VariadicOperandTraits take an extra template argument specifying the
type of the subclass. It passes "make check".

OK to commit?

Thanks,
Jay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-operandtraits
Type: application/octet-stream
Size: 12498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110105/0ca618b9/attachment.obj>


More information about the llvm-commits mailing list