[llvm] r235478 - Fix up Exception demo from recent opaque pointer type changes to GEP

David Blaikie dblaikie at gmail.com
Tue Apr 21 21:24:43 PDT 2015


Author: dblaikie
Date: Tue Apr 21 23:24:43 2015
New Revision: 235478

URL: http://llvm.org/viewvc/llvm-project?rev=235478&view=rev
Log:
Fix up Exception demo from recent opaque pointer type changes to GEP

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=235478&r1=235477&r2=235478&view=diff
==============================================================================
--- llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp (original)
+++ llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp Tue Apr 21 23:24:43 2015
@@ -1293,10 +1293,11 @@ static llvm::Function *createCatchWrappe
   // (_Unwind_Exception instance). This member tells us whether or not
   // the exception is foreign.
   llvm::Value *unwindExceptionClass =
-    builder.CreateLoad(builder.CreateStructGEP(
-             builder.CreatePointerCast(unwindException,
-                                       ourUnwindExceptionType->getPointerTo()),
-                                               0));
+      builder.CreateLoad(builder.CreateStructGEP(
+          ourUnwindExceptionType,
+          builder.CreatePointerCast(unwindException,
+                                    ourUnwindExceptionType->getPointerTo()),
+          0));
 
   // Branch to the externalExceptionBlock if the exception is foreign or
   // to a catch router if not. Either way the finally block will be run.
@@ -1336,10 +1337,10 @@ static llvm::Function *createCatchWrappe
   //
   // Note: Index is not relative to pointer but instead to structure
   //       unlike a true getelementptr (GEP) instruction
-  typeInfoThrown = builder.CreateStructGEP(typeInfoThrown, 0);
+  typeInfoThrown = builder.CreateStructGEP(ourExceptionType, typeInfoThrown, 0);
 
   llvm::Value *typeInfoThrownType =
-  builder.CreateStructGEP(typeInfoThrown, 0);
+      builder.CreateStructGEP(builder.getInt8PtrTy(), typeInfoThrown, 0);
 
   generateIntegerPrint(context,
                        module,





More information about the llvm-commits mailing list