mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: Accept test changes.
This commit is contained in:
@@ -8,7 +8,7 @@ struct Top {
|
||||
virtual void isSink(int x) { }
|
||||
virtual int notSource1() { return source(); }
|
||||
virtual int notSource2() { return source(); }
|
||||
virtual void notSink(int x) { sink(x); } // $ SPURIOUS: ast,ir=37:19 ast,ir=45:18
|
||||
virtual void notSink(int x) { sink(x); } // $ SPURIOUS: ast=37:19 ast=45:18
|
||||
};
|
||||
|
||||
// This class has the correct behavior for just the functions ending in 2.
|
||||
@@ -32,16 +32,16 @@ void VirtualDispatch(Bottom *bottomPtr, Bottom &bottomRef) { // $ ast-def=bottom
|
||||
sink(topPtr->isSource2()); // $ ir MISSING: ast
|
||||
topPtr->isSink(source()); // causing a MISSING for ast
|
||||
|
||||
sink(topPtr->notSource1()); // $ SPURIOUS: ast,ir
|
||||
sink(topPtr->notSource2()); // $ SPURIOUS: ast,ir
|
||||
sink(topPtr->notSource1()); // $ SPURIOUS: ast
|
||||
sink(topPtr->notSource2()); // $ SPURIOUS: ast
|
||||
topPtr->notSink(source()); // causing SPURIOUS for ast,ir
|
||||
|
||||
sink(topRef.isSource1()); // $ ir MISSING: ast
|
||||
sink(topRef.isSource2()); // $ ir MISSING: ast
|
||||
topRef.isSink(source()); // causing a MISSING for ast
|
||||
|
||||
sink(topRef.notSource1()); // $ SPURIOUS: ast,ir
|
||||
sink(topRef.notSource2()); // $ SPURIOUS: ast,ir
|
||||
sink(topRef.notSource1()); // $ SPURIOUS: ast
|
||||
sink(topRef.notSource2()); // $ SPURIOUS: ast
|
||||
topRef.notSink(source()); // causing SPURIOUS for ast,ir
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ Top *readGlobalBottom() {
|
||||
}
|
||||
|
||||
void DispatchThroughGlobal() {
|
||||
sink(globalBottom->isSource1()); // $ ir MISSING: ast
|
||||
sink(globalBottom->isSource1()); // $ MISSING: ast,ir
|
||||
sink(globalMiddle->isSource1()); // no flow
|
||||
|
||||
sink(readGlobalBottom()->isSource1()); // $ ir MISSING: ast
|
||||
sink(readGlobalBottom()->isSource1()); // $ MISSING: ast,ir
|
||||
|
||||
globalBottom = new Bottom();
|
||||
globalMiddle = new Middle();
|
||||
@@ -93,7 +93,7 @@ void callIdentityFunctions(Top *top, Bottom *bottom) { // $ ast-def=bottom ast-d
|
||||
using SinkFunctionType = void (*)(int);
|
||||
|
||||
void callSink(int x) {
|
||||
sink(x); // $ ir=107:17 ir=140:8 ir=144:8 MISSING: ast=107:17 ast=140:8 ast=144:8
|
||||
sink(x); // $ ir MISSING: ast,ir=107:17 ast,ir=140:8 ast,ir=144:8
|
||||
}
|
||||
|
||||
SinkFunctionType returnCallSink() {
|
||||
@@ -126,8 +126,8 @@ namespace virtual_inheritance {
|
||||
// get flow from a `Middle` value to the call qualifier.
|
||||
Top *topPtr = bottomPtr, &topRef = bottomRef;
|
||||
|
||||
sink(topPtr->isSource()); // $ MISSING: ast,ir
|
||||
sink(topRef.isSource()); // $ MISSING: ast,ir
|
||||
sink(topPtr->isSource()); // $ ir MISSING: ast
|
||||
sink(topRef.isSource()); // $ ir MISSING: ast
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,26 +169,18 @@ irFlow
|
||||
| clang.cpp:50:35:50:40 | call to source | clang.cpp:53:17:53:26 | *stackArray |
|
||||
| clang.cpp:51:19:51:24 | call to source | clang.cpp:53:17:53:26 | *stackArray |
|
||||
| clang.cpp:57:21:57:28 | call to source | clang.cpp:59:8:59:8 | d |
|
||||
| dispatch.cpp:9:37:9:42 | call to source | dispatch.cpp:35:16:35:25 | call to notSource1 |
|
||||
| dispatch.cpp:9:37:9:42 | call to source | dispatch.cpp:43:15:43:24 | call to notSource1 |
|
||||
| dispatch.cpp:10:37:10:42 | call to source | dispatch.cpp:36:16:36:25 | call to notSource2 |
|
||||
| dispatch.cpp:10:37:10:42 | call to source | dispatch.cpp:44:15:44:24 | call to notSource2 |
|
||||
| dispatch.cpp:16:37:16:42 | call to source | dispatch.cpp:32:16:32:24 | call to isSource2 |
|
||||
| dispatch.cpp:16:37:16:42 | call to source | dispatch.cpp:40:15:40:23 | call to isSource2 |
|
||||
| dispatch.cpp:22:37:22:42 | call to source | dispatch.cpp:31:16:31:24 | call to isSource1 |
|
||||
| dispatch.cpp:22:37:22:42 | call to source | dispatch.cpp:39:15:39:23 | call to isSource1 |
|
||||
| dispatch.cpp:22:37:22:42 | call to source | dispatch.cpp:55:22:55:30 | call to isSource1 |
|
||||
| dispatch.cpp:22:37:22:42 | call to source | dispatch.cpp:58:28:58:36 | call to isSource1 |
|
||||
| dispatch.cpp:33:18:33:23 | call to source | dispatch.cpp:23:38:23:38 | x |
|
||||
| dispatch.cpp:37:19:37:24 | call to source | dispatch.cpp:11:38:11:38 | x |
|
||||
| dispatch.cpp:41:17:41:22 | call to source | dispatch.cpp:23:38:23:38 | x |
|
||||
| dispatch.cpp:45:18:45:23 | call to source | dispatch.cpp:11:38:11:38 | x |
|
||||
| dispatch.cpp:69:15:69:20 | call to source | dispatch.cpp:23:38:23:38 | x |
|
||||
| dispatch.cpp:73:14:73:19 | call to source | dispatch.cpp:23:38:23:38 | x |
|
||||
| dispatch.cpp:81:13:81:18 | call to source | dispatch.cpp:23:38:23:38 | x |
|
||||
| dispatch.cpp:107:17:107:22 | call to source | dispatch.cpp:96:8:96:8 | x |
|
||||
| dispatch.cpp:140:8:140:13 | call to source | dispatch.cpp:96:8:96:8 | x |
|
||||
| dispatch.cpp:144:8:144:13 | call to source | dispatch.cpp:96:8:96:8 | x |
|
||||
| dispatch.cpp:117:38:117:43 | call to source | dispatch.cpp:129:18:129:25 | call to isSource |
|
||||
| dispatch.cpp:117:38:117:43 | call to source | dispatch.cpp:130:17:130:24 | call to isSource |
|
||||
| flowOut.cpp:5:16:5:21 | call to source | flowOut.cpp:31:9:31:9 | x |
|
||||
| flowOut.cpp:5:16:5:21 | call to source | flowOut.cpp:61:8:61:11 | access to array |
|
||||
| flowOut.cpp:84:18:84:23 | call to source | flowOut.cpp:85:8:85:9 | * ... |
|
||||
|
||||
@@ -19,11 +19,11 @@ void test_simple() {
|
||||
|
||||
Base* b_ptr = &d;
|
||||
b_ptr->f(); // $ target=2
|
||||
b_ptr->virtual_f(); // $ target=8 SPURIOUS: target=3
|
||||
b_ptr->virtual_f(); // $ target=8
|
||||
|
||||
Base& b_ref = d;
|
||||
b_ref.f(); // $ target=2
|
||||
b_ref.virtual_f(); // $ target=8 SPURIOUS: target=3
|
||||
b_ref.virtual_f(); // $ target=8
|
||||
|
||||
Base* b_null = nullptr;
|
||||
b_null->f(); // $ target=2
|
||||
@@ -31,7 +31,7 @@ void test_simple() {
|
||||
|
||||
Base* base_is_derived = new Derived();
|
||||
base_is_derived->f(); // $ target=2
|
||||
base_is_derived->virtual_f(); // $ target=8 SPURIOUS: target=3
|
||||
base_is_derived->virtual_f(); // $ target=8
|
||||
|
||||
Base* base_is_base = new Base();
|
||||
base_is_base->f(); // $ target=2
|
||||
@@ -59,12 +59,12 @@ void test_fields() {
|
||||
s.b2 = new Derived();
|
||||
|
||||
s.b1->virtual_f(); // $ target=3
|
||||
s.b2->virtual_f(); // $ SPURIOUS: target=3 MISSING: target=8
|
||||
s.b2->virtual_f(); // $ target=8
|
||||
|
||||
s.b1 = new Derived();
|
||||
s.b2 = new Base();
|
||||
s.b1->virtual_f(); // $ MISSING: target=8 SPURIOUS: target=3 // type-tracking has no 'clearsContent' feature and C/C++ doesn't have field-based SSA
|
||||
s.b2->virtual_f(); // $ target=3 // type-tracking has no 'clearsContent' feature and C/C++ doesn't have field-based SSA
|
||||
s.b1->virtual_f(); // $ target=8 SPURIOUS: target=3 // type-tracking has no 'clearsContent' feature and C/C++ doesn't have field-based SSA
|
||||
s.b2->virtual_f(); // $ target=3 SPURIOUS: target=8 // type-tracking has no 'clearsContent' feature and C/C++ doesn't have field-based SSA
|
||||
}
|
||||
|
||||
Base* getDerived() {
|
||||
@@ -73,7 +73,7 @@ Base* getDerived() {
|
||||
|
||||
void test_getDerived() {
|
||||
Base* b = getDerived();
|
||||
b->virtual_f(); // $ target=8 SPURIOUS: target=3
|
||||
b->virtual_f(); // $ target=8
|
||||
|
||||
Derived d = *(Derived*)getDerived();
|
||||
d.virtual_f(); // $ target=8
|
||||
@@ -98,7 +98,7 @@ void test_write_to_arg() {
|
||||
{
|
||||
Base* b;
|
||||
write_to_arg_2(&b);
|
||||
b->virtual_f(); // $ target=8 SPURIOUS: target=3
|
||||
b->virtual_f(); // $ target=8
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ void set_global_to_derived() {
|
||||
}
|
||||
|
||||
void read_global() {
|
||||
global_derived->virtual_f(); // $ target=8 SPURIOUS: target=3
|
||||
global_derived->virtual_f(); // $ SPURIOUS: target=3 MISSING: target=8
|
||||
}
|
||||
|
||||
Base* global_base_or_derived;
|
||||
@@ -123,5 +123,5 @@ void set_global_base_or_derived_2() {
|
||||
}
|
||||
|
||||
void read_global_base_or_derived() {
|
||||
global_base_or_derived->virtual_f(); // $ target=3 target=8
|
||||
global_base_or_derived->virtual_f(); // $ target=3 MISSING: target=8
|
||||
}
|
||||
Reference in New Issue
Block a user