================ @@ -6205,10 +6212,24 @@ bool Sema::CheckArgsForPlaceholders(MultiExprArg args) { for (size_t i = 0, e = args.size(); i != e; i++) { if (isPlaceholderToRemoveAsArg(args[i]->getType())) { ExprResult result = CheckPlaceholderExpr(args[i]); - if (result.isInvalid()) hasInvalid = true; - else args[i] = result.get(); + if (result.isInvalid()) + hasInvalid = true; + else + args[i] = result.get(); + } + + // The result of __builtin_counted_by_ref cannot be used as a function + // argument. It allows leaking and modification of bounds safety + // information. + if (const auto *CE = dyn_cast<CallExpr>(args[i]); + CE && CE->getBuiltinCallee() == Builtin::BI__builtin_counted_by_ref) { + hasInvalid = true; + Diag(CE->getExprLoc(), + diag::err_builtin_counted_by_ref_cannot_leak_reference) + << CE->getSourceRange(); ---------------- Sirraide wrote:
This probably shouldn’t be here anymore if there are no placeholder types involved anymore. https://github.com/llvm/llvm-project/pull/116719 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits