mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Add tests around references to pointers with temporary objects.
This commit is contained in:
@@ -77,6 +77,8 @@
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:46:11:46:11 | n |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:49:5:49:7 | ... ++ |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:53:22:53:22 | i |
|
||||
| pass_by_ref.cpp:60:7:60:7 | x | pass_by_ref.cpp:60:10:60:11 | 2 |
|
||||
| pass_by_ref.cpp:66:8:66:8 | p | pass_by_ref.cpp:66:12:66:18 | 0 |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:5:3:5:8 | ... = ... |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:13:3:13:7 | ... = ... |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:19:5:19:9 | ... = ... |
|
||||
|
||||
@@ -75,6 +75,10 @@
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:46:11:46:11 | n | pass_by_ref.cpp:53:22:53:22 | i |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:49:5:49:7 | ... ++ | pass_by_ref.cpp:53:22:53:22 | i |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:53:22:53:22 | i | pass_by_ref.cpp:54:10:54:10 | i |
|
||||
| pass_by_ref.cpp:60:7:60:7 | x | pass_by_ref.cpp:60:10:60:11 | 2 | pass_by_ref.cpp:61:35:61:35 | x |
|
||||
| pass_by_ref.cpp:60:7:60:7 | x | pass_by_ref.cpp:60:10:60:11 | 2 | pass_by_ref.cpp:62:10:62:10 | x |
|
||||
| pass_by_ref.cpp:66:8:66:8 | p | pass_by_ref.cpp:66:12:66:18 | 0 | pass_by_ref.cpp:67:34:67:34 | p |
|
||||
| pass_by_ref.cpp:66:8:66:8 | p | pass_by_ref.cpp:66:12:66:18 | 0 | pass_by_ref.cpp:68:10:68:10 | p |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:5:3:5:8 | ... = ... | test.cpp:9:7:9:7 | a |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:13:3:13:7 | ... = ... | test.cpp:14:7:14:7 | a |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:13:3:13:7 | ... = ... | test.cpp:18:7:18:7 | a |
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
| pass_by_ref.cpp:31:7:31:9 | arr | pass_by_ref.cpp:31:15:31:18 | {...} | pass_by_ref.cpp:31:15:31:18 | {...} |
|
||||
| pass_by_ref.cpp:37:7:37:9 | arr | pass_by_ref.cpp:37:15:37:18 | {...} | pass_by_ref.cpp:37:15:37:18 | {...} |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:46:11:46:11 | n | pass_by_ref.cpp:46:11:46:11 | n |
|
||||
| pass_by_ref.cpp:60:7:60:7 | x | pass_by_ref.cpp:60:10:60:11 | 2 | pass_by_ref.cpp:60:10:60:11 | 2 |
|
||||
| pass_by_ref.cpp:66:8:66:8 | p | pass_by_ref.cpp:66:12:66:18 | 0 | pass_by_ref.cpp:66:12:66:18 | 0 |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:5:3:5:8 | ... = ... | test.cpp:5:7:5:8 | a0 |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:13:3:13:7 | ... = ... | test.cpp:13:7:13:7 | b |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:19:5:19:9 | ... = ... | test.cpp:19:9:19:9 | 1 |
|
||||
|
||||
@@ -151,6 +151,10 @@
|
||||
| pass_by_ref.cpp:49:5:49:5 | i | |
|
||||
| pass_by_ref.cpp:53:22:53:22 | i | non-const address |
|
||||
| pass_by_ref.cpp:54:10:54:10 | i | |
|
||||
| pass_by_ref.cpp:61:35:61:35 | x | const address |
|
||||
| pass_by_ref.cpp:62:10:62:10 | x | |
|
||||
| pass_by_ref.cpp:67:34:67:34 | p | const address |
|
||||
| pass_by_ref.cpp:68:10:68:10 | p | |
|
||||
| test.cpp:5:3:5:3 | a | |
|
||||
| test.cpp:5:7:5:8 | a0 | |
|
||||
| test.cpp:6:3:6:3 | b | |
|
||||
|
||||
@@ -53,3 +53,17 @@ int afterIf(int n) {
|
||||
referenceParameter(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
void constPointerReferenceParameter(int * const & pRef);
|
||||
|
||||
int temporaryObject() {
|
||||
int x = 2;
|
||||
constPointerReferenceParameter(&x);
|
||||
return x;
|
||||
}
|
||||
|
||||
int * noTemporaryObject() {
|
||||
int *p = nullptr;
|
||||
constPointerReferenceParameter(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -118,6 +118,10 @@
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:49:5:49:5 | i |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:53:22:53:22 | i |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:54:10:54:10 | i |
|
||||
| pass_by_ref.cpp:60:7:60:7 | x | pass_by_ref.cpp:61:35:61:35 | x |
|
||||
| pass_by_ref.cpp:60:7:60:7 | x | pass_by_ref.cpp:62:10:62:10 | x |
|
||||
| pass_by_ref.cpp:66:8:66:8 | p | pass_by_ref.cpp:67:34:67:34 | p |
|
||||
| pass_by_ref.cpp:66:8:66:8 | p | pass_by_ref.cpp:68:10:68:10 | p |
|
||||
| test.cpp:3:16:3:17 | a0 | test.cpp:5:7:5:8 | a0 |
|
||||
| test.cpp:3:24:3:25 | b0 | test.cpp:6:7:6:8 | b0 |
|
||||
| test.cpp:3:32:3:33 | c0 | test.cpp:7:7:7:8 | c0 |
|
||||
|
||||
@@ -56,6 +56,8 @@
|
||||
| pass_by_ref.cpp:45:17:45:17 | n | pass_by_ref.cpp:48:7:48:7 | n |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:49:5:49:5 | i |
|
||||
| pass_by_ref.cpp:46:7:46:7 | i | pass_by_ref.cpp:54:10:54:10 | i |
|
||||
| pass_by_ref.cpp:60:7:60:7 | x | pass_by_ref.cpp:62:10:62:10 | x |
|
||||
| pass_by_ref.cpp:66:8:66:8 | p | pass_by_ref.cpp:68:10:68:10 | p |
|
||||
| test.cpp:3:16:3:17 | a0 | test.cpp:5:7:5:8 | a0 |
|
||||
| test.cpp:3:24:3:25 | b0 | test.cpp:6:7:6:8 | b0 |
|
||||
| test.cpp:3:32:3:33 | c0 | test.cpp:7:7:7:8 | c0 |
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
| pass_by_ref.cpp:21:7:21:8 | i2 | pass_by_ref.cpp:24:26:24:27 | i2 | pass_by_ref.cpp:27:39:27:40 | i2 |
|
||||
| pass_by_ref.cpp:21:7:21:8 | i2 | pass_by_ref.cpp:25:27:25:28 | i2 | pass_by_ref.cpp:27:39:27:40 | i2 |
|
||||
| pass_by_ref.cpp:45:17:45:17 | n | pass_by_ref.cpp:46:11:46:11 | n | pass_by_ref.cpp:48:7:48:7 | n |
|
||||
| pass_by_ref.cpp:60:7:60:7 | x | pass_by_ref.cpp:61:35:61:35 | x | pass_by_ref.cpp:62:10:62:10 | x |
|
||||
| pass_by_ref.cpp:66:8:66:8 | p | pass_by_ref.cpp:67:34:67:34 | p | pass_by_ref.cpp:68:10:68:10 | p |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:14:7:14:7 | a | test.cpp:18:7:18:7 | a |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:14:7:14:7 | a | test.cpp:24:7:24:7 | a |
|
||||
| test.cpp:4:7:4:7 | a | test.cpp:14:7:14:7 | a | test.cpp:28:11:28:11 | a |
|
||||
|
||||
Reference in New Issue
Block a user