diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-20 14:25:50 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-20 14:25:50 -0800 |
commit | 3e05875d143900b8571ad41947caaaeb4611876a (patch) | |
tree | 5204d3b613151ccac739e76c0fda2e5454d0f07f | |
parent | 0dc9f44e4820e977fd086d744c73d4c422cac352 (diff) |
emit proper void exit from rejump in void functions
-rw-r--r-- | lib/Transforms/NaCl/LowerEmSetjmp.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Transforms/NaCl/LowerEmSetjmp.cpp b/lib/Transforms/NaCl/LowerEmSetjmp.cpp index 983018669a..9ad3921d25 100644 --- a/lib/Transforms/NaCl/LowerEmSetjmp.cpp +++ b/lib/Transforms/NaCl/LowerEmSetjmp.cpp @@ -159,7 +159,12 @@ bool LowerEmSetjmp::runOnModule(Module &M) { // Add a basic block to "rethrow" a longjmp, that we caught but is not for us // XXX we should call longjmp here, with proper params! return only works if the caller checks for longjmping BasicBlock *Rejump = BasicBlock::Create(F->getContext(), "relongjump", F); - ReturnInst::Create(F->getContext(), Constant::getNullValue(F->getReturnType()), Rejump); + Type *RT = F->getReturnType(); + if (RT->isVoidTy()) { + ReturnInst::Create(F->getContext(), Rejump); + } else { + ReturnInst::Create(F->getContext(), Constant::getNullValue(RT), Rejump); + } // Update each call that can longjmp so it can return to a setjmp where relevant |