clang-tools 22.0.0git
RawMemoryCallOnNonTrivialTypeCheck.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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_BUGPRONE_RAWMEMORYCALLONNONTRIVIALTYPECHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_RAWMEMORYCALLONNONTRIVIALTYPECHECK_H
11
12#include "../ClangTidyCheck.h"
13
14namespace clang::tidy::bugprone {
15
16/// Flags use of the C standard library functions 'memset', 'memcpy' and
17/// 'memcmp' and similar derivatives on non-trivial types.
18///
19/// For the user-facing documentation see:
20/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/raw-memory-call-on-non-trivial-type.html
22public:
24 bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
25 return LangOpts.CPlusPlus && !LangOpts.ObjC;
26 }
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
31private:
32 const StringRef MemSetNames;
33 const StringRef MemCpyNames;
34 const StringRef MemCmpNames;
35};
36
37} // namespace clang::tidy::bugprone
38
39#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_RAWMEMORYCALLONNONTRIVIALTYPECHECK_H
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
llvm::StringMap< ClangTidyValue > OptionMap