File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
src/codingstandards/cpp/deadcode Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -161,8 +161,10 @@ string getConstExprValue(Variable v) {
161161 * Counts uses of `Variable` v in a local array of size `n`
162162 */
163163int 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}
Original file line number Diff line number Diff line change 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. |
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments