C++: Respond to PR reviews.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-02-10 13:56:19 +00:00
parent 5bd7589109
commit 9a8b3bad31
2 changed files with 8 additions and 3 deletions

View File

@@ -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

View File

@@ -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()
)
}
}