aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorBill Wendling <morbo@google.com>2024-11-27 17:42:32 +0000
committerGitHub <noreply@github.com>2024-11-27 17:42:32 +0000
commitb185b8512b2c7bf92ba87ea260a7b94d71dec4ee (patch)
treef3ea2263aa5667771e8bb996f30f7fa57cb37d2e /clang/lib/Sema/SemaStmt.cpp
parent991154d0fbc951e2b999589a95dabc7deff7acd1 (diff)
downloadllvm-b185b8512b2c7bf92ba87ea260a7b94d71dec4ee.zip
llvm-b185b8512b2c7bf92ba87ea260a7b94d71dec4ee.tar.gz
llvm-b185b8512b2c7bf92ba87ea260a7b94d71dec4ee.tar.bz2
[Clang] Improve Sema diagnostic performance for __builtin_counted_by_ref (#116719)
Implement the sema checks with a placeholder. We then check for that placeholder in all of the places we care to emit a diagnostic. Fixes: #115520
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index d6bc662..0e5c6cd 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -3778,6 +3778,8 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
<< FSI->getFirstCoroutineStmtKeyword();
}
+ CheckInvalidBuiltinCountedByRef(RetVal.get(), ReturnArgKind);
+
StmtResult R =
BuildReturnStmt(ReturnLoc, RetVal.get(), /*AllowRecovery=*/true);
if (R.isInvalid() || ExprEvalContexts.back().isDiscardedStatementContext())