File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ import codingstandards.cpp.alertreporting.HoldsForAllCopies
22
22
23
23
class NonConstPointerVariableCandidate extends Variable {
24
24
NonConstPointerVariableCandidate ( ) {
25
+ // Ignore parameters in functions without bodies
26
+ ( this instanceof Parameter implies exists ( this .( Parameter ) .getFunction ( ) .getBlock ( ) ) ) and
25
27
// Ignore variables in functions that use ASM commands
26
28
not exists ( AsmStmt a | a .getEnclosingFunction ( ) = this .( LocalScopeVariable ) .getFunction ( ) ) and
27
29
// Avoid elements in macro expansions, as they cannot be equated across copies
Original file line number Diff line number Diff line change @@ -96,4 +96,7 @@ void test_struct(struct S *s) { // COMPLIANT
96
96
97
97
void test_struct_2 (struct S * s ) { // NON_COMPLIANT - could be const
98
98
s = 0 ;
99
- }
99
+ }
100
+
101
+ void test_no_body (int * p ); // COMPLIANT - no body, so cannot evaluate whether it
102
+ // should be const
You can’t perform that action at this time.
0 commit comments