summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-14 19:08:39 +0000
committerChris Lattner <sabre@nondot.org>2006-05-14 19:08:39 +0000
commitb461131c99d79a4e7f1cf01bd5ef4a98b169af96 (patch)
tree30ed4ff9555a2b0da9843c2efe02c43b2d7fbeeb /examples
parent59e8de386d0505a732254be770ff0978e4a54234 (diff)
downloadllvm-b461131c99d79a4e7f1cf01bd5ef4a98b169af96.tar.gz
llvm-b461131c99d79a4e7f1cf01bd5ef4a98b169af96.tar.bz2
llvm-b461131c99d79a4e7f1cf01bd5ef4a98b169af96.tar.xz
Catch a potentially thrown exception.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28295 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r--examples/ModuleMaker/ModuleMaker.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp
index 04c6a9f95b..4c09db4df7 100644
--- a/examples/ModuleMaker/ModuleMaker.cpp
+++ b/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;