> URL: http://llvm.org/viewvc/llvm-project?rev=45913&view=rev > Log: > Add hasByValArgument() to test if a call instruction has byval > argument(s).
Ok. > +/// @brief Determine if any call argument is an aggregate passed by > value. > +bool CallInst::hasByValArgument() const { > + const Value *Callee = getCalledValue(); > + const PointerType *CalleeTy = cast<PointerType>(Callee->getType()); > + const FunctionType *FTy = cast<FunctionType>(CalleeTy- > >getElementType()); > + for (unsigned i = 1, e = FTy->getNumParams()+1; i != e; ++i) Instead of walking from 1 .. FTy->getNumParams(), you should walk from 1 .. CI->getNumOperands(). This handles varargs right and is simpler. -Chris > > + if (paramHasAttr(i, ParamAttr::ByVal)) > + return true; > + return false; > +} > + > void CallInst::setDoesNotThrow(bool doesNotThrow) { > const ParamAttrsList *PAL = getParamAttrs(); > if (doesNotThrow) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits