[llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Wed Nov 17 13:02:36 PST 2004



Changes in directory llvm/lib/VMCore:

Instructions.cpp updated: 1.5 -> 1.6
---
Log message:

Make ReturnInst accept a value of type void as the return value. The
ReturnInst constructed is the same as if NULL was passed instead of
the void value.


---
Diffs of the changes:  (+9 -0)

Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.5 llvm/lib/VMCore/Instructions.cpp:1.6
--- llvm/lib/VMCore/Instructions.cpp:1.5	Sat Oct 16 13:08:06 2004
+++ llvm/lib/VMCore/Instructions.cpp	Wed Nov 17 15:02:25 2004
@@ -233,6 +233,15 @@
 //                        ReturnInst Implementation
 //===----------------------------------------------------------------------===//
 
+void ReturnInst::init(Value* RetVal) {
+  if (RetVal && RetVal->getType() != Type::VoidTy) {
+    assert(!isa<BasicBlock>(RetVal) && 
+           "Cannot return basic block.  Probably using the incorrect ctor");
+    Operands.reserve(1);
+    Operands.push_back(Use(RetVal, this));
+  }
+}
+
 // Out-of-line ReturnInst method, put here so the C++ compiler can choose to
 // emit the vtable for the class in this translation unit.
 void ReturnInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {






More information about the llvm-commits mailing list