[clang-tools-extra] [clang-tidy] Add deprecated-posix-functions check (PR #195641)

Daniil Dudkin via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 05:55:06 PDT 2026


================
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_DEPRECATEDPOSIXFUNCTIONSCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_DEPRECATEDPOSIXFUNCTIONSCHECK_H
+
+#include "../ClangTidyCheck.h"
+
+namespace clang::tidy::portability {
+
+/// Finds uses of deprecated or obsolete POSIX functions and suggests modern
+/// replacements.
+///
+/// For the user-facing documentation see:
+/// https://clang.llvm.org/extra/clang-tidy/checks/portability/deprecated-posix-functions.html
+class DeprecatedPosixFunctionsCheck : public ClangTidyCheck {
+public:
+  DeprecatedPosixFunctionsCheck(StringRef Name, ClangTidyContext *Context)
+      : ClangTidyCheck(Name, Context) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+};
----------------
unterumarmung wrote:

Should `TK_IgnoreUnlessSpelledInSource` be used?

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


More information about the cfe-commits mailing list