static unsigned hash_type(const type_t *type) { unsigned hash = 0; switch (type->kind) { case TYPE_ERROR: return 0; case TYPE_IMAGINARY: case TYPE_COMPLEX: case TYPE_ATOMIC: hash = hash_atomic_type(&type->atomic); break; case TYPE_ENUM: hash = hash_enum_type(&type->enumt); break; case TYPE_COMPOUND_STRUCT: case TYPE_COMPOUND_UNION: hash = hash_compound_type(&type->compound); break; case TYPE_FUNCTION: hash = hash_function_type(&type->function); break; case TYPE_POINTER: hash = hash_pointer_type(&type->pointer); break; case TYPE_REFERENCE: hash = hash_reference_type(&type->reference); break; case TYPE_ARRAY: hash = hash_array_type(&type->array); break; case TYPE_TYPEDEF: hash = hash_ptr(type->typedeft.typedefe); break; case TYPE_TYPEOF: hash = hash_typeof_type(&type->typeoft); break; case TYPE_VOID: case TYPE_BUILTIN_TEMPLATE: break; } unsigned some_prime = 99991; hash ^= some_prime * type->base.qualifiers; return hash; }
std::size_t operator()(Function_type const& t) const { return hash_function_type(t); }