[llvm-commits] [llvm] r140301 - /llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp

Garrison Venn gvenn.cfe.dev at gmail.com
Thu Sep 22 07:07:50 PDT 2011


Author: gvenn
Date: Thu Sep 22 09:07:50 2011
New Revision: 140301

URL: http://llvm.org/viewvc/llvm-project?rev=140301&view=rev
Log:
This is a hack to get the demo working with the new 3.0 exception 
infrastructure. As this makes the demo no longer a demo, and especially not a 
demo on how to use the llvm exception mechanism, this hack will shortly be 
changed to use the new 3.0 exception infrastructure. However for the time being 
this demo is an example on how to use the AutoUpgrade 
UpgradeExceptionHandling(...) function on < 3.0 exception handling code.                          

Modified:
    llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp

Modified: llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp?rev=140301&r1=140300&r2=140301&view=diff
==============================================================================
--- llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp (original)
+++ llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp Thu Sep 22 09:07:50 2011
@@ -62,6 +62,9 @@
 #include "llvm/Support/Dwarf.h"
 #include "llvm/Support/TargetSelect.h"
 
+// FIXME: See use of UpgradeExceptionHandling(...) below
+#include "llvm/AutoUpgrade.h"
+
 // FIXME: Although all systems tested with (Linux, OS X), do not need this 
 //        header file included. A user on ubuntu reported, undefined symbols 
 //        for stderr, and fprintf, and the addition of this include fixed the
@@ -1341,6 +1344,17 @@
                                 catchBlocks[nextTypeToCatch]);
   }
   
+  // FIXME: This is a hack to get the demo working with the new 3.0 exception
+  //        infrastructure. As this makes the demo no longer a demo, and
+  //        especially not a demo on how to use the llvm exception mechanism,
+  //        this hack will shortly be changed to use the new 3.0 exception
+  //        infrastructure. However for the time being this demo is an 
+  //        example on how to use the AutoUpgrade UpgradeExceptionHandling(...)
+  //        function on < 3.0 exception handling code.
+  //
+  // Must be run before verifier
+  UpgradeExceptionHandling(&module);
+
   llvm::verifyFunction(*ret);
   fpm.run(*ret);
   
@@ -1981,10 +1995,10 @@
     // Generate test code using function throwCppException(...) as
     // the function which throws foreign exceptions.
     llvm::Function *toRun = 
-    createUnwindExceptionTest(*module, 
-                              theBuilder, 
-                              fpm,
-                              "throwCppException");
+      createUnwindExceptionTest(*module, 
+                                theBuilder, 
+                                fpm,
+                                "throwCppException");
     
     fprintf(stderr, "\nBegin module dump:\n\n");
     





More information about the llvm-commits mailing list