summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGarrison Venn <gvenn.cfe.dev@gmail.com>2011-07-11 16:31:53 +0000
committerGarrison Venn <gvenn.cfe.dev@gmail.com>2011-07-11 16:31:53 +0000
commit6e6cdd00aaca083779eb70dc238779935da6b9c8 (patch)
treeed0b5c6ce5cbe71752791ccc3f8e253860829eb5 /examples
parentfecdc983908169a804960ec97a6d5a518d1fa72c (diff)
downloadllvm-6e6cdd00aaca083779eb70dc238779935da6b9c8.tar.gz
llvm-6e6cdd00aaca083779eb70dc238779935da6b9c8.tar.bz2
llvm-6e6cdd00aaca083779eb70dc238779935da6b9c8.tar.xz
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
Diffstat (limited to 'examples')
-rw-r--r--examples/ExceptionDemo/ExceptionDemo.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/examples/ExceptionDemo/ExceptionDemo.cpp b/examples/ExceptionDemo/ExceptionDemo.cpp
index e5bd377770..c6499e4a16 100644
--- a/examples/ExceptionDemo/ExceptionDemo.cpp
+++ b/examples/ExceptionDemo/ExceptionDemo.cpp
@@ -190,7 +190,7 @@ static llvm::ConstantInt *ourExceptionThrownState;
static llvm::ConstantInt *ourExceptionCaughtState;
typedef std::vector<std::string> ArgNames;
-typedef std::vector<const llvm::Type*> ArgTypes;
+typedef std::vector<llvm::Type*> ArgTypes;
//
// Code Generation Utilities
@@ -987,7 +987,7 @@ static llvm::BasicBlock *createFinallyBlock(llvm::LLVMContext &context,
ourExceptionNotThrownState);
const llvm::PointerType *exceptionStorageType =
- builder.getInt8Ty()->getPointerTo();
+ builder.getInt8Ty()->getPointerTo();
*exceptionStorage =
createEntryBlockAlloca(toAddTo,
"exceptionStorage",
@@ -1098,7 +1098,7 @@ llvm::Function *createCatchWrappedInvokeFunction(llvm::Module &module,
llvm::Function *toPrint32Int = module.getFunction("print32Int");
ArgTypes argTypes;
- argTypes.push_back(builder.getInt32Ty());
+ argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
ArgNames argNames;
argNames.push_back("exceptTypeToThrow");
@@ -1376,7 +1376,7 @@ llvm::Function *createThrowExceptionFunction(llvm::Module &module,
llvm::LLVMContext &context = module.getContext();
namedValues.clear();
ArgTypes unwindArgTypes;
- unwindArgTypes.push_back(builder.getInt32Ty());
+ unwindArgTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
ArgNames unwindArgNames;
unwindArgNames.push_back("exceptTypeToThrow");
@@ -1622,7 +1622,7 @@ void runExceptionThrow(llvm::ExecutionEngine *engine,
// End test functions
//
-typedef llvm::ArrayRef<const llvm::Type*> TypeArray;
+typedef llvm::ArrayRef<llvm::Type*> TypeArray;
/// This initialization routine creates type info globals and
/// adds external function declarations to module.
@@ -1650,8 +1650,7 @@ static void createStandardUtilityFunctions(unsigned numTypeInfos,
// Create our type info type
ourTypeInfoType = llvm::StructType::get(context,
- TypeArray(builder.getInt32Ty()));
-
+ TypeArray(llvm::Type::getInt32Ty(builder.getContext())));
// Create OurException type
ourExceptionType = llvm::StructType::get(context,
TypeArray(ourTypeInfoType));
@@ -1661,7 +1660,9 @@ static void createStandardUtilityFunctions(unsigned numTypeInfos,
// Note: Declaring only a portion of the _Unwind_Exception struct.
// Does this cause problems?
ourUnwindExceptionType =
- llvm::StructType::get(context, TypeArray(builder.getInt64Ty()));
+ llvm::StructType::get(context,
+ TypeArray(llvm::Type::getInt64Ty(builder.getContext())));
+
struct OurBaseException_t dummyException;
// Calculate offset of OurException::unwindException member.
@@ -1726,7 +1727,7 @@ static void createStandardUtilityFunctions(unsigned numTypeInfos,
const llvm::Type *retType = builder.getVoidTy();
argTypes.clear();
- argTypes.push_back(builder.getInt32Ty());
+ argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
argTypes.push_back(builder.getInt8Ty()->getPointerTo());
argNames.clear();
@@ -1745,7 +1746,7 @@ static void createStandardUtilityFunctions(unsigned numTypeInfos,
retType = builder.getVoidTy();
argTypes.clear();
- argTypes.push_back(builder.getInt64Ty());
+ argTypes.push_back(llvm::Type::getInt64Ty(builder.getContext()));
argTypes.push_back(builder.getInt8Ty()->getPointerTo());
argNames.clear();
@@ -1782,7 +1783,7 @@ static void createStandardUtilityFunctions(unsigned numTypeInfos,
retType = builder.getVoidTy();
argTypes.clear();
- argTypes.push_back(builder.getInt32Ty());
+ argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
argNames.clear();
@@ -1818,7 +1819,7 @@ static void createStandardUtilityFunctions(unsigned numTypeInfos,
retType = builder.getInt8Ty()->getPointerTo();
argTypes.clear();
- argTypes.push_back(builder.getInt32Ty());
+ argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
argNames.clear();
@@ -1876,9 +1877,9 @@ static void createStandardUtilityFunctions(unsigned numTypeInfos,
retType = builder.getInt32Ty();
argTypes.clear();
- argTypes.push_back(builder.getInt32Ty());
- argTypes.push_back(builder.getInt32Ty());
- argTypes.push_back(builder.getInt64Ty());
+ argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
+ argTypes.push_back(llvm::Type::getInt32Ty(builder.getContext()));
+ argTypes.push_back(llvm::Type::getInt64Ty(builder.getContext()));
argTypes.push_back(builder.getInt8Ty()->getPointerTo());
argTypes.push_back(builder.getInt8Ty()->getPointerTo());