3 Commits

Author SHA1 Message Date
Timm Bäder
2e43ca49d0 [clang][Interp] Check variable initialization in Ret op
Just like we did with the l-to-r conversion, we need to do this
while the data is still alive.
2024-02-16 12:05:03 +01:00
Timm Baeder
d68aa303fe
[clang][Interp] Do r-to-l conversion immediately when returning (#80662)
First, we need to register local constant variables in C, so we get the
same diagnostic behavior as the current interpeter.

Second, when returning an LValue (as a Pointer), which we eventually
convert to an RValue, we need to do the conversion immediately when
saving the Pointer in the EvaluationResult. Otherwise, we will possibly
deallocate the data before doing the conversion (which will look at the
Block*).
2024-02-15 15:13:12 +01:00
Timm Baeder
4e7cf1b1ed
[clang][Interp] Add an EvaluationResult class (#71315)
Add an `EvaluationResult` class. This contains the result either as a
`Pointer` or as a `APValue`.

This way, we can inspect the result of the evaluation and diagnose
problems with it (e.g. uninitialized fields in global initializers or
pointers pointing to things they shouldn't point to).
2024-01-19 10:08:03 +01:00