clang 23.0.0git
OperatorNewDeletePointers.h
Go to the documentation of this file.
1//===- OperatorNewDeletePointers.h ------------------------------*- C++ -*-===//
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// Declares data structures for analysis that identifies pointer entities in
10// operator new/delete overloads that must have a 'void*' type
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_OPERATORNEWDELETE_OPERATORNEWDELETEPOINTERS_H
15#define LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_OPERATORNEWDELETE_OPERATORNEWDELETEPOINTERS_H
16
20#include "llvm/ADT/StringRef.h"
21#include <set>
22
23namespace clang::ssaf {
24
25/// \brief Collects specific pointer entities related to operator new and delete
26/// overloads within a contributor.
27///
28/// OperatorNewDeletePointersEntitySummary collects the following entities:
29/// -# The returned entities of `operator new` overloads.
30/// -# The parameter (optionally the second) of `operator new` overloads
31/// representing the pointer to a memory area at which to initialize the
32/// object.
33/// -# The first parameter of `operator delete` overloads representing the
34/// pointer
35/// to a memory block to deallocate (or a null pointer).
36/// -# The parameter (optionally the second) of `operator delete` overloads
37/// representing the pointer used as the placement parameter in the matching
38/// placement `new`.
40 static constexpr llvm::StringLiteral Name = "OperatorNewDeletePointers";
41
42 static SummaryName summaryName() { return SummaryName(Name.str()); }
43
44 SummaryName getSummaryName() const override { return summaryName(); }
45
48 return This.Entities == Other.Entities;
49 }
50
51 bool operator==(const std::set<EntityId> &OtherEntities) const {
52 return Entities == OtherEntities;
53 }
54
55 bool empty() const { return Entities.empty(); }
56
57 std::set<EntityId> Entities;
58};
59
60} // namespace clang::ssaf
61
62#endif // LLVM_CLANG_SCALABLESTATICANALYSIS_ANALYSES_OPERATORNEWDELETE_OPERATORNEWDELETEPOINTERS_H
a trap message and trap category.
Base class for analysis-specific summary data.
Uniquely identifies an analysis summary.
Definition SummaryName.h:22
@ Other
Other implicit parameter.
Definition Decl.h:1772
Collects specific pointer entities related to operator new and delete overloads within a contributor.
bool operator==(const std::set< EntityId > &OtherEntities) const
bool friend operator==(const OperatorNewDeletePointersEntitySummary &This, const OperatorNewDeletePointersEntitySummary &Other)