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"
39template <
typename Key,
typename ElementLattice>
class MapLattice {
40 using Container = llvm::DenseMap<Key, ElementLattice>;
57 std::pair<iterator, bool>
58 insert(
const std::pair<const key_type, mapped_type> &
P) {
62 std::pair<iterator, bool>
insert(std::pair<const key_type, mapped_type> &&
P) {
63 return C.insert(std::move(
P));
66 unsigned size()
const {
return C.size(); }
67 bool empty()
const {
return C.empty(); }
78 return LHS.C == RHS.C;
97 for (
const auto &O :
Other.C) {
98 auto It = C.find(O.first);
111template <
typename ElementLattice>
114template <
typename Key,
typename ElementLattice>
118 std::string Separator;
120 for (
const auto &
E : M) {
121 Os << std::exchange(Separator,
", ") <<
E.first <<
" => " <<
E.second;
127template <
typename ElementLattice>
131 std::string Separator;
133 for (
const auto &
E : M) {
134 Os << std::exchange(Separator,
", ") <<
E.first->getName().str() <<
" => "
A lattice that maps keys to individual lattice elements.
typename Container::iterator iterator
bool contains(const key_type &K) const
mapped_type & operator[](const key_type &K)
const_iterator end() const
const_iterator find(const key_type &K) const
typename Container::const_iterator const_iterator
ElementLattice mapped_type
const_iterator begin() const
iterator find(const key_type &K)
friend bool operator!=(const MapLattice &LHS, const MapLattice &RHS)
std::pair< iterator, bool > insert(std::pair< const key_type, mapped_type > &&P)
std::pair< iterator, bool > insert(const std::pair< const key_type, mapped_type > &P)
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...
friend bool operator==(const MapLattice &LHS, const MapLattice &RHS)
static MapLattice bottom()
typename Container::value_type value_type
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, Atom A)
LatticeEffect
Effect indicating whether a lattice operation resulted in a new value.
The JSON file list parser is used to communicate input to InstallAPI.
@ Other
Other implicit parameter.