11#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_UTILS_H
12#define LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_UTILS_H
14#include "llvm/ADT/ImmutableMap.h"
15#include "llvm/ADT/ImmutableSet.h"
21template <
typename Tag>
struct ID {
32 void Profile(llvm::FoldingSetNodeID &IDBuilder)
const {
33 IDBuilder.AddInteger(
Value);
41 llvm::ImmutableSet<T, llvm::ImutContainerInfo<T>,
false>;
43template <
typename KeyT,
typename ValT>
44using MapTy = llvm::ImmutableMap<KeyT, ValT, llvm::ImutKeyValueInfo<KeyT, ValT>,
50 return F.unionSets(A, B);
74template <
typename KeyT,
typename ValT,
typename Joiner>
78 if (A.getRootWithoutRetain() == B.getRootWithoutRetain())
81 if (A.getHeight() < B.getHeight())
85 auto Combine = [&JoinValues](
const ValueTy *AElem,
86 const ValueTy *BElem) -> std::pair<KeyT, ValT> {
87 const KeyT &Key = AElem ? AElem->first : BElem->first;
88 return std::pair<KeyT, ValT>(Key,
89 JoinValues(AElem ? &AElem->second :
nullptr,
90 BElem ? &BElem->second :
nullptr));
96 return F.mergeWith(A, B, Combine,
103template <
typename Tag>
104struct DenseMapInfo<
clang::lifetimes::internal::utils::ID<Tag>> {
108 return DenseMapInfo<uint32_t>::getHashValue(Val.
Value);
111 static bool isEqual(
const ID &LHS,
const ID &RHS) {
return LHS == RHS; }
llvm::ImmutableSet< T, llvm::ImutContainerInfo< T >, false > SetTy
The lifetime analyses do not benefit from canonicalizing their immutable collections,...
llvm::ImmutableMap< KeyT, ValT, llvm::ImutKeyValueInfo< KeyT, ValT >, false > MapTy
JoinKind
Describes the strategy for joining two ImmutableMap instances, primarily differing in how they handle...
@ Asymmetric
An asymmetric join preserves keys unique to the first map as-is, while applying the JoinValues operat...
@ Symmetric
A symmetric join applies the JoinValues operation to keys unique to either map, ensuring that values ...
SetTy< T > join(SetTy< T > A, SetTy< T > B, typename SetTy< T >::Factory &F)
Computes the union of two ImmutableSets.
The JSON file list parser is used to communicate input to InstallAPI.
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 uint32_t
A generic, type-safe wrapper for an ID, distinguished by its Tag type.
ID< Tag > operator++(int)
bool operator!=(const ID< Tag > &Other) const
void Profile(llvm::FoldingSetNodeID &IDBuilder) const
bool operator<(const ID< Tag > &Other) const
bool operator==(const ID< Tag > &Other) const
static bool isEqual(const ID &LHS, const ID &RHS)
clang::lifetimes::internal::utils::ID< Tag > ID
static unsigned getHashValue(const ID &Val)