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:
Gabor Greif 2010-03-16 10:59:48 +00:00
parent 7011013935
commit f073ba6af8
3 changed files with 9 additions and 6 deletions

View File

@ -1984,7 +1984,7 @@ public:
};
template <>
struct OperandTraits<ReturnInst> : public OptionalOperandTraits<> {
struct OperandTraits<ReturnInst> : public VariadicOperandTraits<> {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value)

View File

@ -20,7 +20,7 @@
namespace llvm {
//===----------------------------------------------------------------------===//
// FixedNumOperands Trait Class
// FixedNumOperand Trait Class
//===----------------------------------------------------------------------===//
/// 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>
struct OptionalOperandTraits : public FixedNumOperandTraits<ARITY> {
static unsigned operands(const User *U) {

View File

@ -14,12 +14,12 @@
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