================
@@ -610,6 +610,33 @@ static RValue emitNewDeleteCall(CIRGenFunction &cgf,
return rv;
}
+RValue CIRGenFunction::emitNewOrDeleteBuiltinCall(const FunctionProtoType
*type,
+ const CallExpr *callExpr,
+ bool isDelete) {
+ CallArgList args;
+ emitCallArgs(args, type, callExpr->arguments());
+ // Find the allocation or deallocation function that we're calling.
+ ASTContext &astContext = getContext();
+ DeclarationName name = astContext.DeclarationNames.getCXXOperatorName(
+ isDelete ? OO_Delete : OO_New);
+
+ clang::DeclContextLookupResult lookupResult =
+ astContext.getTranslationUnitDecl()->lookup(name);
+ for (const auto *decl : lookupResult) {
+ if (const auto *funcDecl = dyn_cast<FunctionDecl>(decl)) {
+ if (astContext.hasSameType(funcDecl->getType(), QualType(type, 0))) {
+ // Used for -fsanitize=alloc-token
+ assert(!cir::MissingFeatures::allocToken());
----------------
bcardosolopes wrote:
This should be wrapped in a check like:
```
if (SanOpts.has(SanitizerKind::AllocToken)) {
// Set !alloc_token metadata.
assert(!cir::MissingFeatures::allocToken());
errorNYI(...)
}
```
If someone is using `-fsanitize=alloc-token` we should error, silent passing
here could be super misleading. Note that some existing sanitizer checks we are
not currently leading to errorNYI, so this isn't a strict rule necessarily, but
it involving extra allocations and builtins justify the importance here IMO
https://github.com/llvm/llvm-project/pull/168578
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits