mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
C++: Respond to PR reviews.
This commit is contained in:
@@ -53,7 +53,7 @@ private newtype TIRDataFlowNode =
|
||||
exists(Ssa::FinalParameterUse use |
|
||||
use.getParameter() = p and
|
||||
use.getIndirectionIndex() = indirectionIndex and
|
||||
parameterIsDefined(p)
|
||||
parameterIsRedefined(p)
|
||||
)
|
||||
} or
|
||||
TFinalGlobalValue(Ssa::GlobalUse globalUse) or
|
||||
@@ -66,7 +66,7 @@ private newtype TIRDataFlowNode =
|
||||
* Only parameters satisfying this predicate will generate a `FinalParameterNode` transferring
|
||||
* flow out of the function.
|
||||
*/
|
||||
private predicate parameterIsDefined(Parameter p) {
|
||||
private predicate parameterIsRedefined(Parameter p) {
|
||||
exists(Ssa::Def def |
|
||||
def.getSourceVariable().getBaseVariable().(Ssa::BaseIRVariable).getIRVariable().getAst() = p and
|
||||
def.getIndirectionIndex() = 0 and
|
||||
|
||||
@@ -28,6 +28,11 @@ module IRTest {
|
||||
private import semmle.code.cpp.ir.dataflow.DataFlow
|
||||
private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil
|
||||
|
||||
private string stars(int k) {
|
||||
k = [0 .. max(FinalParameterNode n | | n.getIndirectionIndex())] and
|
||||
(if k = 0 then result = "" else result = "*" + stars(k - 1))
|
||||
}
|
||||
|
||||
class IRParameterDefTest extends InlineExpectationsTest {
|
||||
IRParameterDefTest() { this = "IRParameterDefTest" }
|
||||
|
||||
@@ -41,7 +46,7 @@ module IRTest {
|
||||
location = f.getLocation() and
|
||||
element = p.toString() and
|
||||
tag = "ir-def" and
|
||||
value = "**********".prefix(n.getIndirectionIndex()) + p.getName()
|
||||
value = stars(n.getIndirectionIndex()) + p.getName()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user