X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=examples%2FExceptionDemo%2FExceptionDemo.cpp;h=3583677b6898c3ad3ee35e16f2119d171fd1334c;hb=875710a2fd6b3c4f814961582594bd5c1cdb493a;hp=6a0d0d027fd7bdc5fedfea001e8e66d8ba507d58;hpb=354362524a72b3fa43a6c09380b7ae3b2380cbba;p=oota-llvm.git diff --git a/examples/ExceptionDemo/ExceptionDemo.cpp b/examples/ExceptionDemo/ExceptionDemo.cpp index 6a0d0d027fd..3583677b689 100644 --- a/examples/ExceptionDemo/ExceptionDemo.cpp +++ b/examples/ExceptionDemo/ExceptionDemo.cpp @@ -48,7 +48,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/Verifier.h" +#include "llvm/IR/Verifier.h" #include "llvm/ExecutionEngine/MCJIT.h" #include "llvm/ExecutionEngine/SectionMemoryManager.h" #include "llvm/IR/DataLayout.h" @@ -915,7 +915,7 @@ void generateStringPrint(llvm::LLVMContext &context, new llvm::GlobalVariable(module, stringConstant->getType(), true, - llvm::GlobalValue::LinkerPrivateLinkage, + llvm::GlobalValue::PrivateLinkage, stringConstant, ""); } @@ -959,7 +959,7 @@ void generateIntegerPrint(llvm::LLVMContext &context, new llvm::GlobalVariable(module, stringConstant->getType(), true, - llvm::GlobalValue::LinkerPrivateLinkage, + llvm::GlobalValue::PrivateLinkage, stringConstant, ""); } @@ -1562,7 +1562,7 @@ llvm::Function *createUnwindExceptionTest(llvm::Module &module, return(outerCatchFunct); } - +namespace { /// Represents our foreign exceptions class OurCppRunException : public std::runtime_error { public: @@ -1577,11 +1577,9 @@ public: std::runtime_error::operator=(toCopy))); } - ~OurCppRunException (void) throw (); + virtual ~OurCppRunException (void) throw () {} }; - -// Provide out-of-line definition to prevent weak vtable. -OurCppRunException::~OurCppRunException() throw () {} +} // end anonymous namespace /// Throws foreign C++ exception. /// @param ignoreIt unused parameter that allows function to match implied @@ -1966,10 +1964,8 @@ int main(int argc, char *argv[]) { // Build engine with JIT llvm::EngineBuilder factory(module); factory.setEngineKind(llvm::EngineKind::JIT); - factory.setAllocateGVsWithCode(false); factory.setTargetOptions(Opts); factory.setMCJITMemoryManager(MemMgr); - factory.setUseMCJIT(true); llvm::ExecutionEngine *executionEngine = factory.create(); { @@ -1978,7 +1974,8 @@ int main(int argc, char *argv[]) { // Set up the optimizer pipeline. // Start with registering info about how the // target lays out data structures. - fpm.add(new llvm::DataLayout(*executionEngine->getDataLayout())); + module->setDataLayout(executionEngine->getDataLayout()); + fpm.add(new llvm::DataLayoutPass(module)); // Optimizations turned on #ifdef ADD_OPT_PASSES