[LLVMdev] ConstantPointerRef and void*'s to functions

Chris Lattner sabre at nondot.org
Sat May 10 00:22:01 PDT 2003


> Function* foo = ...;
> std::vector<const Type*> fields;
> ...
> fields.push_back(ConstantPointerRef::get(foo));
>
> will yield a type error because the type of the function foo ("void (*)
> (double*, double*)") does not match the structure field type.
> How might I go about making the necessary cast-like step at the
> GlobalValue/Function level? I want to do something like:

ConstantExpr::getCast will return a constant cast from one constant to a
different type.

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list