DIEAbbrev &DIEAbbrevSet::uniqueAbbreviation(DIE &Die) { FoldingSetNodeID ID; DIEAbbrev Abbrev = Die.generateAbbrev(); Abbrev.Profile(ID); void *InsertPos; if (DIEAbbrev *Existing = AbbreviationsSet.FindNodeOrInsertPos(ID, InsertPos)) { Die.setAbbrevNumber(Existing->getNumber()); return *Existing; } // Move the abbreviation to the heap and assign a number. DIEAbbrev *New = new (Alloc) DIEAbbrev(std::move(Abbrev)); Abbreviations.push_back(New); New->setNumber(Abbreviations.size()); Die.setAbbrevNumber(Abbreviations.size()); // Store it for lookup. AbbreviationsSet.InsertNode(New, InsertPos); return *New; }