[Lldb-commits] [clang] [lldb] [Clang] Improve Sema diagnostic performance for __builtin_counted_by_ref (PR #116719)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 19 18:46:14 PST 2024
================
@@ -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
More information about the lldb-commits
mailing list