diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-11-17 21:02:25 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-11-17 21:02:25 +0000 |
commit | 859804f529d73120a4414c43cae5fc546453a37f (patch) | |
tree | 417e2097169df37ccb5c0ab29f89262b4e4232ca /lib/VMCore/Instructions.cpp | |
parent | a1c15bda23819f3a5c3349ca15551a7329293cd6 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 029ee6a0f6..44167cbae7 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -233,6 +233,15 @@ Function *CallSite::getCalledFunction() const { // 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) { |