1 | //===--- DeprecatedHeadersCheck.h - clang-tidy-------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_C_HEADERS_TO_CXX_H |
10 | #define |
11 | |
12 | #include "../ClangTidyCheck.h" |
13 | |
14 | namespace clang::tidy::modernize { |
15 | |
16 | /// This check replaces deprecated C library headers with their C++ STL |
17 | /// alternatives. |
18 | /// |
19 | /// Before: |
20 | /// ~~~{.cpp} |
21 | /// #include <header.h> |
22 | /// ~~~ |
23 | /// |
24 | /// After: |
25 | /// ~~~{.cpp} |
26 | /// #include <cheader> |
27 | /// ~~~ |
28 | /// |
29 | /// Example: ``<stdio.h> => <cstdio>`` |
30 | /// |
31 | /// For the user-facing documentation see: |
32 | /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/deprecated-headers.html |
33 | class : public ClangTidyCheck { |
34 | public: |
35 | (StringRef Name, ClangTidyContext *Context); |
36 | bool (const LangOptions &LangOpts) const override { |
37 | return LangOpts.CPlusPlus; |
38 | } |
39 | void (ClangTidyOptions::OptionMap &Opts) override; |
40 | void (const SourceManager &SM, Preprocessor *PP, |
41 | Preprocessor *ModuleExpanderPP) override; |
42 | void (ast_matchers::MatchFinder *Finder) override; |
43 | void () override; |
44 | void (const ast_matchers::MatchFinder::MatchResult &Result) override; |
45 | |
46 | struct { |
47 | std::string ; |
48 | StringRef ; |
49 | SourceRange ; |
50 | SourceLocation ; |
51 | }; |
52 | |
53 | private: |
54 | std::vector<IncludeMarker> ; |
55 | bool ; |
56 | }; |
57 | |
58 | } // namespace clang::tidy::modernize |
59 | |
60 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_C_HEADERS_TO_CXX_H |
61 | |