mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
C++: Also resolve typedefs nested inside arrays.
This commit is contained in:
@@ -529,8 +529,21 @@ private string getTypeName(Type t, boolean needsSpace) {
|
||||
needsSpace = false and
|
||||
(if needsSpace0 = true then result = s + " *" else result = s + "*")
|
||||
or
|
||||
// We don't need to check for `needsSpace0` here because the type of
|
||||
// `x` in `int x[1024]` is formatted without a space between the bracket
|
||||
// and the `int` by `Type.getName`. That is, calling `Type.getName` on
|
||||
// the type of `x` gives `int[1024]` and not `int [1024]`.
|
||||
needsSpace = false and
|
||||
exists(ArrayType array | array = dt |
|
||||
result = s + "[" + array.getArraySize() + "]"
|
||||
or
|
||||
not array.hasArraySize() and
|
||||
result = s + "[]"
|
||||
)
|
||||
or
|
||||
not dt instanceof ReferenceType and
|
||||
not dt instanceof PointerType and
|
||||
not dt instanceof ArrayType and
|
||||
result = s and
|
||||
needsSpace = needsSpace0
|
||||
)
|
||||
|
||||
@@ -76,3 +76,5 @@
|
||||
| tests.cpp:437:5:437:36 | [summary] to write: ReturnValue in madCallReturnValueIgnoreFunction | ReturnNode | madCallReturnValueIgnoreFunction | madCallReturnValueIgnoreFunction |
|
||||
| tests.cpp:459:5:459:31 | [summary param] *0 in parameter_ref_to_return_ref | ParameterNode | parameter_ref_to_return_ref | parameter_ref_to_return_ref |
|
||||
| tests.cpp:459:5:459:31 | [summary] to write: ReturnValue[*] in parameter_ref_to_return_ref | ReturnNode | parameter_ref_to_return_ref | parameter_ref_to_return_ref |
|
||||
| tests.cpp:471:5:471:17 | [summary param] *0 in receive_array | ParameterNode | receive_array | receive_array |
|
||||
| tests.cpp:471:5:471:17 | [summary] to write: ReturnValue in receive_array | ReturnNode | receive_array | receive_array |
|
||||
|
||||
@@ -30,6 +30,7 @@ summarizedCallables
|
||||
| tests.cpp:436:6:436:25 | madCallArg0WithValue |
|
||||
| tests.cpp:437:5:437:36 | madCallReturnValueIgnoreFunction |
|
||||
| tests.cpp:459:5:459:31 | parameter_ref_to_return_ref |
|
||||
| tests.cpp:471:5:471:17 | receive_array |
|
||||
sourceCallables
|
||||
| tests.cpp:3:5:3:10 | source |
|
||||
| tests.cpp:4:6:4:14 | sourcePtr |
|
||||
@@ -231,7 +232,6 @@ sourceCallables
|
||||
| tests.cpp:464:36:464:36 | s |
|
||||
| tests.cpp:465:6:465:6 | y |
|
||||
| tests.cpp:469:7:469:9 | INT |
|
||||
| tests.cpp:471:5:471:17 | receive_array |
|
||||
| tests.cpp:471:23:471:23 | a |
|
||||
| tests.cpp:473:6:473:23 | test_receive_array |
|
||||
| tests.cpp:474:6:474:6 | x |
|
||||
|
||||
@@ -468,11 +468,11 @@ void test_parameter_ref_to_return_ref() {
|
||||
|
||||
using INT = int;
|
||||
|
||||
int receive_array(INT a[20]); // $ MISSING: interpretElement
|
||||
int receive_array(INT a[20]); // $ interpretElement
|
||||
|
||||
void test_receive_array() {
|
||||
int x = source();
|
||||
int array[10] = {x};
|
||||
int y = receive_array(array);
|
||||
sink(y); // $ MISSING: ir
|
||||
sink(y); // $ ir
|
||||
}
|
||||
Reference in New Issue
Block a user