llvm.org GIT mirror llvm / 6e6cdd0
Modified demo to work with non const Type parameters as is required by new type system. However most of these modifications were due to IRBuilder (IRBuilderBase), not having been modified to NOT return such const qualified free types. If IRBuilder does not change, as can also be seen in its instruction creation methods, to use const free types, it may be useful to have ExceptionDemo drop IRBuilder usage. Modifying builder.getInt32Ty() to llvm::Type::getInt32Ty(builder.getContext()) is pretty ugly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134901 91177308-0d34-0410-b5e6-96231b3b80d8 Garrison Venn 8 years ago
1 changed file(s) with 16 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
189189 static llvm::ConstantInt *ourExceptionCaughtState;
190190
191191 typedef std::vector ArgNames;
192 typedef std::vector<const llvm::Type*> ArgTypes;
192 typedef std::vector<llvm::Type*> ArgTypes;
193193
194194 //
195195 // Code Generation Utilities
986986 ourExceptionNotThrownState);
987987
988988 const llvm::PointerType *exceptionStorageType =
989 builder.getInt8Ty()->getPointerTo();
989 builder.getInt8Ty()->getPointerTo();
990990 *exceptionStorage =
991991 createEntryBlockAlloca(toAddTo,
992992 "exceptionStorage",
10971097 llvm::Function *toPrint32Int = module.getFunction("print32Int");
10981098
10991099 ArgTypes argTypes;
1100 argTypes.push_back(builder.getInt32Ty());
1100 argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
11011101
11021102 ArgNames argNames;
11031103 argNames.push_back("exceptTypeToThrow");
13751375 llvm::LLVMContext &context = module.getContext();
13761376 namedValues.clear();
13771377 ArgTypes unwindArgTypes;
1378 unwindArgTypes.push_back(builder.getInt32Ty());
1378 unwindArgTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
13791379 ArgNames unwindArgNames;
13801380 unwindArgNames.push_back("exceptTypeToThrow");
13811381
16211621 // End test functions
16221622 //
16231623
1624 typedef llvm::ArrayRef<const llvm::Type*> TypeArray;
1624 typedef llvm::ArrayRef<llvm::Type*> TypeArray;
16251625
16261626 /// This initialization routine creates type info globals and
16271627 /// adds external function declarations to module.
16491649
16501650 // Create our type info type
16511651 ourTypeInfoType = llvm::StructType::get(context,
1652 TypeArray(builder.getInt32Ty()));
1653
1652 TypeArray(llvm::Type::getInt32Ty(builder.getContext())));
16541653 // Create OurException type
16551654 ourExceptionType = llvm::StructType::get(context,
16561655 TypeArray(ourTypeInfoType));
16601659 // Note: Declaring only a portion of the _Unwind_Exception struct.
16611660 // Does this cause problems?
16621661 ourUnwindExceptionType =
1663 llvm::StructType::get(context, TypeArray(builder.getInt64Ty()));
1662 llvm::StructType::get(context,
1663 TypeArray(llvm::Type::getInt64Ty(builder.getContext())));
1664
16641665 struct OurBaseException_t dummyException;
16651666
16661667 // Calculate offset of OurException::unwindException member.
17251726 const llvm::Type *retType = builder.getVoidTy();
17261727
17271728 argTypes.clear();
1728 argTypes.push_back(builder.getInt32Ty());
1729 argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
17291730 argTypes.push_back(builder.getInt8Ty()->getPointerTo());
17301731
17311732 argNames.clear();
17441745 retType = builder.getVoidTy();
17451746
17461747 argTypes.clear();
1747 argTypes.push_back(builder.getInt64Ty());
1748 argTypes.push_back(llvm::Type::getInt64Ty(builder.getContext()));
17481749 argTypes.push_back(builder.getInt8Ty()->getPointerTo());
17491750
17501751 argNames.clear();
17811782 retType = builder.getVoidTy();
17821783
17831784 argTypes.clear();
1784 argTypes.push_back(builder.getInt32Ty());
1785 argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
17851786
17861787 argNames.clear();
17871788
18171818 retType = builder.getInt8Ty()->getPointerTo();
18181819
18191820 argTypes.clear();
1820 argTypes.push_back(builder.getInt32Ty());
1821 argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
18211822
18221823 argNames.clear();
18231824
18751876 retType = builder.getInt32Ty();
18761877
18771878 argTypes.clear();
1878 argTypes.push_back(builder.getInt32Ty());
1879 argTypes.push_back(builder.getInt32Ty());
1880 argTypes.push_back(builder.getInt64Ty());
1879 argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
1880 argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
1881 argTypes.push_back(llvm::Type::getInt64Ty(builder.getContext()));
18811882 argTypes.push_back(builder.getInt8Ty()->getPointerTo());
18821883 argTypes.push_back(builder.getInt8Ty()->getPointerTo());
18831884