Skip to content

Commit ba9ebc6

Browse files
committed
Convert A18-9-4 to use the new dataflow library
The query seemed to depend on a bug in the old dataflow library before, where `asDefiningArgument` could return the function call instead of its argument.
1 parent 36eb3b3 commit ba9ebc6

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

cpp/autosar/src/rules/A18-9-4/ArgumentToForwardSubsequentlyUsed.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
import cpp
1515
import codingstandards.cpp.autosar
1616
import codingstandards.cpp.standardlibrary.Utility
17-
import semmle.code.cpp.dataflow.DataFlow
17+
import semmle.code.cpp.dataflow.new.DataFlow
1818

1919
from StdForwardCall f, Access a
2020
where
2121
not isExcluded(a, MoveForwardPackage::movedFromObjectReadAccessedQuery()) and
2222
exists(DataFlow::DefinitionByReferenceNode def |
23-
def.asDefiningArgument() = f and
23+
def.asDefiningArgument() = f.getArgument(0) and
2424
DataFlow::localFlow(def, DataFlow::exprNode(a))
2525
)
2626
select a, "The argument $@ of `std::forward` may be indeterminate when accessed at this location.",
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
WARNING: module 'DataFlow' has been deprecated and may be removed in future (ArgumentToForwardSubsequentlyUsed.ql:22,10-18)
2-
WARNING: module 'DataFlow' has been deprecated and may be removed in future (ArgumentToForwardSubsequentlyUsed.ql:24,5-13)
3-
WARNING: module 'DataFlow' has been deprecated and may be removed in future (ArgumentToForwardSubsequentlyUsed.ql:24,30-38)
41
| test.cpp:8:5:8:6 | t2 | The argument $@ of `std::forward` may be indeterminate when accessed at this location. | test.cpp:7:45:7:46 | t2 | t2 |

0 commit comments

Comments
 (0)