Skip to content

Commit 9a23aba

Browse files
mbaludajketema
andauthored
Update CodeQL to 2.9.4
* Bump codeql submodule * Update test expectations for new flow paths * Fix braced initialization detection in A8-5-3 * Update symbol location in expected test output * Fix M0-1-4 to ignore compiler-generated accesses * Fix A0-1-5 performance issue with CodeQL 2.9.4 * Fix performance for A10-2-1 and M10-2-1 with QL 2.9.4 Co-authored-by: Jeroen Ketema <jketema@github.com>
1 parent bc70b04 commit 9a23aba

File tree

11 files changed

+33
-28
lines changed

11 files changed

+33
-28
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- `M0-1-4` - `SingleUsePODVariable.ql`
2+
- This rule no longer considers compiler-generated access to a variable when determining if the variable has a single use.
3+
- `A8-5-3` - `AvoidAutoWithBracedInitialization.ql`:
4+
- Fix regression where `auto x{0}` was no longer detected as a braced initialization with type `auto` with the latest CodeQL versions.
5+
- No longer falsely detect cases where braced initialization was not used, but where the inferred type would be `std::initializer_list`.
6+
- `A7-3-1` - `DefinitionNotConsideredForUnqualifiedLookup.ql`
7+
- The locations reported for names occurring in using-declarations has improved in the latest CodeQL versions.
8+
- Updated the CodeQL version to `2.9.4`.

codeql_modules/codeql

Submodule codeql updated 9191 files

cpp/autosar/src/rules/A10-2-1/NonVirtualPublicOrProtectedFunctionsRedefined.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ where
2929
not f instanceof Operator and
3030
(
3131
exists(MemberFunction shadowingFunction |
32-
getPublicOrPrivateDerivedClass+(f.getDeclaringType()) = shadowingFunction.getDeclaringType() and
33-
f.getName() = shadowingFunction.getName() and
32+
getPublicOrPrivateDerivedClass+(f.getDeclaringType()) = subclass and
33+
f.getName() = pragma[only_bind_out](shadowingFunction.getName()) and
3434
e = shadowingFunction and
3535
description = "this member function" and
3636
subclass = shadowingFunction.getDeclaringType()

cpp/autosar/src/rules/A8-5-3/AvoidAutoWithBracedInitialization.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ from Variable v
2121
where
2222
not isExcluded(v, InitializationPackage::avoidAutoWithBracedInitializationQuery()) and
2323
v.getTypeWithAuto().getUnspecifiedType() instanceof AutoType and
24-
v.getType().getUnspecifiedType().(Class).hasQualifiedName("std", "initializer_list")
24+
v.getInitializer().isBraced()
2525
select v, "Variable " + v.getName() + " of type auto uses braced initialization."

cpp/autosar/src/rules/M0-1-4/SingleUsePODVariable.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ int getUseCount(Variable v) {
1010
// We enforce that it's a POD type variable, so if it has an initializer it is explicit
1111
(if v.hasInitializer() then initializers = 1 else initializers = 0) and
1212
result =
13-
initializers + count(v.getAnAccess()) +
14-
count(UserProvidedConstructorFieldInit cfi | cfi.getTarget() = v)
13+
initializers +
14+
count(VariableAccess access | access = v.getAnAccess() and not access.isCompilerGenerated())
15+
+ count(UserProvidedConstructorFieldInit cfi | cfi.getTarget() = v)
1516
)
1617
}
1718

@@ -23,7 +24,9 @@ Element getSingleUse(Variable v) {
2324
or
2425
result = any(UserProvidedConstructorFieldInit cfi | cfi.getTarget() = v)
2526
or
26-
result = v.getAnAccess()
27+
exists(VariableAccess access |
28+
access = v.getAnAccess() and not access.isCompilerGenerated() and result = access
29+
)
2730
)
2831
}
2932

