GabrielDosReis / ipr

Compiler-neutral Internal Program Representation for C++
BSD 3-Clause "New" or "Revised" License
222 stars 23 forks source link

Add `ipr::Phased_evaluation` #273

Closed GabrielDosReis closed 2 years ago

GabrielDosReis commented 2 years ago

Both asm-declaration and static_assert-declaration are now uniformly represented as phased evaluation of the generalized expressions ipr::Asm and ipr::Static_assert.

This unified description comes at the cost of an indirection going from a Directive to an Expr. However, it allows for other type expressions (e.g. parameterized prolongation s) to be described in the same scheme. Furthermore, an if constexpr and an if consteval are now just phased evaluation of ordinary if-statement. Similarly, static initialization can also be described as a phased evaluation.