carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
http://docs.carbon-lang.dev/
Other
32.24k stars 1.48k forks source link

Refactor whether a function is lowered into InstKind::Define #4117

Closed jonmeow closed 2 months ago

jonmeow commented 2 months ago

This is to remove all the FatalIfEncountered handlers in handle.cpp. They just feel like noise when reading the file. Plus it's one less bit of boilerplate to add for instructions that don't lower.

Note that I left HandleParam/HandleAddrPattern. I'd be happy to change those to just set lowered=false too, but was hesitant to given the separate logic.

Also, I'm separately considering migrating the macro logic into similar constexpr things. If I do, I might switch Define to take in a struct. But for how this particular parameter works, the overload felt reasonable, particularly since is_lowered is not used in combination with TerminatorKind.