[llvm-commits] CVS: llvm/include/llvm/Instructions.h

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



Changes in directory llvm/include/llvm:

Instructions.h updated: 1.7 -> 1.8
---
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:  (+5 -8)

Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.7 llvm/include/llvm/Instructions.h:1.8
--- llvm/include/llvm/Instructions.h:1.7	Mon Nov 15 13:02:35 2004
+++ llvm/include/llvm/Instructions.h	Wed Nov 17 15:02:25 2004
@@ -807,23 +807,20 @@
     }
   }
 
-  void init(Value *RetVal) {
-    if (RetVal) {
-      assert(!isa<BasicBlock>(RetVal) && 
-             "Cannot return basic block.  Probably using the incorrect ctor");
-      Operands.reserve(1);
-      Operands.push_back(Use(RetVal, this));
-    }
-  }
+  void init(Value *RetVal);
 
 public:
   // ReturnInst constructors:
   // ReturnInst()                  - 'ret void' instruction
+  // ReturnInst(    null)          - 'ret void' instruction
   // ReturnInst(Value* X)          - 'ret X'    instruction
   // ReturnInst(    null, Inst *)  - 'ret void' instruction, insert before I
   // ReturnInst(Value* X, Inst *I) - 'ret X'    instruction, insert before I
   // ReturnInst(    null, BB *B)   - 'ret void' instruction, insert @ end of BB
   // ReturnInst(Value* X, BB *B)   - 'ret X'    instruction, insert @ end of BB
+  //
+  // NOTE: If the Value* passed is of type void then the constructor behaves as
+  // if it was passed NULL.
   ReturnInst(Value *RetVal = 0, Instruction *InsertBefore = 0)
     : TerminatorInst(Instruction::Ret, InsertBefore) {
     init(RetVal);






More information about the llvm-commits mailing list