icecc / icecream

Distributed compiler with a central scheduler to share build load
GNU General Public License v2.0
1.58k stars 248 forks source link

Refactor the `Msg` class #601

Closed deriamis closed 1 year ago

deriamis commented 2 years ago

This is a refactor of the Msg class that gets rid of the need for MsgType, which was a separate, non-scoped enum. Having the non-scoped enum around meant we had bare identifiers everywhere. I'm using an "enhanced enum" here (the kind we used for SchedulerAlgorithmName) to do the refactor.

The benefits of the refactor are that we no longer need a separate variable to hold the enum value anymore because we can just use the object itself, and as a result it's a lot easier to output the actual name of the message in logs. In addition, having a scoped enum means the object is more self-container, and it will be easier to do other refactors.

deriamis commented 2 years ago

Sorry for the mess with all the forced pushes. I was working on something else entirely and realized too late I needed to split this out. The next PR will be a lot better.