@@ -8,7 +8,7 @@ struct Top {
88 virtual void isSink (int x) { }
99 virtual int notSource1 () { return source (); }
1010 virtual int notSource2 () { return source (); }
11- virtual void notSink (int x) { sink (x); }
11+ virtual void notSink (int x) { sink (x); } // $ SPURIOUS: ast,ir=37:19 ast,ir=45:18
1212};
1313
1414// This class has the correct behavior for just the functions ending in 2.
@@ -20,29 +20,29 @@ struct Middle : Top {
2020// This class has all the behavior suggested by the function names.
2121struct Bottom : Middle {
2222 int isSource1 () override { return source (); }
23- void isSink (int x) override { sink (x); }
23+ void isSink (int x) override { sink (x); } // $ ir=33:18 ir=41:17 ir=69:15 ir=73:14 ir=81:13 MISSING: ast=33:18 ast=41:17 ast=69:15 ast=73:14 ast=81:13
2424 int notSource1 () override { return 0 ; }
2525 void notSink (int x) override { }
2626};
2727
2828void VirtualDispatch (Bottom *bottomPtr, Bottom &bottomRef) {
2929 Top *topPtr = bottomPtr, &topRef = bottomRef;
3030
31- sink (topPtr->isSource1 ()); // flow [NOT DETECTED by AST]
32- sink (topPtr->isSource2 ()); // flow [NOT DETECTED by AST]
33- topPtr->isSink (source ()); // flow [NOT DETECTED by AST]
31+ sink (topPtr->isSource1 ()); // $ ir MISSING: ast
32+ sink (topPtr->isSource2 ()); // $ ir MISSING: ast
33+ topPtr->isSink (source ()); // causing a MISSING for ast
3434
35- sink (topPtr->notSource1 ()); // no flow [FALSE POSITIVE]
36- sink (topPtr->notSource2 ()); // no flow [FALSE POSITIVE]
37- topPtr->notSink (source ()); // no flow [FALSE POSITIVE]
35+ sink (topPtr->notSource1 ()); // $ SPURIOUS: ast,ir
36+ sink (topPtr->notSource2 ()); // $ SPURIOUS: ast,ir
37+ topPtr->notSink (source ()); // causing SPURIOUS for ast,ir
3838
39- sink (topRef.isSource1 ()); // flow [NOT DETECTED by AST]
40- sink (topRef.isSource2 ()); // flow [NOT DETECTED by AST]
41- topRef.isSink (source ()); // flow [NOT DETECTED by AST]
39+ sink (topRef.isSource1 ()); // $ ir MISSING: ast
40+ sink (topRef.isSource2 ()); // $ ir MISSING: ast
41+ topRef.isSink (source ()); // causing a MISSING for ast
4242
43- sink (topRef.notSource1 ()); // no flow [FALSE POSITIVE]
44- sink (topRef.notSource2 ()); // no flow [FALSE POSITIVE]
45- topRef.notSink (source ()); // no flow [FALSE POSITIVE]
43+ sink (topRef.notSource1 ()); // $ SPURIOUS: ast,ir
44+ sink (topRef.notSource2 ()); // $ SPURIOUS: ast,ir
45+ topRef.notSink (source ()); // causing SPURIOUS for ast,ir
4646}
4747
4848Top *globalBottom, *globalMiddle;
@@ -52,10 +52,10 @@ Top *readGlobalBottom() {
5252}
5353
5454void DispatchThroughGlobal () {
55- sink (globalBottom->isSource1 ()); // flow [NOT DETECTED by AST]
55+ sink (globalBottom->isSource1 ()); // $ ir MISSING: ast
5656 sink (globalMiddle->isSource1 ()); // no flow
5757
58- sink (readGlobalBottom ()->isSource1 ()); // flow [NOT DETECTED by AST]
58+ sink (readGlobalBottom ()->isSource1 ()); // $ ir MISSING: ast
5959
6060 globalBottom = new Bottom ();
6161 globalMiddle = new Middle ();
@@ -66,34 +66,34 @@ Top *allocateBottom() {
6666}
6767
6868void callSinkByPointer (Top *top) {
69- top->isSink (source ()); // flow [NOT DETECTED by AST]
69+ top->isSink (source ()); // leads to MISSING from ast
7070}
7171
7272void callSinkByReference (Top &top) {
73- top.isSink (source ()); // flow [NOT DETECTED by AST]
73+ top.isSink (source ()); // leads to MISSING from ast
7474}
7575
7676void globalVirtualDispatch () {
7777 callSinkByPointer (allocateBottom ());
7878 callSinkByReference (*allocateBottom ());
7979
8080 Top *x = allocateBottom ();
81- x->isSink (source ()); // flow [NOT DETECTED by AST]
81+ x->isSink (source ()); // $ MISSING: ast,ir
8282}
8383
8484Top *identity (Top *top) {
8585 return top;
8686}
8787
8888void callIdentityFunctions (Top *top, Bottom *bottom) {
89- identity (bottom)->isSink (source ()); // flow [NOT DETECTED]
89+ identity (bottom)->isSink (source ()); // $ MISSING: ast,ir
9090 identity (top)->isSink (source ()); // now flow
9191}
9292
9393using SinkFunctionType = void (*)(int );
9494
9595void callSink (int x) {
96- sink (x);
96+ sink (x); // $ ir=107:17 ir=140:8 ir=144:8 MISSING: ast=107:17 ast=140:8 ast=144:8
9797}
9898
9999SinkFunctionType returnCallSink () {
@@ -104,7 +104,7 @@ void testFunctionPointer(SinkFunctionType maybeCallSink, SinkFunctionType dontCa
104104 if (b) {
105105 maybeCallSink = returnCallSink ();
106106 }
107- maybeCallSink (source ()); // flow [NOT DETECTED by AST]
107+ maybeCallSink (source ());
108108 dontCallSink (source ()); // no flow
109109}
110110
@@ -126,8 +126,8 @@ namespace virtual_inheritance {
126126 // get flow from a `Middle` value to the call qualifier.
127127 Top *topPtr = bottomPtr, &topRef = bottomRef;
128128
129- sink (topPtr->isSource ()); // flow [NOT DETECTED]
130- sink (topRef.isSource ()); // flow [NOT DETECTED]
129+ sink (topPtr->isSource ()); // $ MISSING: ast,ir
130+ sink (topRef.isSource ()); // $ MISSING: ast,ir
131131 }
132132}
133133
@@ -170,6 +170,6 @@ void set_global_union_field_u_f() {
170170
171171void test_call_sink_through_union_2 () {
172172 set_global_union_field_u_f ();
173- call_sink_through_union_field_u_f (u2.u .f ); // flow [NOT DETECTED]
174- call_sink_through_union_field_u_g (u2.u .g ); // flow [NOT DETECTED]
173+ call_sink_through_union_field_u_f (u2.u .f ); // $ MISSING: ast,ir
174+ call_sink_through_union_field_u_g (u2.u .g ); // $ MISSING: ast,ir
175175}
0 commit comments