CPP: Add dataflow FP with output arguments

This commit is contained in:
Alex Eyers-Taylor
2023-10-27 18:17:01 +01:00
parent 05385eb704
commit 60f3598da9
2 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
int source();
void sink(int);
void source_ref(int *toTaint) { // $ ir-def=*toTaint ast-def=toTaint
*toTaint = source();
}
void modify_copy(int* ptr) { // $ ast-def=ptr
int deref = *ptr;
int* other = &deref;
source_ref(other);
}
void test_output() {
int x = 0;
modify_copy(&x);
sink(x); // $ ir
}