[llvm-commits] CVS: llvm/examples/ModuleMaker/ModuleMaker.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun May 14 12:08:52 PDT 2006



Changes in directory llvm/examples/ModuleMaker:

ModuleMaker.cpp updated: 1.6 -> 1.7
---
Log message:

Catch a potentially thrown exception.


---
Diffs of the changes:  (+6 -1)

 ModuleMaker.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm/examples/ModuleMaker/ModuleMaker.cpp
diff -u llvm/examples/ModuleMaker/ModuleMaker.cpp:1.6 llvm/examples/ModuleMaker/ModuleMaker.cpp:1.7
--- llvm/examples/ModuleMaker/ModuleMaker.cpp:1.6	Wed Apr 20 11:42:35 2005
+++ llvm/examples/ModuleMaker/ModuleMaker.cpp	Sun May 14 14:08:39 2006
@@ -54,7 +54,12 @@
   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;






More information about the llvm-commits mailing list