[clang-tools-extra] [clang-tidy] Add bugprone-setvbuf-stack-buffer check (PR #187637)

Mats Kindahl via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 22 05:07:00 PDT 2026


================
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "SetvbufStackBufferCheck.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::bugprone {
+
+void SetvbufStackBufferCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+      callExpr(callee(functionDecl(hasAnyName("setvbuf", "::std::setvbuf"))))
----------------
mkindahl wrote:

Yes, it does. Added a check for that.

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


More information about the cfe-commits mailing list