};
template <>
-struct OperandTraits<ReturnInst> : public OptionalOperandTraits<> {
+struct OperandTraits<ReturnInst> : public VariadicOperandTraits<> {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value)
namespace llvm {
//===----------------------------------------------------------------------===//
-// FixedNumOperands Trait Class
+// FixedNumOperand Trait Class
//===----------------------------------------------------------------------===//
/// FixedNumOperandTraits - determine the allocation regime of the Use array
};
//===----------------------------------------------------------------------===//
-// OptionalOperands Trait Class
+// OptionalOperand Trait Class
//===----------------------------------------------------------------------===//
+/// OptionalOperandTraits - when the number of operands may change at runtime.
+/// Naturally it may only decrease, because the allocations may not change.
+
template <unsigned ARITY = 1>
struct OptionalOperandTraits : public FixedNumOperandTraits<ARITY> {
static unsigned operands(const User *U) {
namespace llvm {
namespace {
-TEST(InstructionsTest, ReturnInst_0) {
+TEST(InstructionsTest, ReturnInst) {
LLVMContext &C(getGlobalContext());
- // reproduction recipe for PR6589
+ // test for PR6589
const ReturnInst* r0 = ReturnInst::Create(C);
- EXPECT_NE(r0->op_begin(), r0->op_end());
+ EXPECT_EQ(r0->op_begin(), r0->op_end());
}
} // end anonymous namespace