From 5eae95160322d3efc6a315dece144a3e543e8388 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 May 2006 19:08:39 +0000 Subject: Catch a potentially thrown exception. llvm-svn: 28295 --- llvm/examples/ModuleMaker/ModuleMaker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/examples/ModuleMaker/ModuleMaker.cpp') diff --git a/llvm/examples/ModuleMaker/ModuleMaker.cpp b/llvm/examples/ModuleMaker/ModuleMaker.cpp index 04c6a9f..4c09db4 100644 --- a/llvm/examples/ModuleMaker/ModuleMaker.cpp +++ b/llvm/examples/ModuleMaker/ModuleMaker.cpp @@ -54,7 +54,12 @@ int main() { BB->getInstList().push_back(new ReturnInst(Add)); // Output the bytecode file to stdout - WriteBytecodeToFile(M, std::cout); + try { + WriteBytecodeToFile(M, std::cout); + } catch (const std::string &Error) { + std::cerr << "Error writing file: " << Error << "\n"; + return 1; + } // Delete the module and all of its contents. delete M; -- cgit v1.1