[clang-tools-extra] [clang-tidy] Add bugprone-setvbuf-stack-buffer check (PR #187637)
Zeyi Xu via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 21 01:15:56 PDT 2026
================
@@ -0,0 +1,57 @@
+// RUN: %check_clang_tidy %s bugprone-setvbuf-stack-buffer %t
+
+typedef unsigned long size_t;
+typedef struct FILE FILE;
+extern FILE *stdin;
+
+int setvbuf(FILE *stream, char *buf, int mode, size_t size);
+void *malloc(size_t size);
+void *calloc(size_t count, size_t size);
+
+#define _IOFBF 0
+#define _IOLBF 1
+#define _IONBF 2
+#define BUFSIZ 1024
+
+// Test 1: Stack buffer — should warn.
----------------
zeyi2 wrote:
Nit: Could we use ASCII hypens (`-`) instead of UTF-8 em-dash? Same as below.
https://github.com/llvm/llvm-project/pull/187637
More information about the cfe-commits
mailing list