[LLVMdev] reference to non-static member function must be called

JinHuang 54jin.huang at gmail.com
Tue Jan 7 23:25:38 PST 2014


Hi,everyone.
I'm writing a pass in which a CallInst to an external function will be
inserted. The function is declared like this:

void func(int a, unsigned chat *p);

and in the Pass(a Function Pass ,and using the InstVistor template ), I
wrote like this:

 	void visitStoreInst(StoreInst &SI)
		{
				//Get the refference of the types
			Module *M = SI.getParent()->getParent()->getParent();
			IntegerType* Int8Type  = IntegerType::getInt8Ty(M->getContext());
			IntegerType* Int32Type = IntegerType::getInt32Ty(M->getContext());
			IntegerType* Int64Type = IntegerType::getInt64Ty(M->getContext());
			PointerType* VoidPtrType = PointerType::getUnqual(Int8Type);
			Type* VoidType = Type::getVoidTy(M->getContext());
			DataLayout *TD = &getAnalysis<DataLayout>();	

			Value *Pointer = SI.getPointerOperand();
			Pointer = castTo(Pointer,VoidPtrType,Pointer->getName(),&SI);
			uint64_t size = TD->getTypeStoreSize(SI.getOperand(0)->getType());
			Value *StoreSize = ConstantInt::get(Int32Type, size);
			std::vector<Value *> args;
			args.push_back(StoreSize);
			args.push_back(Pointer);
			args.push_back(0);

			Instruction *inst = CallInst::Create(print,args,"",&SI);

		}
while compiling , it came out such error:

error: reference to non-static member function must be
      called
                        Instruction *inst =
CallInst::Create(print,args,"",&SI);

Can anyone tell me how to fix it? I can not get much useful information in
google!
Thank you!

-JinHuang



--
View this message in context: http://llvm.1065342.n5.nabble.com/reference-to-non-static-member-function-must-be-called-tp64865.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list