File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,12 @@ class Node extends TIRDataFlowNode {
231231 /** Gets the positional parameter corresponding to this node, if any. */
232232 Parameter asParameter ( ) { result = asParameter ( 0 ) }
233233
234+ /**
235+ * Gets the uninitialized local variable corresponding to this node, if
236+ * any.
237+ */
238+ LocalVariable asUninitialized ( ) { result = this .( UninitializedNode ) .getLocalVariable ( ) }
239+
234240 /**
235241 * Gets the positional parameter corresponding to the node that represents
236242 * the value of the parameter after `index` number of loads, if any. For
@@ -666,6 +672,25 @@ class IndirectOperand extends Node, TIndirectOperand {
666672 }
667673}
668674
675+ /**
676+ * The value of an uninitialized local variable, viewed as a node in a data
677+ * flow graph.
678+ */
679+ class UninitializedNode extends Node {
680+ LocalVariable v ;
681+
682+ UninitializedNode ( ) {
683+ exists ( Ssa:: Def def |
684+ def .getDefiningInstruction ( ) instanceof UninitializedInstruction and
685+ Ssa:: nodeToDefOrUse ( this , def ) and
686+ v = def .getSourceVariable ( ) .getBaseVariable ( ) .( Ssa:: BaseIRVariable ) .getIRVariable ( ) .getAst ( )
687+ )
688+ }
689+
690+ /** Gets the uninitialized local variable corresponding to this node. */
691+ LocalVariable getLocalVariable ( ) { result = v }
692+ }
693+
669694/**
670695 * INTERNAL: Do not use.
671696 *
You can’t perform that action at this time.
0 commit comments