File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 5
5
* @kind problem
6
6
* @problem.severity warning
7
7
* @precision high
8
- * @id asymmetric-research/account-meta-deref-before-modify
8
+ * @id asymmetric-research/account-vtable-mismatch
9
9
*/
10
10
11
11
import cpp
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Swapped Parameters
3
+ * @description Detects cases where the parameters of a function are
4
+ * swapped between the function definition and the function
5
+ * implementation. If the both parameters are the same type and have the
6
+ * the compiler will not warn about it, but this confusion can easily
7
+ * lead to bugs.
8
+ * @kind problem
9
+ * @problem.severity warning
10
+ * @precision high
11
+ * @id asymmetric-research/swapped-parameters
12
+ */
13
+
14
+ import cpp
15
+ import filter
16
+
17
+ from Function f , ParameterDeclarationEntry defP , Parameter implP
18
+ where included ( f .getLocation ( ) ) and
19
+ implP = f .getAParameter ( ) and
20
+ defP = f .getADeclarationEntry ( ) .getAParameterDeclarationEntry ( ) and
21
+ defP .getName ( ) = implP .getName ( ) and
22
+ defP .getIndex ( ) != implP .getIndex ( )
23
+ select defP , "Parameter " + defP .getName ( ) + " is swapped with parameter " + implP .getName ( ) + " in function " + f .getName ( ) + "."
You can’t perform that action at this time.
0 commit comments