Skip to content

Commit 3223bcd

Browse files
committed
Format ql and test.
1 parent fb4e418 commit 3223bcd

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

cpp/common/src/codingstandards/cpp/deadcode/UnusedVariables.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ string getConstExprValue(Variable v) {
161161
* Counts uses of `Variable` v in a local array of size `n`
162162
*/
163163
int countUsesInLocalArraySize(Variable v) {
164-
result = count(ArrayType at, LocalVariable arrayVariable |
165-
arrayVariable.getType().resolveTypedefs() = at and
166-
v.(PotentiallyUnusedLocalVariable).getFunction() = arrayVariable.getFunction() and
167-
at.getArraySize().toString() = getConstExprValue(v))
164+
result =
165+
count(ArrayType at, LocalVariable arrayVariable |
166+
arrayVariable.getType().resolveTypedefs() = at and
167+
v.(PotentiallyUnusedLocalVariable).getFunction() = arrayVariable.getFunction() and
168+
at.getArraySize().toString() = getConstExprValue(v)
169+
)
168170
}

cpp/common/test/rules/deadcode/DeadCode.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
| test.cpp:72:3:73:3 | try { ... } | This statement is dead code. |
1313
| test.cpp:73:17:74:3 | { ... } | This statement is dead code. |
1414
| test.cpp:79:17:80:3 | { ... } | This statement is dead code. |
15-
| test.cpp:85:3:85:44 | declaration | This statement is dead code. |
15+
| test.cpp:85:3:85:43 | declaration | This statement is dead code. |
1616
| test.cpp:87:3:87:30 | declaration | This statement is dead code. |
1717
| test.cpp:90:3:90:50 | declaration | This statement is dead code. |

cpp/common/test/rules/deadcode/test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ int test_dead_code(int x) {
8181

8282
static_assert(1); // COMPLIANT
8383

84-
constexpr int constexpr_array_size{6}; // COMPLIANT
85-
int unused_array[constexpr_array_size] {}; // NON_COMPLIANT
84+
constexpr int constexpr_array_size{6}; // COMPLIANT
85+
int unused_array[constexpr_array_size]{}; // NON_COMPLIANT
8686

8787
constexpr int unused_int{2}; // NON_COMPLIANT
8888

89-
constexpr int constexpr_used_array[]{3, 4, 5}; // COMPLIANT
89+
constexpr int constexpr_used_array[]{3, 4, 5}; // COMPLIANT
9090
constexpr int constexpr_unused_array[]{0, 1, 2}; // NON_COMPLIANT
9191

9292
return live5 + live6 + constexpr_used_array[1]; // COMPLIANT

0 commit comments

Comments
 (0)