| 2150 | } |
| 2151 | |
| 2152 | TransformedFunction UCSan::getCustomFunctionType(FunctionType *T) { |
| 2153 | SmallVector<Type *, 4> ArgTypes; |
| 2154 | |
| 2155 | // Some parameters of the custom function being constructed are |
| 2156 | // parameters of T. Record the mapping from parameters of T to |
| 2157 | // parameters of the custom function, so that parameter attributes |
| 2158 | // at call sites can be updated. |
| 2159 | std::vector<unsigned> ArgumentIndexMapping; |
| 2160 | for (unsigned i = 0, ie = T->getNumParams(); i != ie; ++i) { |
| 2161 | Type* param_type = T->getParamType(i); |
| 2162 | ArgumentIndexMapping.push_back(ArgTypes.size()); |
| 2163 | ArgTypes.push_back(param_type); |
| 2164 | } |
| 2165 | for (unsigned i = 0, e = T->getNumParams(); i != e; ++i) |
| 2166 | ArgTypes.push_back(getShadowTy(T->getParamType(i))); |
| 2167 | if (T->isVarArg()) |
| 2168 | ArgTypes.push_back(PrimitiveShadowPtrTy); |
| 2169 | Type *RetType = T->getReturnType(); |
| 2170 | if (!RetType->isVoidTy()) |
| 2171 | ArgTypes.push_back(PointerType::getUnqual(getShadowTy(RetType))); |
| 2172 | return TransformedFunction( |
| 2173 | T, FunctionType::get(T->getReturnType(), ArgTypes, T->isVarArg()), |
| 2174 | ArgumentIndexMapping); |
| 2175 | } |
| 2176 | |
| 2177 | Value *UCSanFunction::checkPointer(Value *Ptr, Value *Size, bool dereference, |
| 2178 | IRBuilder<> &IRB, uint32_t TypeID) { |
no test coverage detected