C++: Add QLDoc. Also actually implement 'uninitializedNode' since there's no reason not to do so.

This commit is contained in:
Mathias Vorreiter Pedersen
2026-02-27 17:16:17 +00:00
parent 1139059d77
commit db33dadb8e
2 changed files with 26 additions and 3 deletions

View File

@@ -926,19 +926,25 @@ module Public {
}
/**
* DEPRECATED: See UninitializedNode.
*
* Gets the `Node` corresponding to the value of an uninitialized local
* variable `v`.
*/
Node uninitializedNode(LocalVariable v) { none() }
Node uninitializedNode(LocalVariable v) { result.asUninitialized() = v }
/**
* Holds if `indirectOperand` is the dataflow node that represents the
* indirection of `operand` with indirection index `indirectionIndex`.
*/
predicate hasOperandAndIndex(
IndirectOperand indirectOperand, Operand operand, int indirectionIndex
) {
indirectOperand.hasOperandAndIndirectionIndex(operand, indirectionIndex)
}
/**
* Holds if `indirectInstr` is the dataflow node that represents the
* indirection of `instr` with indirection index `indirectionIndex`.
*/
predicate hasInstructionAndIndex(
IndirectInstruction indirectInstr, Instruction instr, int indirectionIndex
) {
@@ -1054,12 +1060,24 @@ abstract private class PartialDefinitionNode extends PostUpdateNode {
class IndirectArgumentOutNode extends PostUpdateNodeImpl {
override ArgumentOperand operand;
/**
* Gets the index of the argument that is associated with this post-
* update node.
*/
int getArgumentIndex() {
exists(CallInstruction call | call.getArgumentOperand(result) = operand)
}
/**
* Gets the `Operand` that represents the address of the value that is being
* updated.
*/
Operand getAddressOperand() { result = operand }
/**
* Gets the `CallInstruction` that represents the call that updated the
* argument.
*/
CallInstruction getCallInstruction() { result.getAnArgumentOperand() = operand }
/**

View File

@@ -14,6 +14,11 @@ cached
private module Cached {
private import DataFlowImplCommon as DataFlowImplCommon
/**
* This predicate exists to collapse the `cached` predicates in this module with the
* `cached` predicates in other C/C++ dataflow files, which is then collapsed
* with the `cached` predicates in `DataFlowImplCommon.qll`.
*/
cached
predicate forceCachingInSameStage() { DataFlowImplCommon::forceCachingInSameStage() }