9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_OWNING_MEMORY_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_OWNING_MEMORY_H
12#include "../ClangTidyCheck.h"
25 LegacyResourceProducers(
Options.get(
26 "LegacyResourceProducers",
"::malloc;::aligned_alloc;::realloc;"
27 "::calloc;::fopen;::freopen;::tmpfile")),
28 LegacyResourceConsumers(
Options.get(
29 "LegacyResourceConsumers",
"::free;::realloc;::freopen;::fclose")) {
32 return LangOpts.CPlusPlus11;
39 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
41 return TK_IgnoreUnlessSpelledInSource;
45 bool handleDeletion(
const ast_matchers::BoundNodes &Nodes);
46 bool handleLegacyConsumers(
const ast_matchers::BoundNodes &Nodes);
47 bool handleExpectedOwner(
const ast_matchers::BoundNodes &Nodes);
48 bool handleAssignmentAndInit(
const ast_matchers::BoundNodes &Nodes);
49 bool handleAssignmentFromNewOwner(
const ast_matchers::BoundNodes &Nodes);
50 bool handleReturnValues(
const ast_matchers::BoundNodes &Nodes);
51 bool handleOwnerMembers(
const ast_matchers::BoundNodes &Nodes);
56 const StringRef LegacyResourceProducers;
59 const StringRef LegacyResourceConsumers;
llvm::SmallString< 256U > Name
Base class for all clang-tidy checks.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Checks for common use cases for gsl::owner and enforces the unique owner nature of it whenever possib...
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Make configuration of checker discoverable.
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
std::optional< TraversalKind > getCheckTraversalKind() const override
OwningMemoryCheck(StringRef Name, ClangTidyContext *Context)
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Match common cases, where the owner semantic is relevant, like function calls, delete expressions and...
llvm::StringMap< ClangTidyValue > OptionMap