File indexing completed on 2026-05-10 08:36:19
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_NOT_NULL_TERMINATED_RESULT_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_NOT_NULL_TERMINATED_RESULT_H
0011
0012 #include "../ClangTidyCheck.h"
0013
0014 namespace clang::tidy::bugprone {
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 class NotNullTerminatedResultCheck : public ClangTidyCheck {
0025 public:
0026 NotNullTerminatedResultCheck(StringRef Name, ClangTidyContext *Context);
0027 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
0028 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
0029 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
0030 void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
0031 Preprocessor *ModuleExpanderPP) override;
0032
0033 private:
0034
0035
0036
0037 const bool WantToUseSafeFunctions;
0038
0039 bool UseSafeFunctions = false;
0040
0041 void memoryHandlerFunctionFix(
0042 StringRef Name, const ast_matchers::MatchFinder::MatchResult &Result);
0043 void memcpyFix(StringRef Name,
0044 const ast_matchers::MatchFinder::MatchResult &Result,
0045 DiagnosticBuilder &Diag);
0046 void memcpy_sFix(StringRef Name,
0047 const ast_matchers::MatchFinder::MatchResult &Result,
0048 DiagnosticBuilder &Diag);
0049 void memchrFix(StringRef Name,
0050 const ast_matchers::MatchFinder::MatchResult &Result);
0051 void memmoveFix(StringRef Name,
0052 const ast_matchers::MatchFinder::MatchResult &Result,
0053 DiagnosticBuilder &Diag) const;
0054 void strerror_sFix(const ast_matchers::MatchFinder::MatchResult &Result);
0055 void ncmpFix(StringRef Name,
0056 const ast_matchers::MatchFinder::MatchResult &Result);
0057 void xfrmFix(StringRef Name,
0058 const ast_matchers::MatchFinder::MatchResult &Result);
0059 };
0060
0061 }
0062
0063 #endif