diff --git a/src/Type.cc b/src/Type.cc index 97fb94ea03..3dd649167b 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -850,6 +850,8 @@ RecordType::RecordType(type_decl_list* arg_types) : Type(TYPE_RECORD) } else num_fields = 0; + + num_orig_fields = num_fields; } // in this case the clone is actually not so shallow, since diff --git a/src/Type.h b/src/Type.h index 5a16463263..bbcd00f7a5 100644 --- a/src/Type.h +++ b/src/Type.h @@ -611,6 +611,7 @@ public: { return managed_fields; } int NumFields() const { return num_fields; } + int NumOrigFields() const { return num_orig_fields; } /** * Returns a "record_field_table" value for introspection purposes. @@ -654,7 +655,12 @@ protected: // use std::bitset here instead. std::vector managed_fields; + // Number of fields in the type. int num_fields; + + // Number of fields in the type when originally declared. + int num_orig_fields; + type_decl_list* types; };