Here's an interesting paper describing semantic representation for C++
It seems like we might want something like this for our hir/code_model
In particular, this 2000 lines header describes the whole of C++ https://github.com/GabrielDosReis/ipr/blob/master/include/ipr/interface#L1
Our code model should look like this, at least in spirit.
I'm a little surprised that they can model the language in such an elegant way. I forget sometimes that C++ isn't as crazy as some people would like it to be.
The main trick is that the IR is just a data structure. Really, when you can say that things just immutably point to each other, you get a pretty nice API. That's fundamentally incompatible with lazyness though :(