So I am writing a FunctionPass
for LLVM, and attempting to add some call instruction to a function.
If I make a call to Type::getVoidTy();
like this:
Type::getVoidTy(F.getContext());
Everything compiles fine.
However if I do this:
llvm::LLVMContext context = F.getContext();
Type::getVoidTy(context);
I get the following compile error when I try and compile the pass:
llvm-3.2.src/include/llvm/LLVMContext.h: In member function ‘virtual bool {anonymous}::Hello::runOnFunction(llvm::Function&)’:
llvm-3.2.src/include/llvm/LLVMContext.h:93:3: error: ‘llvm::LLVMContext::LLVMContext(llvm::LLVMContext&)’ is private
LLVMContext(LLVMContext&) LLVM_DELETED_FUNCTION;
^
llvm-3.2.src/lib/Transforms/Hello/Hello.cpp:370:48: error: within this context
llvm::LLVMContext context = F.getContext();
^
So I guess this is an issue with my understanding of c++, but I don't see why the call to the accessor would work in the one case, but not the other, in the same scope..