From 67c619ba3eae68dcdb3f9340d82b33173aa0c256 Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Tue, 11 Jan 2011 15:07:38 +0000 Subject: FixedNumOperandTraits and VariadicOperandTraits assumed that, given a "this" pointer for any subclass of User, you could static_cast it to User* and then reinterpret_cast that to Use* to get the end of the operand list. This isn't a safe assumption in general, because the static_cast might adjust the "this" pointer. Fixed by having these OperandTraits classes take an extra template parameter, which is the subclass of User. This is groundwork for PR889. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123235 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/InstrTypes.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include/llvm/InstrTypes.h') diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 25b63a5..9dcf688 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -128,7 +128,8 @@ public: }; template <> -struct OperandTraits : public FixedNumOperandTraits<1> { +struct OperandTraits : + public FixedNumOperandTraits { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(UnaryInstruction, Value) @@ -432,7 +433,8 @@ public: }; template <> -struct OperandTraits : public FixedNumOperandTraits<2> { +struct OperandTraits : + public FixedNumOperandTraits { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryOperator, Value) @@ -903,7 +905,7 @@ private: // FIXME: these are redundant if CmpInst < BinaryOperator template <> -struct OperandTraits : public FixedNumOperandTraits<2> { +struct OperandTraits : public FixedNumOperandTraits { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CmpInst, Value) -- cgit v1.1