As discussed in D73206 there is both DIERef and user_id_t and sometimes (for DWZ) we need to encode Main CU into them and sometimes we cannot as it is unavailable at that point and at the same time not even needed.
I have also noticed DIERef and user_id_t in fact contain the same information which can be seen in SymbolFileDWARF::GetUID.
(Offtopic: Moreover UserID is also another form of user_id_t.)
SB* API/ABI is already using user_id_t and it needs to encode Main CU for DWZ. Therefore what about making DIERef the identifier not containing Main CU and user_id_t the identifier containing Main CU?
@labath also said:
I think it would be good to have only one kind of "user id". What are the cases where you need a main-cu-less user id?
This patch does that in a small scale, is it the proper way forward?
(Personally I think the non-MainCU and plus-MainCU forms should be the same, either both user_id_t or both DIERef - and to drop the other form completely - but that can be always easily refactored any time.)