#include <sstream>
#include <stdexcept>
+#include <inttypes.h>
#ifndef USE_GLOBAL_STR_CONSTS
#define USE_GLOBAL_STR_CONSTS true
}
-/// Deletes the true previosly allocated exception whose address
+/// Deletes the true previously allocated exception whose address
/// is calculated from the supplied OurBaseException_t::unwindException
/// member address. Handles (ignores), NULL pointers.
/// @param expToDelete exception to delete
fprintf(stderr,
"handleActionValue(...): exceptionObject = <%p>, "
"excp = <%p>.\n",
- exceptionObject,
- excp);
+ (void*)exceptionObject,
+ (void*)excp);
#endif
const uint8_t *actionPos = (uint8_t*) actionEntry,
#ifdef DEBUG
fprintf(stderr,
- "handleActionValue(...):typeOffset: <%lld>, "
- "actionOffset: <%lld>.\n",
+ "handleActionValue(...):typeOffset: <%" PRIi64 ">, "
+ "actionOffset: <%" PRIi64 ">.\n",
typeOffset,
actionOffset);
#endif
#ifdef DEBUG
fprintf(stderr,
"ourPersonality(...):lsda = <%p>.\n",
- lsda);
+ (void*)lsda);
#endif
// The real work of the personality function is captured here
llvm::Value *cast = builder.CreateBitCast(stringVar,
builder.getInt8PtrTy());
- builder.CreateCall2(&printFunct, &toPrint, cast);
+ builder.CreateCall(&printFunct, {&toPrint, cast});
}
builder.SetInsertPoint(exceptionBlock);
llvm::Function *personality = module.getFunction("ourPersonality");
+ ret->setPersonalityFn(personality);
llvm::LandingPadInst *caughtResult =
builder.CreateLandingPad(ourCaughtResultType,
- personality,
numExceptionsToCatch,
"landingPad");
// (_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.
//
// 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,
std::runtime_error::operator=(toCopy)));
}
- virtual ~OurCppRunException (void) throw () {}
+ ~OurCppRunException(void) throw() override {}
};
} // end anonymous namespace
#ifdef DEBUG
fprintf(stderr,
"createStandardUtilityFunctions(...):ourBaseFromUnwindOffset "
- "= %lld, sizeof(struct OurBaseException_t) - "
+ "= %" PRIi64 ", sizeof(struct OurBaseException_t) - "
"sizeof(struct _Unwind_Exception) = %lu.\n",
ourBaseFromUnwindOffset,
sizeof(struct OurBaseException_t) -
// Start with registering info about how the
// target lays out data structures.
module->setDataLayout(executionEngine->getDataLayout());
- fpm.add(new llvm::DataLayoutPass());
// Optimizations turned on
#ifdef ADD_OPT_PASSES