mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
Merge pull request #1048 from jbj/dataflow-link-targets
C++: Data flow dispatch across link targets
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
int source();
|
||||
void sink(int);
|
||||
|
||||
// For the purpose of this test, this function acts like it's defined in a
|
||||
// different link target such that we get two different functions named
|
||||
// `calleeAcrossLinkTargets` and no link from the caller to this one. The test
|
||||
// is getting that effect because the library can't distinguish the two
|
||||
// overloaded functions that differ only on `int` vs. `long`, so we might lose
|
||||
// this result and be forced to write a better test if the function signature
|
||||
// detection should improve.
|
||||
void calleeAcrossLinkTargets(long x) {
|
||||
sink(x);
|
||||
}
|
||||
|
||||
void calleeAcrossLinkTargets(int x); // no body
|
||||
|
||||
|
||||
void callerAcrossLinkTargets() {
|
||||
calleeAcrossLinkTargets(source());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// No flow into this function as its signature is not unique (in the limited
|
||||
// model of the library).
|
||||
void ambiguousCallee(long x) {
|
||||
sink(x);
|
||||
}
|
||||
|
||||
// No flow into this function as its signature is not unique (in the limited
|
||||
// model of the library).
|
||||
void ambiguousCallee(short x) {
|
||||
sink(x);
|
||||
}
|
||||
|
||||
void ambiguousCallee(int x); // no body
|
||||
|
||||
|
||||
void ambiguousCaller() {
|
||||
ambiguousCallee(source());
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
| acrossLinkTargets.cpp:12:8:12:8 | x | acrossLinkTargets.cpp:19:27:19:32 | call to source |
|
||||
| test.cpp:7:8:7:9 | t1 | test.cpp:6:12:6:17 | call to source |
|
||||
| test.cpp:9:8:9:9 | t1 | test.cpp:6:12:6:17 | call to source |
|
||||
| test.cpp:10:8:10:9 | t2 | test.cpp:6:12:6:17 | call to source |
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
| acrossLinkTargets.cpp:12:8:12:8 | Convert: (int)... | acrossLinkTargets.cpp:19:27:19:32 | Call: call to source |
|
||||
| acrossLinkTargets.cpp:12:8:12:8 | Load: x | acrossLinkTargets.cpp:19:27:19:32 | Call: call to source |
|
||||
| test.cpp:7:8:7:9 | Load: t1 | test.cpp:6:12:6:17 | Call: call to source |
|
||||
| test.cpp:9:8:9:9 | Load: t1 | test.cpp:6:12:6:17 | Call: call to source |
|
||||
| test.cpp:10:8:10:9 | Load: t2 | test.cpp:6:12:6:17 | Call: call to source |
|
||||
|
||||
Reference in New Issue
Block a user