if (!E->isArray())
return 0;
+ // No cookie is required if the new operator being used is
+ // ::operator new[](size_t, void*).
+ const FunctionDecl *OperatorNew = E->getOperatorNew();
+ if (OperatorNew->getDeclContext()->getLookupContext()->isFileContext()) {
+ if (OperatorNew->getNumParams() == 2) {
+ CanQualType ParamType =
+ Ctx.getCanonicalType(OperatorNew->getParamDecl(1)->getType());
+
+ if (ParamType == Ctx.VoidPtrTy)
+ return 0;
+ }
+ }
+
return CalculateCookiePadding(Ctx, E->getAllocatedType());
QualType T = E->getAllocatedType();
}
return NewPtr;
}
-
static std::pair<llvm::Value *, llvm::Value *>
GetAllocatedObjectPtrAndNumElements(CodeGenFunction &CGF,
llvm::Value *Ptr, QualType DeleteTy) {