blob: 4b42f669b2fd24b70f65412f810d61c62251016b [file] [log] [blame]
David Reiss9e7ba8c2010-10-05 16:39:27 +00001#include "t_type.h"
David Reiss41d30582010-10-05 16:39:29 +00002#include "t_typedef.h"
David Reiss9e7ba8c2010-10-05 16:39:27 +00003
4#include "md5.h"
Jens Geyer83767a72013-09-23 22:09:12 +02005#include "main.h"
David Reiss9e7ba8c2010-10-05 16:39:27 +00006
7void t_type::generate_fingerprint() {
Jens Geyer83767a72013-09-23 22:09:12 +02008 if (! has_fingerprint()) {
9 pdebug("generating fingerprint for %s", get_name().c_str());
10 std::string material = get_fingerprint_material();
11 md5_state_t ctx;
12 md5_init(&ctx);
13 md5_append(&ctx, (md5_byte_t*)(material.data()), (int)material.size());
14 md5_finish(&ctx, (md5_byte_t*)fingerprint_);
15 }
David Reiss9e7ba8c2010-10-05 16:39:27 +000016}
David Reiss41d30582010-10-05 16:39:29 +000017
18t_type* t_type::get_true_type() {
19 t_type* type = this;
20 while (type->is_typedef()) {
21 type = ((t_typedef*)type)->get_type();
22 }
23 return type;
24}