fix PR6589
adjusted unittest I have added some doxygen to OptionalOperandTraits, so hopefully there will be no confusion in the future. Incidentally OptionalOperandTraits is not used any more (IIUC), but the obvious client would be BranchInstr, and I plan to rearrange it that way. llvm-svn: 98624
This commit is contained in:
parent
155803840b
commit
35a9b8baeb
|
@ -1984,7 +1984,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct OperandTraits<ReturnInst> : public OptionalOperandTraits<> {
|
struct OperandTraits<ReturnInst> : public VariadicOperandTraits<> {
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value)
|
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// FixedNumOperands Trait Class
|
// FixedNumOperand Trait Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// FixedNumOperandTraits - determine the allocation regime of the Use array
|
/// FixedNumOperandTraits - determine the allocation regime of the Use array
|
||||||
|
@ -51,9 +51,12 @@ struct FixedNumOperandTraits {
|
||||||
};
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// 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>
|
template <unsigned ARITY = 1>
|
||||||
struct OptionalOperandTraits : public FixedNumOperandTraits<ARITY> {
|
struct OptionalOperandTraits : public FixedNumOperandTraits<ARITY> {
|
||||||
static unsigned operands(const User *U) {
|
static unsigned operands(const User *U) {
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TEST(InstructionsTest, ReturnInst_0) {
|
TEST(InstructionsTest, ReturnInst) {
|
||||||
LLVMContext &C(getGlobalContext());
|
LLVMContext &C(getGlobalContext());
|
||||||
|
|
||||||
// reproduction recipe for PR6589
|
// test for PR6589
|
||||||
const ReturnInst* r0 = ReturnInst::Create(C);
|
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
|
} // end anonymous namespace
|
||||||
|
|
Loading…
Reference in New Issue