memory management for assignment to record fields

This commit is contained in:
Vern Paxson 2021-02-27 06:11:01 -08:00
parent 498d8c4bde
commit 7adcd1b27b
4 changed files with 60 additions and 19 deletions

View file

@ -599,6 +599,11 @@ public:
const TypeDecl* FieldDecl(int field) const;
TypeDecl* FieldDecl(int field);
// Returns flags corresponding to which fields in the record
// have types requiring memory management (reference counting).
const std::vector<bool>& ManagedFields() const
{ return managed_fields; }
int NumFields() const { return num_fields; }
/**
@ -634,6 +639,12 @@ public:
protected:
RecordType() { types = nullptr; }
void AddField(unsigned int field, const TypeDecl* td);
// If we were willing to bound the size of records, then we could
// use std::bitset here instead.
std::vector<bool> managed_fields;
int num_fields;
type_decl_list* types;
};