Go to the documentation of this file.
15 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE__MAPLATTICE_H
16 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE__MAPLATTICE_H
25 #include "llvm/ADT/DenseMap.h"
26 #include "llvm/ADT/StringRef.h"
39 template <
typename Key,
typename ElementLattice>
class MapLattice {
40 using Container = llvm::DenseMap<Key, ElementLattice>;
57 void insert(
const std::pair<const key_type, mapped_type> &
P) { C.insert(
P); }
59 void insert(std::pair<const key_type, mapped_type> &&
P) {
60 C.insert(std::move(
P));
63 unsigned size()
const {
return C.size(); }
64 bool empty()
const {
return C.empty(); }
75 return LHS.C == RHS.C;
94 for (
const auto &O : Other.C) {
95 auto It = C.find(O.first);
108 template <
typename ElementLattice>
111 template <
typename Key,
typename ElementLattice>
117 for (
const auto &E : M) {
118 Os << std::exchange(Separator,
", ") << E.first <<
" => " << E.second;
124 template <
typename ElementLattice>
130 for (
const auto &E : M) {
131 Os << std::exchange(Separator,
", ") << E.first->getName().str() <<
" => "
140 #endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE__MAPLATTICE_H
typename Container::value_type value_type
const_iterator end() const
void insert(const std::pair< const key_type, mapped_type > &P)
std::ostream & operator<<(std::ostream &Os, const clang::dataflow::MapLattice< Key, ElementLattice > &M)
const_iterator begin() const
bool contains(const key_type &K) const
LatticeJoinEffect
Effect indicating whether a lattice join operation resulted in a new value.
typename Container::iterator iterator
LatticeJoinEffect join(const MapLattice &Other)
If an entry exists in one map but not the other, the missing entry is treated as implicitly mapping t...
static MapLattice bottom()
typename Container::const_iterator const_iterator
ElementLattice mapped_type
friend bool operator==(const MapLattice &LHS, const MapLattice &RHS)
iterator find(const key_type &K)
const_iterator find(const key_type &K) const
A lattice that maps keys to individual lattice elements.
void insert(std::pair< const key_type, mapped_type > &&P)
mapped_type & operator[](const key_type &K)
friend bool operator!=(const MapLattice &LHS, const MapLattice &RHS)