C++: Add a way to test the behavior of 'asExpr' and 'toString' on dataflow nodes.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-01-24 14:14:38 +00:00
parent 67242278ee
commit 4e18cca0f4
5 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
void take_const_ref_int(const int &);
void test_materialize_temp_int()
{
take_const_ref_int(42); // $ asExpr=42 numberOfNodes="42: 2" asIndirectExpr=42 numberOfIndirectNodes="42: 2"
}
struct A {};
A get();
void take_const_ref(const A &);
void test1(){
take_const_ref(get()); // $ asExpr="call to get" numberOfNodes="call to get: 2" asIndirectExpr="call to get" numberOfIndirectNodes="call to get: 2"
}
void take_ref(A &);
A& get_ref();
void test2() {
take_ref(get_ref()); // $ asExpr="call to get_ref" asIndirectExpr="call to get_ref"
}