[clang] [-Wunsafe-buffer-usage] Ignore consteval functions (PR #171503)

Florian Mayer via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 10 10:52:22 PST 2025


================
@@ -4458,6 +4458,11 @@ void clang::checkUnsafeBufferUsage(const Decl *D,
   SmallVector<Stmt *> Stmts;
 
   if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
+    // Consteval functions are free of UB by the spec, so we don't need to
+    // visit them or produce diagnostics.
+    if (FD->isConsteval()) {
----------------
fmayer wrote:

drop `{}`

https://github.com/llvm/llvm-project/pull/171503


More information about the cfe-commits mailing list