@@ -63,7 +63,7 @@ namespace std {
6363 template <class T > T&& move(T& t) noexcept ; // simplified signature
6464}
6565
66- void identityOperations (int * source1) {
66+ void identityOperations (int * source1) { // $ ast-def=source1
6767 const int *x1 = std::move (source1);
6868 int * x2 = const_cast <int *>(x1);
6969 int * x3 = (x2);
@@ -86,7 +86,7 @@ void trackUninitialized() {
8686 sink (i1); // $ ast,ir
8787}
8888
89- void local_references (int &source1, int clean1) {
89+ void local_references (int &source1, int clean1) { // $ ast-def=source1 ir-def=*source1
9090 sink (source1); // $ ast,ir
9191 source1 = clean1;
9292 sink (source1); // clean
@@ -111,17 +111,17 @@ void local_references(int &source1, int clean1) {
111111 }
112112}
113113
114- int alwaysAssignSource (int *out) {
114+ int alwaysAssignSource (int *out) { // $ ast-def=out ir-def=*out
115115 *out = source ();
116116 return 0 ;
117117}
118118
119- int alwaysAssign0 (int *out) {
119+ int alwaysAssign0 (int *out) { // $ ast-def=out ir-def=*out
120120 *out = 0 ;
121121 return 0 ;
122122}
123123
124- int alwaysAssignInput (int *out, int in) {
124+ int alwaysAssignInput (int *out, int in) { // $ ast-def=out ir-def=*out
125125 *out = in;
126126 return 0 ;
127127}
@@ -468,7 +468,7 @@ void throughStmtExpr(int source1, int clean1) {
468468 sink (local); // $ ast,ir
469469}
470470
471- void intOutparamSource (int *p) {
471+ void intOutparamSource (int *p) { // $ ast-def=p ir-def=*p
472472 *p = source ();
473473}
474474
@@ -484,7 +484,7 @@ struct MyStruct {
484484 int * content;
485485};
486486
487- void local_field_flow_def_by_ref_steps_with_local_flow (MyStruct * s) {
487+ void local_field_flow_def_by_ref_steps_with_local_flow (MyStruct * s) { // $ ast-def=s
488488 writes_to_content (s->content );
489489 int * p_content = s->content ;
490490 sink (*p_content);
@@ -502,7 +502,7 @@ void regression_with_phi_flow(int clean1) {
502502 }
503503}
504504
505- int intOutparamSourceMissingReturn (int *p) {
505+ int intOutparamSourceMissingReturn (int *p) { // $ ast-def=p ir-def=*p
506506 *p = source ();
507507 // return deliberately omitted to test IR dataflow behavior
508508}
@@ -521,23 +521,23 @@ void uncertain_definition() {
521521 sink (stackArray[0 ]); // $ ast=519:19 ir SPURIOUS: ast=517:7
522522}
523523
524- void set_through_const_pointer (int x, const int **e)
524+ void set_through_const_pointer (int x, const int **e) // $ ast-def=e ir-def=**e ir-def=*e
525525{
526526 *e = &x;
527527}
528528
529- void test_set_through_const_pointer (int *e)
529+ void test_set_through_const_pointer (int *e) // $ ast-def=e
530530{
531531 set_through_const_pointer (source (), &e);
532532 sink (*e); // $ ir MISSING: ast
533533}
534534
535- void sink_then_source_1 (int * p) {
535+ void sink_then_source_1 (int * p) { // $ ast-def=p ir-def=*p
536536 sink (*p); // $ ir // Flow from the unitialized x to the dereference.
537537 *p = source ();
538538}
539539
540- void sink_then_source_2 (int * p, int y) {
540+ void sink_then_source_2 (int * p, int y) { // $ ast-def=p ir-def=*p
541541 sink (y); // $ SPURIOUS: ast ir
542542 *p = source ();
543543}
@@ -578,3 +578,14 @@ namespace IndirectFlowThroughGlobals {
578578 sink (*globalInt); // $ ir=562:17 ir=576:17 MISSING: ast=562:17 ast=576:17
579579 }
580580}
581+
582+ void write_to_param (int * x) { // $ ast-def=x ir-def=*x
583+ int s = source ();
584+ x = &s;
585+ }
586+
587+ void test_write_to_param () {
588+ int x = 0 ;
589+ write_to_param (&x);
590+ sink (x); // $ SPURIOUS: ast,ir
591+ }
0 commit comments