31#include "llvm/ADT/StringRef.h"
46 void HandleTranslationUnit(ASTContext &Ctx)
override;
48 std::unique_ptr<OperatorNewDeletePointersEntitySummary>
49 extractEntitySummary(
const std::vector<const NamedDecl *> &Decls);
52void OperatorNewDeletePointersExtractor::HandleTranslationUnit(
55 *
this, SummaryBuilder, Ctx,
56 [&](
const std::vector<const NamedDecl *> &Decls) {
57 return extractEntitySummary(Decls);
62std::unique_ptr<OperatorNewDeletePointersEntitySummary>
63OperatorNewDeletePointersExtractor::extractEntitySummary(
64 const std::vector<const NamedDecl *> &ContributorDecls) {
65 auto Summary = std::make_unique<OperatorNewDeletePointersEntitySummary>();
66 auto Matcher = [&Summary,
this](
const DynTypedNode &Node) {
67 const auto *FD = Node.get<FunctionDecl>();
78 if (
auto Id = addEntityForReturn(FD))
79 Summary->Entities.insert(*Id);
86 if (
auto Id = addEntity(FD->getParamDecl(0)))
87 Summary->Entities.insert(*Id);
97 if (
auto Id = addEntity(FD->getParamDecl(1)))
98 Summary->Entities.insert(*Id);
102 for (
const NamedDecl *Decl : ContributorDecls)
109namespace clang::ssaf {
114static TUSummaryExtractorRegistry::Add<OperatorNewDeletePointersExtractor>
117 "Extract pointer entities in operator new/delete overloads that must "
118 "have a 'void*' type");
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines an enumeration for C++ overloaded operators.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
DynTypedNode DynTypedNode
void extractAndAddSummaries(TUSummaryExtractor &Extractor, TUSummaryBuilder &Builder, ASTContext &Ctx, ExtractorFnT ExtractFn, llvm::StringRef ExtractorName="")
The standard contributor-summary extraction procedure:
bool hasPtrOrArrType(const Expr *E)
void findMatchesIn(const NamedDecl *Contributor, llvm::function_ref< void(const DynTypedNode &)> MatchActionRef)
Perform "MatchAction" on each Stmt and Decl belonging to the Contributor.
volatile int OperatorNewDeletePointersExtractorAnchorSource
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static constexpr llvm::StringLiteral Name