llvm/compiler-rt/lib/sanitizer_common/sanitizer_dense_map_info.h

//===- sanitizer_dense_map_info.h - Type traits for DenseMap ----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef SANITIZER_DENSE_MAP_INFO_H
#define SANITIZER_DENSE_MAP_INFO_H

#include "sanitizer_common.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_type_traits.h"

namespace __sanitizer {

namespace detail {

/// Simplistic combination of 32-bit hash values into 32-bit hash values.
static constexpr unsigned combineHashValue(unsigned a, unsigned b) {}

// We extend a pair to allow users to override the bucket type with their own
// implementation without requiring two members.
template <typename KeyT, typename ValueT>
struct DenseMapPair {};

}  // end namespace detail

template <typename T>
struct DenseMapInfo {};

// Provide DenseMapInfo for all pointers. Come up with sentinel pointer values
// that are aligned to alignof(T) bytes, but try to avoid requiring T to be
// complete. This allows clients to instantiate DenseMap<T*, ...> with forward
// declared key types. Assume that no pointer key type requires more than 4096
// bytes of alignment.
DenseMapInfo<T *>;

// Provide DenseMapInfo for chars.
template <>
struct DenseMapInfo<char> {};

// Provide DenseMapInfo for unsigned chars.
template <>
struct DenseMapInfo<unsigned char> {};

// Provide DenseMapInfo for unsigned shorts.
template <>
struct DenseMapInfo<unsigned short> {};

// Provide DenseMapInfo for unsigned ints.
template <>
struct DenseMapInfo<unsigned> {};

// Provide DenseMapInfo for unsigned longs.
template <>
struct DenseMapInfo<unsigned long> {};

// Provide DenseMapInfo for unsigned long longs.
template <>
struct DenseMapInfo<unsigned long long> {};

// Provide DenseMapInfo for shorts.
template <>
struct DenseMapInfo<short> {};

// Provide DenseMapInfo for ints.
template <>
struct DenseMapInfo<int> {};

// Provide DenseMapInfo for longs.
template <>
struct DenseMapInfo<long> {};

// Provide DenseMapInfo for long longs.
template <>
struct DenseMapInfo<long long> {};

// Provide DenseMapInfo for all pairs whose members have info.
DenseMapInfo<detail::DenseMapPair<T, U>>;

}  // namespace __sanitizer

#endif  // SANITIZER_DENSE_MAP_INFO_H