comparison gen/functions.cpp @ 328:7086a84ab3d6 trunk

[svn r349] Fixed problems with static arrays of void as well as a static arrays with zero length. Fixed issues with DMD generated assert statements when using class invariants, generally due to incomplete ASTs. Removed some dead code. Added a few comments.
author lindquist
date Fri, 11 Jul 2008 00:17:00 +0200
parents 665b81613475
children 8c1dc3e705da
comparison
equal deleted inserted replaced
327:781af50846b2 328:7086a84ab3d6
730 func->getBasicBlockList().pop_back(); 730 func->getBasicBlockList().pop_back();
731 731
732 // if the last block is empty now, it must be unreachable or it's a bug somewhere else 732 // if the last block is empty now, it must be unreachable or it's a bug somewhere else
733 // would be nice to figure out how to assert that this is correct 733 // would be nice to figure out how to assert that this is correct
734 llvm::BasicBlock* lastbb = &func->getBasicBlockList().back(); 734 llvm::BasicBlock* lastbb = &func->getBasicBlockList().back();
735 if (lastbb->empty()) { 735 if (lastbb->empty())
736 {
736 new llvm::UnreachableInst(lastbb); 737 new llvm::UnreachableInst(lastbb);
737 // if (llvm::pred_begin(lastbb) != llvm::pred_end(lastbb))
738 // {
739 // Logger::println("Erasing lastbb");
740 // lastbb->eraseFromParent();
741 // }
742 // else {
743 // new llvm::UnreachableInst(lastbb);
744 // // if (func->getReturnType() == LLType::VoidTy) {
745 // // llvm::ReturnInst::Create(lastbb);
746 // // }
747 // // else {
748 // // llvm::ReturnInst::Create(llvm::UndefValue::get(func->getReturnType()), lastbb);
749 // // }
750 // }
751 } 738 }
752 739
753 // if the last block is not terminated we return a null value or void 740 // if the last block is not terminated we return a null value or void
754 // for some unknown reason this is needed when a void main() has a inline asm block ... 741 // for some unknown reason this is needed when a void main() has a inline asm block ...
755 // this should be harmless for well formed code! 742 // this should be harmless for well formed code!