clang 23.0.0git
UnsafeBufferUsage.h
Go to the documentation of this file.
1//===- UnsafeBufferUsage.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#ifndef LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_ANALYSES_UNSAFEBUFFERUSAGE_UNSAFEBUFFERUSAGE_H
10#define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_ANALYSES_UNSAFEBUFFERUSAGE_UNSAFEBUFFERUSAGE_H
11
15
16namespace clang::ssaf {
17/// An UnsafeBufferUsageEntitySummary contains a set of EntityPointerLevels
18/// extracted from unsafe buffer pointers contributed by an entity.
19class UnsafeBufferUsageEntitySummary final : public EntitySummary {
20 const EntityPointerLevelSet UnsafeBuffers;
21
23 friend UnsafeBufferUsageEntitySummary
25 friend llvm::iterator_range<EntityPointerLevelSet::const_iterator>
26 getUnsafeBuffers(const UnsafeBufferUsageEntitySummary &);
27
28 explicit UnsafeBufferUsageEntitySummary(EntityPointerLevelSet UnsafeBuffers)
29 : EntitySummary(), UnsafeBuffers(std::move(UnsafeBuffers)) {}
30
31public:
32 static constexpr llvm::StringLiteral Name = "UnsafeBufferUsage";
33
34 SummaryName getSummaryName() const override { return summaryName(); };
35
36 bool operator==(const EntityPointerLevelSet &Other) const {
37 return UnsafeBuffers == Other;
38 }
39
40 bool operator==(const UnsafeBufferUsageEntitySummary &Other) const {
41 return UnsafeBuffers == Other.UnsafeBuffers;
42 }
43
44 bool empty() const { return UnsafeBuffers.empty(); }
45
46 static SummaryName summaryName() { return SummaryName{Name.str()}; }
47};
48} // namespace clang::ssaf
49
50#endif // LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_ANALYSES_UNSAFEBUFFERUSAGE_UNSAFEBUFFERUSAGE_H
Base class for analysis-specific summary data.
Uniquely identifies an analysis summary.
Definition SummaryName.h:22
static constexpr llvm::StringLiteral Name
friend llvm::iterator_range< EntityPointerLevelSet::const_iterator > getUnsafeBuffers(const UnsafeBufferUsageEntitySummary &)
SummaryName getSummaryName() const override
friend UnsafeBufferUsageEntitySummary buildUnsafeBufferUsageEntitySummary(EntityPointerLevelSet)
bool operator==(const EntityPointerLevelSet &Other) const
bool operator==(const UnsafeBufferUsageEntitySummary &Other) const
@ Other
Other implicit parameter.
Definition Decl.h:1763