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#include "llvm/ADT/StringRef.h"
16#include "llvm/ADT/iterator_range.h"
17#include <set>
18
19namespace clang::ssaf {
20
21/// An UnsafeBufferUsageEntitySummary is an immutable set of unsafe buffers, in
22/// the form of EntityPointerLevel.
23class UnsafeBufferUsageEntitySummary final : public EntitySummary {
24 const EntityPointerLevelSet UnsafeBuffers;
25
27 friend UnsafeBufferUsageEntitySummary
29 friend llvm::iterator_range<EntityPointerLevelSet::const_iterator>
30 getUnsafeBuffers(const UnsafeBufferUsageEntitySummary &);
31
32 UnsafeBufferUsageEntitySummary(EntityPointerLevelSet UnsafeBuffers)
33 : EntitySummary(), UnsafeBuffers(std::move(UnsafeBuffers)) {}
34
35public:
36 static constexpr llvm::StringLiteral Name = "UnsafeBufferUsage";
37
38 SummaryName getSummaryName() const override { return summaryName(); };
39
40 bool operator==(const EntityPointerLevelSet &Other) const {
41 return UnsafeBuffers == Other;
42 }
43
44 bool operator==(const UnsafeBufferUsageEntitySummary &Other) const {
45 return UnsafeBuffers == Other.UnsafeBuffers;
46 }
47
48 bool empty() const { return UnsafeBuffers.empty(); }
49
50 static SummaryName summaryName() { return SummaryName{Name.str()}; }
51};
52} // namespace clang::ssaf
53
54#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:1761