It turns out all existing callers of GetChildMemberWithName pass true for can_create.
This change makes true the default value, callers don't have to pass an opaque true.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
If every caller sets this to true, why not remove the argument altogether? It looks like ValueObjectRegister::GetChildMemberWithName doesn't use the argument, ValueObject::GetChildMemberWithName and ValueObjectSynthetic::GetChildMemberWithName just pass it along to GetChildAtIndex.
That's an option too, which I considered. I went with this as a more
conservative change. If there's agreement to remove it then I can change it.
correction: there's still an overload of GetChildAtNamePath, which takes a can_create value and passes it through to GetChildMemberWithName. However that function isn't used, and could be deleted. To delete the parameter, that overload of GetChildMemberWithName would need to be deleted too. In general, I'm still in favor of the conservative choice of giving it a default. Deleting it altogether is an easy follow up, if so desired.
To expand the conversation, I have also opened D152031 which makes the same change to GetChildAtIndex.
It's OK to retain this as the default, and as you say, taking it out would be a trivial patch after this work. The control does allow you to do "Have I already made this child" before setting about to make it, though I can't currently see anywhere where we could use this information.
I'm alright with this if Jim is. I think we should remove this parameter since it's never set to anything other than true from what I understand, but that can be done in a follow-up.