I'm writing an LLVM pass that renames functions amongst other things. I have this small piece of code
// Get function arguments
std::vector<Argument*> Arguments;
for (auto Arg = F.arg_begin(); Arg != F.arg_end(); ++Arg)
{
Type *ArgTy = Arg->getType();
if (ArgTy->isFloatingPointTy())
{
errs() << "Cannot test function: " << F.getName() << " (floating point arguments)\n";
return false;
}
Arguments.push_back(Arg);
}
The line Arguments.push_back(Arg)
is causing a compilation error:
no known conversion for argument 1 from ‘llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Argument, false, false, void>, false, false>’ to ‘llvm::Argument* const&’
.
However, in the header file llvm/IR/Function.h
(source), arg_iterator
is declared as an alias for the type Argument *
, and the functions arg_begin()
and arg_end()
called by a Function
instance, return an arg_iterator()
type. So why am I getting the type error? Does it have something to do with the use of the auto
keyword?
Aucun commentaire:
Enregistrer un commentaire