This is an archive of the discontinued LLVM Phabricator instance.

Make aliases from a raw command that isn't a top-level command work
ClosedPublic

Authored by jingham on Nov 8 2022, 12:25 PM.

Details

Summary

When we went to alias a raw command, we look up the command and pass that to HandleAliasingRawCommand. But then there is a check to make sure that we aren't using a nested alias, which we do by re-looking up the command object by name. Note, the command object's name is just its individual name, not the full path. That's appropriate for checking aliases since at present you can only alias TO a top-level command.

But if that lookup failed we return an error. That lookup will fail for anything that's not a top-level command, since this is just the node name not the path. So we should then look up the full command, but fortunately we don't have to do that because we already have the command passed in. So if it isn't an alias to be resolved, we can just use it directly.

I had to add enable_shared_from_this to CommandObject. We pass CommandObject *'s around in the command parsing code when we probably should be passing Shared Pointers, but trying to fix that ended up being a lot of change for not much benefit, and shared_from_this solves this neatly.

Diff Detail

Event Timeline

jingham created this revision.Nov 8 2022, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2022, 12:25 PM
jingham requested review of this revision.Nov 8 2022, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2022, 12:25 PM
clayborg accepted this revision.Nov 8 2022, 2:15 PM
This revision is now accepted and ready to land.Nov 8 2022, 2:15 PM
This revision was automatically updated to reflect the committed changes.