[llvm-commits] [llvm] r98624 - in /llvm/trunk: include/llvm/Instructions.h include/llvm/OperandTraits.h unittests/VMCore/InstructionsTest.cpp
Gabor Greif
ggreif at gmail.com
Tue Mar 16 03:59:48 PDT 2010
Author: ggreif
Date: Tue Mar 16 05:59:48 2010
New Revision: 98624
URL: http://llvm.org/viewvc/llvm-project?rev=98624&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/OperandTraits.h
llvm/trunk/unittests/VMCore/InstructionsTest.cpp
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=98624&r1=98623&r2=98624&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Mar 16 05:59:48 2010
@@ -1984,7 +1984,7 @@
};
template <>
-struct OperandTraits<ReturnInst> : public OptionalOperandTraits<> {
+struct OperandTraits<ReturnInst> : public VariadicOperandTraits<> {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value)
Modified: llvm/trunk/include/llvm/OperandTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/OperandTraits.h?rev=98624&r1=98623&r2=98624&view=diff
==============================================================================
--- llvm/trunk/include/llvm/OperandTraits.h (original)
+++ llvm/trunk/include/llvm/OperandTraits.h Tue Mar 16 05:59:48 2010
@@ -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 @@
};
//===----------------------------------------------------------------------===//
-// 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) {
Modified: llvm/trunk/unittests/VMCore/InstructionsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/InstructionsTest.cpp?rev=98624&r1=98623&r2=98624&view=diff
==============================================================================
--- llvm/trunk/unittests/VMCore/InstructionsTest.cpp (original)
+++ llvm/trunk/unittests/VMCore/InstructionsTest.cpp Tue Mar 16 05:59:48 2010
@@ -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
More information about the llvm-commits
mailing list