mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
CPP: Pavel's sketch implementation.
This commit is contained in:
@@ -163,6 +163,14 @@ class Variable extends Declaration, @variable {
|
||||
predicate isCompilerGenerated() { compgenerated(underlyingElement(this)) }
|
||||
}
|
||||
|
||||
class ExtendedField extends Field {
|
||||
override Expr getAnAssignedValue() {
|
||||
exists(AggregateLiteral l |
|
||||
this.getDeclaringType() = l.getType() and result = l.getChild(this.getInitializationOrder())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A particular declaration or definition of a C/C++ variable.
|
||||
*/
|
||||
|
||||
@@ -7,12 +7,18 @@
|
||||
| test.cpp:10:10:10:11 | 13 | test.cpp:6:7:6:11 | ref_v |
|
||||
| test.cpp:11:6:11:10 | ... + ... | test.cpp:4:6:4:6 | v |
|
||||
| test.cpp:19:32:19:35 | 0.0 | test.cpp:19:27:19:28 | _y |
|
||||
| test.cpp:19:42:19:43 | _x | test.cpp:24:8:24:8 | x |
|
||||
| test.cpp:19:49:19:50 | _y | test.cpp:24:11:24:11 | y |
|
||||
| test.cpp:19:54:19:60 | 0.0 | test.cpp:24:14:24:14 | z |
|
||||
| test.cpp:35:16:35:25 | {...} | test.cpp:35:11:35:12 | v1 |
|
||||
| test.cpp:35:17:35:17 | 1 | test.cpp:31:6:31:8 | num |
|
||||
| test.cpp:35:20:35:24 | One | test.cpp:32:14:32:16 | str |
|
||||
| test.cpp:36:16:36:39 | {...} | test.cpp:36:11:36:12 | v2 |
|
||||
| test.cpp:36:24:36:24 | 2 | test.cpp:31:6:31:8 | num |
|
||||
| test.cpp:36:34:36:38 | Two | test.cpp:32:14:32:16 | str |
|
||||
| test.cpp:38:27:38:27 | 3 | test.cpp:31:6:31:8 | num |
|
||||
| test.cpp:38:30:38:36 | Three | test.cpp:32:14:32:16 | str |
|
||||
| test.cpp:48:16:48:28 | {...} | test.cpp:48:11:48:12 | v3 |
|
||||
| test.cpp:48:17:48:27 | {...} | test.cpp:45:12:45:14 | ms2 |
|
||||
| test.cpp:48:18:48:18 | 4 | test.cpp:31:6:31:8 | num |
|
||||
| test.cpp:48:21:48:26 | Four | test.cpp:32:14:32:16 | str |
|
||||
| test.cpp:52:19:52:27 | {...} | test.cpp:52:5:52:11 | myArray |
|
||||
| test.cpp:54:17:54:31 | {...} | test.cpp:54:6:54:11 | chars2 |
|
||||
| test.cpp:55:16:55:20 | abc | test.cpp:55:7:55:12 | chars3 |
|
||||
|
||||
@@ -32,10 +32,10 @@ struct myStruct1
|
||||
const char *str;
|
||||
};
|
||||
|
||||
myStruct1 v1 = {1, "One"}; // assigment to `v1`
|
||||
myStruct1 v2 = {.num = 2, .str = "Two"}; // assigment to `v2`
|
||||
myStruct1 v1 = {1, "One"}; // assigments to `v1`, `num`, `str`
|
||||
myStruct1 v2 = {.num = 2, .str = "Two"}; // assigments to `v2`, `num`, `str`
|
||||
|
||||
void test2(myStruct1 v = {3, "Three"}) // assignment to `v` (literal `{...}` has no location)
|
||||
void test2(myStruct1 v = {3, "Three"}) // assignments to `v` (literal `{...}` has no location), `num`, `str`
|
||||
{
|
||||
// ...
|
||||
}
|
||||
@@ -45,7 +45,7 @@ struct myStruct2
|
||||
myStruct1 ms2;
|
||||
};
|
||||
|
||||
myStruct2 v3 = {{4, "Four"}}; // assigment to `v3`
|
||||
myStruct2 v3 = {{4, "Four"}}; // assigments to `v3`, `ms2`, `num`, `str`
|
||||
|
||||
// ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user