summaryrefslogtreecommitdiffstats
path: root/llvm/examples/ModuleMaker/ModuleMaker.cpp
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
commit5eae95160322d3efc6a315dece144a3e543e8388 (patch)
tree4d4eb94f64c06c806cd21f113cc4a60bb1088775 /llvm/examples/ModuleMaker/ModuleMaker.cpp
parenta8a550f1e3c02d7f9cbfe87a6c11f864e3671ef5 (diff)
downloadbcm5719-llvm-5eae95160322d3efc6a315dece144a3e543e8388.tar.gz
bcm5719-llvm-5eae95160322d3efc6a315dece144a3e543e8388.zip
Catch a potentially thrown exception.
llvm-svn: 28295
Diffstat (limited to 'llvm/examples/ModuleMaker/ModuleMaker.cpp')
-rw-r--r--llvm/examples/ModuleMaker/ModuleMaker.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/examples/ModuleMaker/ModuleMaker.cpp b/llvm/examples/ModuleMaker/ModuleMaker.cpp
index 04c6a9f95bf..4c09db4df75 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;
OpenPOWER on IntegriCloud