cpp/autosar/src/rules/M10-2-1/UniqueAccessibleEntityNamesInMultipleInheritance.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ where
5454
// and the declaring types of both declarations are not in the same inheritance hierarchy
5555
not decl1.getDeclaringType().getABaseClass*() = decl2.getDeclaringType().getABaseClass*() and
5656
// and both declarations are accessible from 'derived'
57-
decl1.isAccessibleFromClass(derived) and
58-
decl2.isAccessibleFromClass(derived) and
57+
pragma[only_bind_into](decl1).isAccessibleFromClass(derived) and
58+
pragma[only_bind_into](decl2).isAccessibleFromClass(derived) and
5959
// and the declaring type name (DTN) of decl1 is less than the DTN of decl2 (remove permutations)
6060
decl1 =
6161
rank[1](MemberEntityDeclaration decl |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| test.cpp:42:6:42:7 | declaration of f1 | Definition for 'f1' is not available for unqualified lookup because it is declared after $@ | test.cpp:39:1:39:13 | using f1 | using-declaration |
1+
| test.cpp:42:6:42:7 | declaration of f1 | Definition for 'f1' is not available for unqualified lookup because it is declared after $@ | test.cpp:39:12:39:13 | using f1 | using-declaration |
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#include <initializer_list>
22

33
void test() {
4-
auto a1(1); // COMPLIANT
5-
auto a2{1}; // NON_COMPLIANT
6-
auto a3 = 1; // COMPLIANT
7-
auto a4 = {1}; // NON_COMPLIANT
8-
int a5 = {1}; // COMPLIANT
9-
const auto a6(1); // COMPLIANT
10-
const auto a7{1}; // NON_COMPLIANT
4+
auto a1(1); // COMPLIANT
5+
auto a2{1}; // NON_COMPLIANT
6+
auto a3 = 1; // COMPLIANT
7+
auto a4 = {1}; // NON_COMPLIANT
8+
int a5 = {1}; // COMPLIANT
9+
const auto a6(1); // COMPLIANT
10+
const auto a7{1}; // NON_COMPLIANT
11+
auto a8 = std::initializer_list<int>(); // COMPLIANT
1112
}

cpp/common/src/codingstandards/cpp/FunctionEquivalence.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private newtype TParameterEquivalenceClass =
6666
*/
6767
class ParameterEquivalenceClass extends TParameterEquivalenceClass {
6868
/** Gets a `Function` whose `Parameter` at `index` is part of the equivalence class. */
69-
pragma[noinline]
69+
pragma[nomagic]
7070
private Function getAFunction(int index) {
7171
exists(string qualifiedName, string typeSig |
7272
functionSignature(result, qualifiedName, typeSig) and

cpp/common/test/rules/ownedpointervaluestoredinunrelatedsmartpointer/OwnedPointerValueStoredInUnrelatedSmartPointer.expected

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,14 @@ edges
1111
| test.cpp:3:14:3:15 | v1 | test.cpp:6:31:6:33 | call to get |
1212
| test.cpp:3:14:3:15 | v1 | test.cpp:7:28:7:29 | v2 |
1313
| test.cpp:4:13:4:14 | v1 | test.cpp:7:28:7:29 | v2 |
14-
| test.cpp:5:27:5:28 | v1 | ../../includes/standard-library/memory.h:76:17:76:19 | ptr |
1514
| test.cpp:5:27:5:29 | call to shared_ptr | test.cpp:6:31:6:33 | call to get |
16-
| test.cpp:6:31:6:33 | call to get | ../../includes/standard-library/memory.h:76:17:76:19 | ptr |
17-
| test.cpp:6:31:6:33 | call to get | ../../includes/standard-library/memory.h:76:17:76:19 | ptr |
18-
| test.cpp:7:28:7:29 | v2 | ../../includes/standard-library/memory.h:76:17:76:19 | ptr |
19-
| test.cpp:7:28:7:29 | v2 | ../../includes/standard-library/memory.h:76:17:76:19 | ptr |
2015
| test.cpp:8:8:8:14 | 0 | test.cpp:9:28:9:29 | v2 |
21-
| test.cpp:9:28:9:29 | v2 | ../../includes/standard-library/memory.h:76:17:76:19 | ptr |
2216
| test.cpp:10:8:10:17 | new | test.cpp:11:28:11:29 | v2 |
2317
| test.cpp:10:8:10:17 | new | test.cpp:11:28:11:29 | v2 |
2418
| test.cpp:10:8:10:17 | new | test.cpp:12:28:12:29 | v2 |
2519
| test.cpp:11:28:11:29 | ref arg v2 | test.cpp:12:28:12:29 | v2 |
2620
| test.cpp:11:28:11:29 | v2 | ../../includes/standard-library/memory.h:76:17:76:19 | ptr |
2721
| test.cpp:11:28:11:29 | v2 | test.cpp:11:28:11:29 | ref arg v2 |
28-
| test.cpp:12:28:12:29 | v2 | ../../includes/standard-library/memory.h:76:17:76:19 | ptr |
2922
| test.cpp:16:13:16:22 | new | test.cpp:17:27:17:28 | v1 |
3023
| test.cpp:16:13:16:22 | new | test.cpp:17:27:17:28 | v1 |
3124
| test.cpp:16:13:16:22 | new | test.cpp:19:6:19:7 | v1 |

supported_codeql_configs.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"supported_environment": [
33
{
4-
"codeql_cli": "2.7.6",
5-
"codeql_standard_library": "codeql-cli/v2.7.6",
6-
"codeql_cli_bundle": "codeql-bundle-20220120"
4+
"codeql_cli": "2.9.4",
5+
"codeql_standard_library": "codeql-cli/v2.9.4",
6+
"codeql_cli_bundle": "codeql-bundle-20220615"
77
}
88
],
99
"supported_language" : [

0 commit comments

Comments
 (0)