<div dir="ltr"><div style>The code that I have written to get the function type is:</div><div style><br></div><div>const std::vector<Type *> ParamTys;</div><div>ParamTys.push_back(IntegerType::getInt32Ty(Context));</div>

<div>ParamTys.push_back(IntegerType::getInt32Ty(Context));</div><div>ParamTys.push_back(IntegerType::getInt32Ty(Context));</div><div>ParamTys.push_back(PointerType::get(Type::getVoidTy(Context), 0));</div><div>ParamTys.push_back(PointerType::get(Type::getVoidTy(Context), 0));</div>

<div><br></div><div>FunctionType *ftype = FunctionType::get(Type::getVoidTy(Context), ParamTys, true);</div><div><br></div><div style>And the errors are:</div><div style><br></div><div style><div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp: In member function ‘virtual bool {anonymous}::Hello2::runOnFunction(llvm::Function&)’:</div>

<div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:108:62: error: no matching function for call to ‘std::vector<llvm::Type*>::push_back(const llvm::IntegerType*) const’</div><div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:108:62: note: candidate is:</div>

<div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = llvm::Type*, _Alloc = std::allocator<llvm::Type*>, std::vector<_Tp, _Alloc>::value_type = llvm::Type*] <near match></div>

<div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note:   no known conversion for argument 1 from ‘const llvm::IntegerType*’ to ‘llvm::Type* const&’</div><div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:109:62: error: no matching function for call to ‘std::vector<llvm::Type*>::push_back(const llvm::IntegerType*) const’</div>

<div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:109:62: note: candidate is:</div><div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = llvm::Type*, _Alloc = std::allocator<llvm::Type*>, std::vector<_Tp, _Alloc>::value_type = llvm::Type*] <near match></div>

<div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note:   no known conversion for argument 1 from ‘const llvm::IntegerType*’ to ‘llvm::Type* const&’</div><div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:110:62: error: no matching function for call to ‘std::vector<llvm::Type*>::push_back(const llvm::IntegerType*) const’</div>

<div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:110:62: note: candidate is:</div><div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = llvm::Type*, _Alloc = std::allocator<llvm::Type*>, std::vector<_Tp, _Alloc>::value_type = llvm::Type*] <near match></div>

<div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note:   no known conversion for argument 1 from ‘const llvm::IntegerType*’ to ‘llvm::Type* const&’</div><div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:111:75: error: no matching function for call to ‘std::vector<llvm::Type*>::push_back(llvm::PointerType*) const’</div>

<div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:111:75: note: candidate is:</div><div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = llvm::Type*, _Alloc = std::allocator<llvm::Type*>, std::vector<_Tp, _Alloc>::value_type = llvm::Type*] <near match></div>

<div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note:   no known conversion for implicit ‘this’ parameter from ‘const std::vector<llvm::Type*>*’ to ‘std::vector<llvm::Type*>*’</div><div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:112:75: error: no matching function for call to ‘std::vector<llvm::Type*>::push_back(llvm::PointerType*) const’</div>

<div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:112:75: note: candidate is:</div><div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = llvm::Type*, _Alloc = std::allocator<llvm::Type*>, std::vector<_Tp, _Alloc>::value_type = llvm::Type*] <near match></div>

<div>/usr/include/c++/4.6/bits/stl_vector.h:826:7: note:   no known conversion for implicit ‘this’ parameter from ‘const std::vector<llvm::Type*>*’ to ‘std::vector<llvm::Type*>*’</div><div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:114:91: error: no matching function for call to ‘llvm::FunctionType::get(const llvm::Type*, const std::vector<llvm::Type*>&, bool)’</div>

<div>/home/akshay/llvm/llvm-2.9/lib/Transforms/AliasPass/pass2.cpp:114:91: note: candidates are:</div><div>/home/akshay/llvm/llvm-2.9/include/llvm/DerivedTypes.h:157:24: note: static llvm::FunctionType* llvm::FunctionType::get(const llvm::Type*, const std::vector<const llvm::Type*>&, bool)</div>

<div>/home/akshay/llvm/llvm-2.9/include/llvm/DerivedTypes.h:157:24: note:   no known conversion for argument 2 from ‘const std::vector<llvm::Type*>’ to ‘const std::vector<const llvm::Type*>&’</div><div><br>

</div><div><br></div><div style>It may be a silly mistake, but I am quite new to c and c++ coding especially in llvm. So I will be very grateful if you can help out.<br></div></div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">
On Tue, Apr 16, 2013 at 3:41 PM, Óscar Fuentes <span dir="ltr"><<a href="mailto:ofv@wanadoo.es" target="_blank">ofv@wanadoo.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">Akshay Jain <<a href="mailto:jivan.molu@gmail.com">jivan.molu@gmail.com</a>> writes:<br>
<br>
> I have tried it, but I always end up with some kind of error. Can you<br>
> explain how can I get a function type for function which returns void<br>
> (nothing) and it's arguments are (int, int, int, void *, void *, ...) ??<br>
<br>
</div>Instead of getting something to cut&paste, you would be much more<br>
enriched if the problematic code and the resulting errors were shown for<br>
examination.<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><font style="color:rgb(51,51,51)" size="4"><span style="font-family:comic sans ms,sans-serif"><b>Akshay Jain<br></b></span></font>
</div>