#ifndef COMPILER_TRANSLATOR_COMMON_H_
#define COMPILER_TRANSLATOR_COMMON_H_
#include <stdio.h>
#include <limits>
#include <map>
#include <sstream>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "common/angleutils.h"
#include "common/debug.h"
#include "compiler/translator/PoolAlloc.h"
namespace sh
{
struct TSourceLoc
{ … };
constexpr TSourceLoc kNoSourceLoc{ … };
#define POOL_ALLOCATOR_NEW_DELETE …
TStringAllocator;
TString;
TStringStream;
TPersistString;
TPersistStringStream;
template <class T>
class TVector : public std::vector<T, pool_allocator<T>>
{ … };
template <class K, class D, class H = std::hash<K>, class CMP = std::equal_to<K>>
class TUnorderedMap : public std::unordered_map<K, D, H, CMP, pool_allocator<std::pair<const K, D>>>
{
public:
POOL_ALLOCATOR_NEW_DELETE
typedef pool_allocator<std::pair<const K, D>> tAllocator;
TUnorderedMap() : … { … }
TUnorderedMap(const tAllocator &a)
: … { … }
};
template <class K, class H = std::hash<K>, class CMP = std::equal_to<K>>
class TUnorderedSet : public std::unordered_set<K, H, CMP, pool_allocator<K>>
{
public:
POOL_ALLOCATOR_NEW_DELETE
typedef pool_allocator<K> tAllocator;
TUnorderedSet() : … { … }
TUnorderedSet(const tAllocator &a)
: … { … }
};
template <class K, class D, class CMP = std::less<K>>
class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<const K, D>>>
{
public:
POOL_ALLOCATOR_NEW_DELETE
typedef pool_allocator<std::pair<const K, D>> tAllocator;
TMap() : … { … }
TMap(const tAllocator &a)
: … { … }
};
template <typename T>
class TSpan
{ … };
template <typename T>
inline TString str(T i)
{ … }
inline const char *AllocatePoolCharArray(const char *str, size_t strLength)
{ … }
template <typename T>
T InitializeStream()
{ … }
}
namespace std
{
template <>
struct hash<sh::TString>
{ … };
}
#endif