| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_NOT_NULL_TERMINATED_RESULT_H |
| 10 |
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_NOT_NULL_TERMINATED_RESULT_H |
| 11 |
|
| 12 |
#include "../ClangTidyCheck.h" |
| 13 |
|
| 14 |
namespace clang::tidy::bugprone { |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
class NotNullTerminatedResultCheck : public ClangTidyCheck { |
| 25 |
public: |
| 26 |
NotNullTerminatedResultCheck(StringRef Name, ClangTidyContext *Context); |
| 27 |
void storeOptions(ClangTidyOptions::OptionMap &Opts) override; |
| 28 |
void registerMatchers(ast_matchers::MatchFinder *Finder) override; |
| 29 |
void check(const ast_matchers::MatchFinder::MatchResult &Result) override; |
| 30 |
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, |
| 31 |
Preprocessor *ModuleExpanderPP) override; |
| 32 |
|
| 33 |
private: |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
const bool WantToUseSafeFunctions; |
| 38 |
|
| 39 |
bool UseSafeFunctions = false; |
| 40 |
|
| 41 |
void memoryHandlerFunctionFix( |
| 42 |
StringRef Name, const ast_matchers::MatchFinder::MatchResult &Result); |
| 43 |
void memcpyFix(StringRef Name, |
| 44 |
const ast_matchers::MatchFinder::MatchResult &Result, |
| 45 |
DiagnosticBuilder &Diag); |
| 46 |
void memcpy_sFix(StringRef Name, |
| 47 |
const ast_matchers::MatchFinder::MatchResult &Result, |
| 48 |
DiagnosticBuilder &Diag); |
| 49 |
void memchrFix(StringRef Name, |
| 50 |
const ast_matchers::MatchFinder::MatchResult &Result); |
| 51 |
void memmoveFix(StringRef Name, |
| 52 |
const ast_matchers::MatchFinder::MatchResult &Result, |
| 53 |
DiagnosticBuilder &Diag); |
| 54 |
void strerror_sFix(const ast_matchers::MatchFinder::MatchResult &Result); |
| 55 |
void ncmpFix(StringRef Name, |
| 56 |
const ast_matchers::MatchFinder::MatchResult &Result); |
| 57 |
void xfrmFix(StringRef Name, |
| 58 |
const ast_matchers::MatchFinder::MatchResult &Result); |
| 59 |
}; |
| 60 |
|
| 61 |
} |
| 62 |
|
| 63 |
#endif |