|
18 | 18 |
|
19 | 19 | import cpp |
20 | 20 | import codingstandards.cpp.autosar |
21 | | -import semmle.code.cpp.dataflow.DataFlow |
| 21 | +import semmle.code.cpp.dataflow.new.DataFlow |
22 | 22 |
|
23 | 23 | class ReferenceTypeWithNonConstBaseType extends ReferenceType { |
24 | 24 | ReferenceTypeWithNonConstBaseType() { not this.getBaseType().isConst() } |
@@ -46,14 +46,16 @@ class ConstMemberFunctionWithRetNonConst extends ConstMemberFunction { |
46 | 46 | from ConstMemberFunctionWithRetNonConst fun, Locatable f |
47 | 47 | where |
48 | 48 | not isExcluded(fun, ConstPackage::constMemberFunctionReturnsNonConstPointerQuery()) and |
49 | | - exists(ReturnStmt ret | |
| 49 | + exists(ReturnStmt ret, DataFlow::Node vaNode, DataFlow::Node retNode | |
50 | 50 | ret.getEnclosingFunction() = fun and |
| 51 | + retNode.asIndirectExpr() = ret.getExpr() and |
51 | 52 | ( |
52 | | - f.(MemberVariable).getDeclaringType() = fun.getDeclaringType() and |
53 | | - DataFlow::localExprFlow(f.(MemberVariable).getAnAccess(), ret.getExpr()) |
| 53 | + vaNode.asIndirectExpr() = f.(MemberVariable).getAnAccess() and |
| 54 | + f.(MemberVariable).getDeclaringType() = fun.getDeclaringType() |
54 | 55 | or |
55 | | - DataFlow::localExprFlow(f.(ThisExpr), ret.getExpr()) |
56 | | - ) |
| 56 | + vaNode.asIndirectExpr() = f.(ThisExpr) |
| 57 | + ) and |
| 58 | + DataFlow::localFlow(vaNode, retNode) |
57 | 59 | ) |
58 | 60 | select fun, "Const member function returns a " + fun.getReturnTypeCategory() + " to class data $@.", |
59 | 61 | f, f.toString() |
0 commit comments